π Caveman v1.0.3
Caveman is an ultralight and 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: Reduce LLM channel API costs and accelerate local inference by shortening prompt lengths.
- 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 only ~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 by a proprietary streaming word data parser.
- Over 50 Languages with Complete Vocabulary: Lemmas, verb forms, and a proper noun dictionary (gazetteer) derived directly from the Universal Dependencies project.
- Proper Noun Preservation: Proper nouns (e.g., Roma, Milano, MΓΌnchen, Termini) are recognized and kept unchanged (verbatim) instead of being erroneously compressed or transformed into common words. This feature is active at the beginning of sentences, 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 Asynchronous Support: The
CompressAsyncandCompressBatchAsyncmethods no longer use fake-async mechanisms; cancellation and failed tasks are now correctly propagated at the system level.
π οΈ Installation
Due to its 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 an integrated 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, approximately 3 mWh of energy are saved. On the scale of millions of requests, Caveman tangibly contributes 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 | Key content selection (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 Details (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 understand the language. - It decompresses on the fly and caches only the data related to the detected language.
- It applies verb-driven compression and screens noisy lemmas or false positives for 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 project type (.csproj, requirements.txt, package.json).
- Smart 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), utilizing 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 compression architecture based on Universal Dependencies or the streaming parser, please open a discussion issue first.