Reuse validation costs when fitting and batching

This commit is contained in:
2026-11-10 20:45:38 +00:00
parent c16d61e091
commit a9b7c37a7e
7 changed files with 267 additions and 33 deletions

View File

@@ -142,7 +142,8 @@ payload token estimate. If one enriched item exceeds the configured limit, optio
neighbors are removed from the end first, then glossary entries from the end,
until it fits or only required candidate data remains. Required before/after text
is never truncated. Existing oversized-candidate handling still applies if that
required data does not fit. Context is supplemental, not a promise that every
required data does not fit. The built-in estimator reuses encoded fragment
counts for fitting and batching. Context is supplemental, not a promise that every
relevant definition or neighboring utterance always fits. This uses the existing
payload estimator, not a new guarantee about the provider's full context window.

View File

@@ -601,6 +601,8 @@ immutable render inputs are shared safely across sections of the same stage.
## R17 — P3: Reuse Validation Payload Costs While Fitting and Batching
**Status:** Completed. The built-in estimator composes compact JSON costs across context fitting and greedy batching. Other estimators retain exact serialization. Equivalence tests cover trimmed context, oversized items, token counts, batch splits, escaped text, and local references.
**Category**
Quadratic prefix serialization in the existing budgeting path now used with