π Caveman v1.0.3
Caveman is an ultra-lightweight, fully self-contained .NET library designed to optimize text for Large Language Models (LLMs), drastically reducing token consumption and associated costs while preserving the semantic integrity of the message.
β¨ What's New and Key Features (v1.0.3) - June 2026
- Up to 70% token reduction: Cut API costs across LLM channels and speed up local inference by reducing prompt length.
- Fully Self-Contained Engine: No external NLP models and no runtime dependency on Catalyst. The only package dependency (purely optional and intended for plugins) is
Microsoft.SemanticKernel. - Ultra-Compact Format (~13 MB): Language data is compiled into Brotli artifacts (
*.yaml.br) with a compact detection index (_index.br). The assembly now weighs just ~13 MB compared to the old ~68 MB of raw data. - High-Performance Custom Parser: The runtime dependency on YamlDotNet has been completely removed and replaced with a proprietary streaming word-data parser.
- Over 50 Languages with Full Vocabulary: Lemmas, verb forms and a proper-noun dictionary (gazetteer) derived directly from the Universal Dependencies project.
- Proper Noun Preservation: Proper nouns (e.g. Rome, Milan, MΓΌnchen, Termini) are recognized and kept unchanged (verbatim) instead of being incorrectly compressed or turned into common words. This feature is active at the start of a sentence, mid-text, and even in German.
- Standalone Language Detection: Introduces
CavemanLanguageDetector, usable in standalone mode without needing to compress text, capable of analyzing input and returning ISO 639-3 codes even for very short texts (one or two words). - True Async Support: The
CompressAsyncandCompressBatchAsyncmethods no longer use fake-async mechanisms; cancellation and failed tasks are now correctly propagated at the system level.
π οΈ Installation
Due to the modular architecture, the main NLP compression library must be installed separately from other modules (such as the Privacy Guard module):
Bash
π License & Transparency: Released under the Caveman License (MIT + mandatory attribution clause). Any commercial or private use must explicitly mention the use of Caveman developed by Passaro Francesco Paolo β Digitalsolutions.it.
β‘ Quick Start
C#
πΏ Sustainability: Why it matters
Every token generated or processed by an LLM has an environmental cost. Caveman introduces a built-in estimator based on industry averages:
- Energy consumption: Estimated at 5 mWh per token.
- Carbon footprint: Estimated at 0.4 mg of COβ per mWh.
By compressing a prompt from 1000 to 400 tokens, about 3 mWh of energy is saved. At the scale of millions of requests, Caveman contributes tangibly to building a sustainable AI ecosystem.
π NLP compression levels (Updated v1.0.3)
| Level | Applied logic | Proper Noun & Verb Handling | Average Savings |
| Light | Removal of traditional stopwords. | Known capitalized tokens preserved. | ~25β30% |
| Semantic | Selection of key content (Nouns, Verbs, Adjectives, Adverbs). | Keeps proper nouns verbatim. | ~50% |
| Aggressive | Total lemmatization and verb-driven compression. | Every conjugated form collapses to the base verb; nouns remain intact. | ~70% |
π Technical Infrastructure Detail (Universal Dependencies)
The old Catalyst mapping tags have been replaced by the native Universal Dependencies dictionary. During compression:
- The system reads an ultra-compact index (
_index.br) to determine the language. - Decompresses on the fly and caches only the data relating to the detected language.
- Applies verb-driven compression and screens out noisy lemmas or false positives on proper nouns.
π‘ Transformation Example
| State | Prompt text | Tokens / Characters |
| Original | "I would like to know if it is possible to have a margherita pizza immediately." | 100% (78 ch) |
| Light | "like know possible have margherita pizza immediately" | ~70% (54 ch) |
| Semantic | "know possible have margherita pizza immediately" | ~55% (48 ch) |
| Aggressive | "know possible have margherita pizza" (Proper nouns like Margherita or Roma are not altered) | ~40% (38 ch) |
π‘ Native Integration: Caveman.Wiki
Purpose
Automatically generate AI-optimized Markdown documentation for any software project, leveraging Caveman v1.0.3's new ultra-compact engine to semantically compress content and maximize the LLM prompt context window.
How it works
- Project analysis: Automatically detects the project type (.csproj, requirements.txt, package.json).
- Intelligent scanning: Excludes binary files, build folders and external dependency folders.
- Code and Text Compression: For files larger than 2KB, it invokes the new
CavemanCompressionService(Semantic or Aggressive level) leveraging fast single-language cache loading. - Clean Output: Returns a complete Markdown file with YAML metadata, tree view and syntax highlighting.
Usage example with the new engine
C#
π€ Contributing
Pull requests are welcome! For major changes to the Universal Dependencies-based compression architecture or the streaming parser, please open a discussion issue first.