feat: add flag-gated TOON compression (~10-39% payload reduction) + validate on Ollama Cloud GLM-5#54
Merged
veerareddyvishal144 merged 6 commits intoFast-Editor:mainfrom Feb 19, 2026
Conversation
|
Thanks @Plaidmustache for this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds TOON-based prompt-context compression behind safe flags and validates behavior on Ollama Cloud (
glm-5:cloud).TOON project: https://github.com/toon-format/toon
What’s included
TOON_FAIL_OPEN=true)dbPathscope issue)Why
6416 -> 5854 bytes(~8.76%reduction), i.e. roughly 9–10%.Validation notes
Tested on:
MODEL_PROVIDER=ollamaOLLAMA_ENDPOINT=http://127.0.0.1:11434OLLAMA_MODEL=glm-5:cloudObserved:
ollamaWhy TOON (external benchmark context)
From the TOON project’s published benchmarks:
TOON benchmark snapshot (from TOON docs)
Efficiency score formula: (Accuracy % ÷ Tokens) × 1,000 (higher is better).
Key takeaway from TOON docs: TOON reached 73.9% accuracy vs JSON’s 69.7% while using ~39.6% fewer tokens.
[N]row counts and{fields}headers) are intended to improve schema-following reliability.Practical caveats (also from TOON docs):
References:
Safety
TOON_ENABLED=false