﻿# What should an inference engine validate when its output grammar grows midstream?

GramDelta explores append-only grammar changes during generation. Compare the next-token mask with full reconstruction before drawing performance conclusions.

Author: Retrivium editorial team
Updated: 2026-11-26
Canonical URL: https://retrivium.ai/journal/daily-20261126-compute-gramdelta-append-only-schema-update/
Language: en

The GramDelta preprint studies constrained generation when rules are added after some output is committed. It keeps parser state for the existing prefix and propagates changes from added rules through prior dependencies. The authors compare that approach with reconstructing the parser under the larger grammar. This is research evidence about a particular class of updates. Existing structured output support alone does not identify which engine implements it.

## Keep the update contract explicit

An append-only update adds rules. It is different from removing an option or replacing a type after a token has already been sent. Imagine a report generator that discovers another allowed declaration while it writes a formal description. The existing prefix can constrain what the new declaration means. A quick update cannot simply replace the next-token mask without accounting for that history.

## Use reconstruction as the correctness reference

Replay the committed prefix from the start with the updated grammar. Compare the entire allowed next-token set with the incrementally updated state. Check a rule that cannot affect the current prefix and one that changes which continuation is valid. A visually plausible output can miss some valid tokens or allow an invalid continuation. The full mask catches those cases before the final text happens to reveal them.

## Measure the first unseen update

Use inputs with the same initial grammar and similar prefix length. Vary how much parser history the new rule affects. Record the latency of the first unseen update and the added cost of later tokens independently. Repeating a previously cached grammar measures a different path. The paper reports improvements for tested configurations and does not establish a universal speedup on other engines.

## Keep unsupported operations visible

If an application must remove a rule or invalidate earlier output, define how it restarts or reports an error. Verify that its switch to reconstruction is observable. Accept the optimization only when the tested updates preserve grammar behavior and improve the latency budget that motivated the change.

Retain a fixture in which the added rule has broad consequences. That is the case most likely to expose the trade-off between the optimization and the reconstruction path under heavy update traffic.

## Sources

- [GramDelta preprint](https://arxiv.org/abs/2611.32807)
- [vLLM structured output documentation](https://docs.vllm.ai/en/latest/features/structured_outputs/)

## Related reading

- [A GPU inference benchmark you can trust](/journal/inference-benchmark-method/)
- [Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/)
