⚠️ Important Limitations
This is SEMANTIC compression, not bit-perfect lossless.
- - L1-L2: Verified reconstruction, production-ready
- L3-L4: Experimental, may lose subtle information
- Never use for: Medical dosages, legal text, financial figures, safety-critical data
The Validation Loop
CODEBLOCK0
Convergence = verified. No convergence after 3 rounds = level too aggressive.
Quick Reference
| Task | Load |
|---|
| Compression levels (L1-L4) | INLINECODE0 |
| Validation algorithm details |
validation.md |
| Format-specific strategies |
formats.md |
| Token budgeting and metrics |
metrics.md |
Compression Levels
| Level | Ratio | Reliability | Use Case |
|---|
| L1 | ~0.8x | ✅ High | Production, human-readable |
| L2 |
~0.5x | ✅ Good | System prompts, repeated use |
| L3 | ~0.3x | ⚠️ Moderate | Experimental, review output |
| L4 | ~0.15x | ⚠️ Low | Research only, expect losses |
Anchor Checksum System
Before compression, extract critical facts:
CODEBLOCK1
Reconstruction MUST reproduce these exactly. If anchors mismatch → compression failed.
Core Rules
- 1. Always validate — Never trust compression without reconstruction test
- Use anchors — Extract numbers, names, dates before compressing
- Cap at L2 for production — L3-L4 are experimental
- Report confidence — Include iteration count and anchor match rate
- Independent verification — Consider different model for reconstruction
Cost-Benefit Reality
Each compression costs 3-4 LLM calls. Break-even calculation:
CODEBLOCK2
Only cost-effective if: You'll retrieve the compressed content 6-8+ times.
For one-time use → just use the original text.
Before Compressing
- - [ ] Content type is NOT safety-critical
- [ ] Target level chosen (L1-L2 recommended)
- [ ] Anchors identified (numbers, names, dates)
- [ ] ROI makes sense (multiple retrievals expected)
⚠️ 重要限制
这是语义压缩,而非比特级无损压缩。
- - L1-L2:已验证可重建,可投入生产使用
- L3-L4:实验性功能,可能丢失细微信息
- 切勿用于: 医疗剂量、法律文本、财务数据、安全关键信息
验证循环
- 1. 压缩原始内容 O → 压缩后内容 C
- 从 O 中提取锚点(实体、数字、日期)
- 重建 C → R(不参考 O)
- 验证:锚点匹配 + 语义差异
- 若不匹配 → 补充缺失信息后优化 C
- 重复直至验证通过(最多 3 次迭代)
收敛 = 验证通过。3 轮后仍未收敛 = 压缩级别过高。
快速参考
| 任务 | 参考文件 |
|---|
| 压缩级别(L1-L4) | levels.md |
| 验证算法详情 |
validation.md |
| 特定格式策略 | formats.md |
| Token 预算与指标 | metrics.md |
压缩级别
| 级别 | 压缩比 | 可靠性 | 适用场景 |
|---|
| L1 | ~0.8x | ✅ 高 | 生产环境,人类可读 |
| L2 |
~0.5x | ✅ 良好 | 系统提示词,重复使用 |
| L3 | ~0.3x | ⚠️ 中等 | 实验性质,需审查输出 |
| L4 | ~0.15x | ⚠️ 低 | 仅限研究,预期有损失 |
锚点校验系统
压缩前,提取关键事实:
[锚点:3 人,42,000 美元,2024-03-15,阿尔法项目]
重建结果必须精确复现上述内容。锚点不匹配 → 压缩失败。
核心规则
- 1. 始终验证 — 未经重建测试,切勿信任压缩结果
- 使用锚点 — 压缩前提取数字、名称、日期
- 生产环境上限为 L2 — L3-L4 为实验性质
- 报告置信度 — 包含迭代次数和锚点匹配率
- 独立验证 — 可考虑使用不同模型进行重建
成本效益分析
每次压缩消耗 3-4 次 LLM 调用。盈亏平衡计算:
盈亏平衡检索次数 = 压缩消耗的 Token / 每次使用节省的 Token
仅在以下情况具有成本效益: 你将检索压缩内容 6-8 次以上。
一次性使用 → 直接使用原始文本。
压缩前检查清单
- - [ ] 内容类型不属于安全关键信息
- [ ] 已选择目标级别(推荐 L1-L2)
- [ ] 已识别锚点(数字、名称、日期)
- [ ] 投资回报率合理(预期多次检索)