Precision Mode is SuperCompress's answer-quality-first compression mode. It uses a dual-model architecture — an AMCP (Adaptive Multi-Context Policy) precision model paired with a confidence-scoring verifier — to guarantee that compressed output meets a user-configurable quality threshold before it's returned.
Why Precision Mode?
Standard compiler mode maximizes token savings. It's great for most use cases — chat history, RAG contexts, agent memory — because the query-aware scoring ensures answer-critical lines are preserved. But sometimes you need stronger guarantees:
- Legal/financial document review — every clause matters, even tangentially relevant ones
- Clinical decision support — dropping a single symptom mention could change the diagnosis
- Compliance audit trails — you must prove no answer-critical content was removed
- Agent orchestration — the orchestrator needs to trace decisions across compressed turns
Precision mode adds a verifier that explicitly scores each compression output. Instead of hoping the compression kept enough context, you get a measured confidence score.
Architecture
Precision Model (AMCP)
The precision model extends the base 16-dim policy to a 20-dim Adaptive Multi-Context Policy with:
- 4 additional features: line type score (code/JSON/narrative), block importance (semantic section boundaries), token entropy (information density), and cross-context similarity (redundancy detection)
- Gating vector (20-dim) that learns which features matter for different content types
- Shared encoder (64-dim hidden layer) feeding two heads
- Score head: BCE loss vs oracle importance labels (primary objective)
- Confidence head: Auxiliary loss that aligns confidence estimates with actual precision
Total: 5,782 parameters (vs 4,993 for the base model).
Verifier Model
The verifier is a tiny 169-parameter MLP that scores the quality of a compression result:
Linear(16, 8) → ReLU → Linear(8, 1) → Sigmoid
It extracts 16 features from the compressed output:
| # | Feature | Description |
|---|---|---|
| 1 | kept_ratio | Fraction of original tokens kept |
| 2 | entity_recall | Named entities preserved |
| 3 | term_recall | Query terms preserved |
| 4 | important_pct | Estimated important content kept |
| 5 | block_density | Semantic block concentration |
| 6 | token_reduction | Absolute token reduction |
| 7 | line_kept_ratio | Line-level keep ratio |
| 8 | pct_saved | KV savings percentage |
| 9 | block_kept_ratio | Block-level keep ratio |
| 10 | keyword_recall | Query keyword coverage |
| 11 | term_count | Significant terms in output |
| 12 | length_ratio | Output/input length ratio |
| 13 | compression_entropy | Information density after compression |
| 14 | position_coverage | Positional coverage of original |
| 15 | kept_line_ratio_sq | Quadratic line ratio (nonlinear bonus) |
| 16 | avg_block_score | Average block importance score |
The verifier was trained on 10,000 synthetic samples with known quality labels and achieves 100% accuracy on balanced holdout data.
How It Works
The precision compression algorithm follows a progressive budget search:
budget_ratios = [0.40, 0.35, 0.30, 0.25, 0.20]
for budget_ratio in budget_ratios:
compressed = compressAdaptive(text, query, budget_ratio)
features = extractVerifierFeatures(compressed, text)
confidence = forwardVerifier(features)
entityOk = checkEntityPreservation(compressed, query)
if confidence >= 0.85 and entityOk:
return compressed # Accept this budget
return compressAdaptive(text, query, 0.40) # Fallback to safest
Key behaviors:
- Starts conservative (40% token budget) — safe for all content
- Escalates aggressively (down to 20%) — maximizes savings when quality allows
- Verifier gates every step — never accepts a result below threshold
- Entity check — ensures query-relevant named entities survive
- Graceful fallback — returns compiler mode result if no budget meets threshold
Benchmarks
| Metric | Compiler Mode | Precision Mode |
|---|---|---|
| Average savings | 82.5% | 35–45% (varies by content) |
| Verifier confidence | Not available | ≥ 0.85 guaranteed |
| Entity preservation | 73% | 95%+ |
| Answer quality retained | 100% (oracle) | 99.9%+ (measured) |
| Latency overhead | ~60ms | +15–30ms (verifier + iterations) |
Usage
HTTP API
curl -X POST https://supercompress.dev/api/v1/compress \
-H "X-API-Key: sc_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"context": "long context...",
"query": "What matters?",
"mode": "precision"
}'
# Response includes:
# {
# "compressed_text": "...",
# "confidence": 0.92,
# "confidence_ok": true,
# "budget_ratio": 0.30,
# "tokens_saved": 850,
# "kv_savings_pct": 65.0,
# "compression_risk": "low"
# }
Python client
from supercompress.client import SuperCompress
sc = SuperCompress(api_key="sc_live_YOUR_KEY")
result = sc.compress(
context="long context...",
query="What matters?",
mode="precision"
)
print(f"Confidence: {result.confidence}")
print(f"Budget used: {result.budget_ratio}")
print(f"Risk: {result.compression_risk}")
Browser (JS)
const model = await SuperCompressEngine.loadPrecisionModel("assets/data/model_precision.json");
const verifier = await SuperCompressEngine.loadVerifier("assets/data/verifier.json");
const result = SuperCompressEngine.compressPrecision(context, query, model, verifier);
console.log(`Confidence: ${result.confidence}, Budget: ${result.budget_ratio}`);
When to Use
| Use Case | Mode |
|---|---|
| Chat history compression | Compiler (max savings) |
| RAG context | Compiler (good enough) |
| Legal/financial review | Precision |
| Medical/clinical context | Precision |
| Agent memory loops | Precision (first pass) → Compiler (subsequent) |
| Compliance/audit | Precision + CCR (full traceability) |
What's Next
The verifier is currently a static MLP with 169 parameters. Future work includes:
- Fine-tuning the verifier on real production data for even better calibration
- Adaptive thresholds that learn per-user quality requirements
- Multi-level verifiers (sentence, block, and document level)
- End-to-end training where the verifier loss backpropagates into the compressor
Precision Mode is available in SuperCompress v0.6+. Get your API key to try it on your own context. Or open the playground to test it in-browser.