भरोसा मत करें।
सत्यापित करें।
किसी भी प्रोजेक्ट में lean-ctx benchmark run चलाएँ। वास्तविक टोकन गणना। वास्तविक सटीकता मेट्रिक्स। tiktoken (o200k_base) से मापा गया।
Measured. Verified.
Benchmark local चलता है, exact tokenizer से tokens गिनता है, और quality bar से नीचे compressions को reject करता है।
Exact token count
Modern LLMs वाले tokenizer से count - कोई estimates नहीं।
tiktoken o200k_base Quality guard
AST preservation, identifiers और line structure को score करता है। failing outputs auto block होते हैं।
threshold: Q ≥ 95% · ρ ≥ 15% Reproducible
आपके repo पर चलता है। Same inputs → same numbers. CI और regressions के लिए बढ़िया।
offline · deterministic Before & After
The same file. The same information. Dramatically fewer tokens.
88% fewer tokens
यह कैसे काम करता है
किसी भी फ़ाइल या डायरेक्टरी को इंगित करें
एक फ़ाइल, एक डायरेक्टरी या एक ग्लोब पैटर्न दें। बेंचमार्क इंजन सब कुछ प्रोसेस करता है जो मिलता है।
lean-ctx benchmark run src/ सटीक टोकन माप
o200k_base एन्कोडिंग के साथ tiktoken का उपयोग करता है (GPT-4o, Claude और आधुनिक LLM के समान)। कोई अनुमान नहीं - वास्तविक टोकन गणना।
tiktoken o200k_base प्रति मोड बचत
हर कम्प्रेशन मोड के लिए सटीकता स्कोर और बचत प्रतिशत प्राप्त करें। प्रत्येक उपयोग के लिए सही मोड चुनें।
modes: 10 बेंचमार्क क्रियान्वयन में
अपने प्रोजेक्ट की किसी भी फ़ाइल पर बेंचमार्क चलाएँ। आउटपुट प्रत्येक कम्प्रेशन मोड के लिए सटीक टोकन गणना, बचत प्रतिशत और गुणवत्ता संरक्षण स्कोर दिखाता है।
प्रति-फ़ाइल विवरण - प्रत्येक मोड के पहले और बाद के टोकन
गुणवत्ता स्कोर - AST, पहचानकर्ता और कोड पंक्तियाँ संरक्षित
समग्र कुल - सर्वोत्तम मोड अनुशंसा के साथ डायरेक्टरी-व्यापी बचत
$ lean-ctx benchmark run src/auth.ts
◆ lean-ctx Benchmark
────────────────────────────────────────
src/auth.ts (123 lines, 3,517 tokens)
────────────────────────────────────────
Mode Tokens Saved Rate
full 3,517 0 0%
map 412 3,105 88%
signatures 252 3,265 93%
diff 187 3,330 95%
aggressive 298 3,219 92%
entropy 312 3,205 91%
────────────────────────────────────────
Quality: AST 98% | Idents 97% | Lines 96%
Encoding: tiktoken o200k_base | Time: 12ms
रीड मोड तुलना
full 0% जिन फ़ाइलों को आप संपादित करेंगे
सब कुछ - पूर्ण सामग्री ~13 टोकन पर पुन: पढ़ने के लिए कैश्ड
map 70–88% केवल-संदर्भ फ़ाइलें
डिपेंडेंसी ग्राफ़, एक्सपोर्ट्स, मुख्य सिग्नेचर
signatures 55–93% API सतह अन्वेषण
केवल फ़ंक्शन/क्लास/टाइप सिग्नेचर
diff 80–95% संपादन के बाद
न्यूनतम आसपास के संदर्भ के साथ बदली हुई पंक्तियाँ
aggressive 75–90% बड़ी बॉयलरप्लेट फ़ाइलें
संरचना और तर्क, सिंटैक्स हटाया गया
entropy 70–83% शोरयुक्त फ़ाइलें (JSDoc, टिप्पणियाँ)
केवल उच्च-एन्ट्रॉपी पंक्तियाँ (Shannon + Jaccard फ़िल्टरिंग)
task 65–85% कार्य-केंद्रित रीड (जैसे 'auth बग ठीक करें')
कार्य-प्रासंगिक कोड + ज्ञान ग्राफ़ + IB फ़िल्टर के माध्यम से निर्भरता संदर्भ
auto 70–99% डिफ़ॉल्ट - lean-ctx अपने-आप सबसे अच्छा मोड चुनता है
फ़ाइल के अनुसार: type, size bucket, recency, task relevance
reference 80–95% API docs और reference lookup
Public API, types, signatures, docstrings
lines:N-M 90–99% किसी line range को पढ़ें - surgical precision
मांगी गई exact lines + न्यूनतम आसपास का context
lean-ctx का ctx_smart_read फ़ाइल प्रकार, आकार और संदर्भ के आधार पर Bayesian पूर्वानुमान का उपयोग करके स्वचालित रूप से इष्टतम मोड चुनता है।
Advanced Compression Pipeline
Beyond mode selection, lean-ctx applies a multi-stage optimization pipeline that adapts to file type, session context, and task intent:
Learns optimal compression thresholds per file type using multi-armed bandit exploration (explore vs exploit)
Language-aware pruning via Tree-sitter - removes function bodies, comments, and boilerplate while preserving API signatures
Cross-file deduplication using inverse document frequency - eliminates content already seen in the session
Task-aware filtering using the Information Bottleneck principle - keeps only content relevant to the current task
Collapses repetitive structures (imports, log lines, boilerplate) into counted summaries
These stages are cumulative - applied in sequence, they can reduce a 1000-line file to under 50 tokens while preserving all task-relevant information. The pipeline is fully automatic and requires no configuration.
कम्प्रेशन गुणवत्ता
क्वालिटी थ्रेशहोल्ड (composite)
कम्प्रेस्ड आउटपुट तभी इस्तेमाल होता है जब composite क्वालिटी स्कोर ≥ 95% रहे।
न्यूनतम घनत्व
कम-जानकारी आउटपुट को न्यूनतम सिग्नल डेंसिटी 15% (ρ) पर ब्लॉक करता है।
वेटिंग
Composite = AST 50% + identifiers 30% + lines 20% - संरचना सबसे महत्वपूर्ण है।
कम टोकन = उच्च सिग्नल घनत्व
LLM का एक निश्चित अटेंशन बजट होता है। कॉन्टेक्स्ट विंडो में हर टोकन अटेंशन वेट के लिए प्रतिस्पर्धा करता है। विंडो को बॉयलरप्लेट से भरने का मतलब है कि महत्वपूर्ण कोड पर कम ध्यान।
मॉडल तक पहुँचने से पहले शोर को हटाकर, lean-ctx हर अनुरोध की सूचना घनत्व बढ़ाता है। परिणाम: उच्च सिग्नल-टू-नॉइज़ अनुपात, कम संदर्भ तनुकरण, और मॉडल उपयोगी संदर्भ सीमाओं के भीतर रहता है।
10K टोकन का केंद्रित संदर्भ 200K बॉयलरप्लेट से बेहतर प्रदर्शन करता है। मॉडल अपना ध्यान तर्क पर लगाता है, JSDoc टिप्पणियों और इम्पोर्ट बॉयलरप्लेट पर नहीं।
संदर्भ शोर मॉडल की अटेंशन विंडो को कमजोर करता है। इसे हटाने से मॉडल वास्तविक कोड संरचना पर केंद्रित रहता है और हैलुसिनेशन की संभावना कम होती है।
कम इनपुट टोकन का मतलब है कम API लागत और आपकी दर सीमा के भीतर अधिक संदेश। वही कोटा अधिक दूर तक जाता है - हर AI टूल के लिए जो आप उपयोग करते हैं।
Measured on Real Code
Representative snapshots - आपकी numbers फ़ाइल और codebase के हिसाब से बदलेंगे।
450 lines - map mode
12,840 → 1,541 820 lines - signatures mode
18,290 → 1,280 1,200 lines - aggressive mode
31,500 → 2,835 680 lines - entropy mode
15,400 → 2,618 340 lines - diff mode
8,750 → 437 Benchmark
Methodology
Every number on this page is reproducible. Here's exactly how we measure.
Tokenizer
All token counts use tiktoken with the o200k_base encoding — the same
tokenizer used by GPT-4o, Claude, and modern LLMs. No estimates or approximations.
Quality Threshold
Compressed output is only used if the composite quality score stays at or above 95%. Composite = AST preservation (50%) + identifier preservation (30%) + line coverage (20%).
Reproduce Locally
Run lean-ctx benchmark run src/ on your own codebase. The output shows exact token counts
for each compression mode, savings percentage, and quality preservation scores.
Disclaimer
Results vary by file type, size, language, and read mode. The "60-99%" range reflects real-world variance: small structured files compress more, large unstructured files compress less. Cached re-reads (~13 tokens) represent the best case.
अपनी मापें वास्तविक बचत।
lean-ctx इंस्टॉल करें और अपने कोडबेस पर benchmark run चलाएँ। वास्तविक संख्याएँ, आपकी फ़ाइलें, आपकी बचत।
lean-ctx benchmark run src/ Works on any codebase. No config needed. Results in seconds.