Optimization Strategies
Trunkate AI works out of the box, but understanding how to craft your inputs can maximize your token savings.
The Semantic Core
“Be descriptive about the task, not the pleasantries.”
Trunkate is designed to remove conversational language. If you write your prompts like you are talking to a human, Trunkate will yield massive savings. If you already write highly structured, robotic prompts, the savings will be lower.
Example: Before and After
Raw Input
“Please, if you don’t mind, could you write a Python script for me that uses the BeautifulSoup library to scrape product prices from amazon.com? Thank you so much, I really appreciate it.”
Trunkate Output
“Write Python script using BeautifulSoup to scrape prices from amazon.com.”
Utilizing Budgets
The budget parameter in the SDK controls how aggressively Trunkate will prune your text.
High Budget (Conservative)
- Use Case: Creative writing tasks, roleplaying, or nuanced analysis.
- Behavior: Trunkate will only apply Static Rewrites and remove obvious filler words. It will not attempt to alter the grammatical structure heavily.
Low Budget (Aggressive)
- Use Case: Code generation, data extraction, API routing.
- Behavior: Trunkate will employ Structure Encoding, collapsing sentences into Key-Value pairs and aggressively pruning context that the target LLM already knows from its pretraining data.
Best Practices
- Test in the Playground: Always run your core system prompts through the Playground first to see how Trunkate interprets them.
- Protect Variables: Trunkate natively respects JSON blocks and Markdown code-fences. It will deliberately avoid optimizing text inside code blocks to prevent breaking programmatic functionality.