Summarizer word target (max_tokens × 0.75) has no headroom; summaries silently truncate on dense content
Summary
create_short_summary / create_long_summary (src/utils/summarizer.py) ask the model for max_tokens * 0.75 words and then cap the call at max_tokens tokens. That assumes ~0.75 words per token with zero margin. On content that tokenizes more densely than plain English prose, a model that follows the word instruction runs out of tokens first. The call ends finish_reason=length, and the cut-off text is stored as the summary with no warning.
Refs are against 0db5b817.
Where
# create_short_summary, summarizer.py:213
output_words = int(min(input_tokens, settings.SUMMARY.MAX_TOKENS_SHORT) * 0.75)
...
max_tokens=settings.SUMMARY.MAX_TOKENS_SHORT,
# create_long_summary, summarizer.py:251
output_words = int(settings.SUMMARY.MAX_TOKENS_LONG * 0.75)
...
max_tokens=settings.SUMMARY.MAX_TOKENS_LONG,The post-call check (around summarizer.py:632) only catches an empty summary. response.finish_reasons is logged on that branch but is not checked otherwise, so a non-empty truncated summary is saved silently.
Measured
Conversations with a lot of code identifiers, file paths and markdown came out at ~0.52 words/token on the summaries the models produced (OpenAI-compatible endpoint, json_object structured output mode). At the defaults:
| path | words requested | tokens allowed | tokens needed at 0.52 w/t |
|---|---|---|---|
| short | 750 | 1000 | ~1440 |
| long | 3000 | 4000 | ~5770 |
I replayed 8 real summary prompts (4 short, 4 long) against 3 models:
- Short: truncated in 11/12 model × prompt runs, every time at about 480–600 words, i.e. about 65–80% of the requested length. All three models tried to meet the limit; none could fit it.
- Long: depends on the model. Some stop on their own well under 3000 words; others try to hit the limit and are truncated.
Summaries are written in time order, so what gets cut is the most recent part of the conversation — the part a summary most needs to keep.
Raising the budget doesn't work around it. SUMMARY_MAX_TOKENS_SHORT / _LONG feed both the word target and the cap, so the ratio stays the same and the model just aims longer.
Reasoning models make it worse, because reasoning tokens count against the same cap (a separate, known issue). The truncation above happens with reasoning effectively off, though. It's the word:token ratio alone.
Possible fixes (any one would help)
- Give the cap headroom over the word target, e.g.
max_tokens = int(output_words * 2), or a separate setting, so a model that follows the instruction doesn't hit the cap. - Make the ratio configurable (e.g.
SUMMARY_WORDS_PER_TOKEN, default 0.75). - At minimum, log a warning when
"length" in response.finish_reasons, so truncated summaries show up somewhere.
Happy to open a PR for whichever you prefer.
Source: plastic-labs/honcho