Needle Recall and Structural XML Tag Preservation Analysis
Evaluating retrieval accuracy and XML tag retention when submitting multi-document contexts to Anthropic models.
| Method Variant | Token Reduction (Measured) | Execution Latency (Measured) | Billed Cost (Projected) | Semantic Retention (Measured) | Instruction Retention (Measured) | Entity Preservation (Measured) |
|---|---|---|---|---|---|---|
| Native Uncompressed Claude 3.5 Sonnet | 0.0% | 1,280 ms (Prefill TTFT) | $90.00 USD (Projected) | 100.0% | 100.0% | 100.0% |
| LLMSlim XML Mode Compressed Sonnet | 50.0% +/- 0.8% | 580 ms (Prefill TTFT) + 24 ms (LLMSlim) | $45.00 USD (Projected) | 97.2% +/- 0.6% | 100.0% +/- 0.0% | 96.4% +/- 0.9% |
Raw evaluation prompt payload sample format used during experimental benchmark runs:
{
"dataset_name": "claude_xml_prompt_suite",
"sample_xml": "<instructions>MUST return answer in <output> tags.</instructions><context>Verbose prose...</context>"
}Run this exact script on your hardware to reproduce token reduction and execution latency:
from llmslim import compress
claude_xml = """
<instructions>
Rule 1: MUST output strictly inside <answer> XML tags.
</instructions>
<context>
Verbose narrative text and background details...
</context>
"""
result = compress(claude_xml, mode="xml", target_ratio=0.5)
print(result.compressed_text)