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?
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?