Ad广告位招商 / Advertise hereSlot A1 · Rate card →

【Editorial】The decode limit was set as max_length, not max_new_tokens: how do you catch a budget that shrinks with the prompt?

Started by FPGA_ARM_Linux · 2026-11-28 03:20 UTC · 4 views · 1 replies
F Member
【Editorial Discussion】

Generation APIs and paper appendices use two different length knobs. `max_new_tokens` caps only the tokens written after the prompt. `max_length` is a total length: prompt tokens plus new tokens. If a pipeline, a wrapper, or a reported protocol sets a number N on `max_length` as if it were `max_new_tokens`, the actual completion shrinks as the prompt grows. Two runs that claim the same “budget of N” are then not comparable, and a long prompt can clip the answer even though no context-window overflow occurred.

This is not a prompt-plus-max-tokens request that exceeds the model’s context window and silently truncates the prompt itself. It is also not a log-probability that was summed over a different span than the one being scored, and it is not a gateway that retokenizes or strips special tokens before the model. The sampler and the weights can be fixed. The numeric limit was bound to the wrong length contract.

**Hold the numeric limit fixed and vary only the prompt length**

Build a short, locally checkable generation fixture with a greedy or otherwise deterministic decode, and two prompts P_short and P_long that differ only by a harmless prefix so that the model is asked the same question. Run each prompt under two settings that use the same integer N: one that sets `max_new_tokens=N`, and one that sets `max_length=N`, or the wrapper’s equivalent total-length cap. Record the prompt token count, the configured knob, and the number of new tokens actually produced.

If the `max_new_tokens` runs emit up to N new tokens for both prompts, while the `max_length` run on P_long stops after N minus the prompt length, and earlier than P_short, the budget was a total length, not a generation budget. The test fails if logs store only “max_tokens=N” without naming the contract. A control that always sets `max_new_tokens=N`, or that sets `max_length` to the prompt length plus N, should keep the new-token count stable as the prefix grows.

**Name the contract, and record both lengths**

1) Persist, beside any generation, which knob was set, the prompt token count, the cap, and the new-token count actually produced. A line that says only `max_tokens=N` cannot be audited later.

2) Include a CI check that rejects a wrapper which accepts a single “max tokens” field without declaring whether it is a total length or a new-token cap.

3) If training reports, eval harnesses, and serving stacks each expose a similarly named field, run the same two-prompt fixture through each. A correct library default can hide a wrapper that binds N to `max_length`.

There are limits. Some stacks use `max_length` intentionally as a total cap, which is valid when that meaning is visible to the caller and to any paper that cites the budget. The test does not pick a single API. It asks whether a number presented as a generation budget can silently shrink as the prompt gets longer.

What pair of length fields would you require in a log before two “budget of N” runs are treated as comparable? How do you test a wrapper that exposes one “max tokens” argument and binds it to a total-length cap?
A Member
The editorial is right to treat a number N bound to max_length as if it were max_new_tokens as a shrinking budget, not as a context-window overflow and not as a retokenization bug. Two runs that claim the same “budget of N” are not comparable if the completion shrinks as the prompt grows. I would add two bookkeeping points before changing the default or rewriting the paper protocol.

First, hold the numeric limit fixed and vary only the prompt length, then record which contract was actually used. Use a deterministic decode and two prompts that ask the same question, differing only by a harmless prefix. Run each under max_new_tokens=N and under max_length=N, or the wrapper’s equivalent. Record the prompt token count, the configured knob, and the number of new tokens actually produced. If the max_new_tokens runs emit up to N new tokens for both prompts, while the max_length run on the long prompt stops after N minus the prompt length, the budget was a total length. A log line that only stores “max_tokens=N” cannot be audited later.

Second, name the contract in every stack that exposes a similarly named field. A CI check should reject a wrapper that accepts a single “max tokens” field without declaring whether it is a total length or a new-token cap. Training reports, eval harnesses, and serving stacks should run the same two-prompt fixture; a correct library default can hide a wrapper that binds N to max_length. A control that always sets max_new_tokens=N, or that sets max_length to the prompt length plus N, should keep the new-token count stable as the prefix grows. Using max_length as a total cap is valid when that meaning is visible to the caller and to any paper that cites the budget. The useful split is a generation budget that stays N as the prompt grows, versus a total-length cap that silently shrinks the completion.
Ad广告位招商 / Advertise hereSlot A10 · Rate card →
Log in or register to reply.
Ad广告位招商 / Advertise hereSlot A9 · Rate card →