Extraction Method Cuts Web Page Tokens by 71%
Key point
Research has shown that structural HTML extraction can reduce LLM agents' token usage by 71.5% while maintaining answer quality.
Details
To optimize RAG and agent systems, an experiment was conducted comparing simple HTML-to-text methods against Structural Extraction methods across 100 web pages. Structural Extraction leverages semantic HTML tags and the text and link density of DOM subtrees.
The experiment results showed that the Structural Extraction method achieved an average 71.5% token reduction. The reduction rates by category are as follows:
- News: 65.5%
- E-commerce: 62.5%
- Docs: 46.3%
- SaaS Marketing: 45.9%
- Social Media: 30.7%
Verification via LLM-as-judge (Qwen2.5-7B) showed a content preservation score of 77.7/100. In terms of Answer Quality Delta, the method maintained parity with the baseline, demonstrating that efficient processing is possible with token costs reduced to about 28.5% without any quality degradation.
Meanwhile, it was confirmed that Anthropic's Claude Code internally has a step that compresses web data using the Haiku model during WebFetch. This behavior is not documented officially, so when benchmarking using Claude Code, it should be noted that Anthropic's compression layer—rather than the tool's own performance—may affect the results.
The related code and methodology can be found in the sentinel repository on GitHub.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.