Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 SummarySummaryPreserve multiple Hugging Face
Architecture impact
HUMAN REVIEW REQUIRED: Review the incompatible bundle format, native runtime boundary, downstream consumers, and reported community CI failure. WalkthroughChangesThe Llama configuration now normalizes scalar and list EOS values into tuples. The runtime passes all EOS IDs to TensorRT and rejects empty lists. Tests cover fallback and override behavior. A MiniCPM5-2B manifest was added, and its profile was excluded from release performance. Llama EOS support
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant ModelConfig
participant LlamaModel
participant RuntimePlugin
participant TensorRT
ModelConfig->>LlamaModel: normalized eos_token_ids
LlamaModel->>RuntimePlugin: eos_token_id list
RuntimePlugin->>TensorRT: id_eos_ids
Merge Risk: ⚪ Minimal · up to No actionable correctness or integration risk remains; the Llama EOS-list changes are ready for normal checks. 🚥 Pre-merge checks | ✅ 7 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (7 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 5 files. (1 skipped: 1 unsupported.) Full details: Shared Semantic NeutralityExplanation The pull request changes one non-exempt shared file: Resolution Remove the direct Comment |
fd7910a to
22472c0
Compare
|
Hi @roma5087 thanks for contributing. It looks like the community CI is failing. Please fix the community CI first and I can help you to trigger the internal CI next! |
HF configs may declare eos_token_id as a list of stop tokens (Llama 3.1+, MiniCPM5). The llama family kept only the first id, which breaks stopping for Llama 3.1-Instruct since its real per-turn stop token is the *last* id in the list, not the first. Also exclude the new minicpm5-2b benchmark manifest from the release performance suite (functional/e2e qualification is present, but no matching release-performance workload or receipt exists yet). Signed-off-by: Matthew Romano <matthewromano5087@gmail.com>
22472c0 to
f1eacc2
Compare
|
Closing this in favor of #1288, which landed while I was working through this — same bug (openbmb/MiniCPM5-2B's list-valued eos_token_id). It's additive (eos_token_ids only written when there's more than one id, so single-EOS bundles are untouched) rather than an unconditional breaking wire-format change like this PR's approach, and it adds vocab-bounds validation and explicit boolean rejection that this PR didn't have. Followed qwen3_8/model.py's existing precedent for the normalize pattern too. |
Background
HF
config.json/generation_config.jsonmay declareeos_token_idas eithera single id or a list of stop-token ids (all Llama 3.1+ checkpoints, and
openbmb/MiniCPM5-2B, whose config haseos_token_id: [1, 130073]). Thefamilies/llamabuild path only ever kept a single scalarModelConfig.eos_token_id, so a multi-id checkpoint was silently truncated toits first id when writing
runtime.json, and the C++ runtime loader(
families/llama/runtime/plugin.cpp) would reject a list value outright,crashing bundle load with
llama runtime.json has invalid 'eos_token_id'.Truncating to the first id (an earlier version of this fix did that) is also
semantically wrong for the flagship case: Llama 3.1-Instruct's real per-turn
stop token (
<|eot_id|>) is the last id in its list, not the first, so thatapproach would silently break generation stopping instead of crashing.
No originating issue is linked — per
CONTRIBUTING.md, an issue is expectedbefore investing in a large/cross-cutting/design-unclear change; this is
scoped to one family with a clear, already-validated approach, so no issue was
opened first.
Exit Criteria
eos_token_idbuilds and its bundle loadsand runs without crashing.
just the first.
eos_token_idcheckpoints continue to build and rununchanged (aside from the wire-format wrapping described below).
bos_token_id/pad_token_idmissing-vs-zero bug (see Notes), and does not fix an unrelated,
pre-existing TinyLlama generation bug discovered during regression testing
(see Notes) — both are intentionally out of scope.
Implementation
Preserve the full
eos_token_idlist end-to-end instead of collapsing it toone id:
families/llama/config.py: addModelConfig.eos_token_ids: tuple[int, ...]and a shared
_as_id_list()helper that normalizes a missing value, ascalar, or a list into a tuple, checking for
Noneexplicitly (nottruthiness), so a legitimate id of
0survives.families/llama/model.py:runtime.json's"eos_token_id"is now alwaysemitted as a JSON array, for both the
config.json-derived path and thegeneration_config.jsonoverride path (the override path previously had noempty-list fallback at all; it now falls back to
[-1]).families/llama/runtime/plugin.cpp:RuntimeConfig::eos_token_id(scalar)becomes
eos_token_ids(vector<int32_t>), parsed as a JSON array with anexplicit empty-vector guard, and wired into
LlamaTextGenConfig::id_eos_ids— the pipeline's existing multi-stop-tokenmechanism (
pipeline.cpp'snormalize_eos_token_ids,sampler.cpp'sis_stop_token/build_sampling_params), which already existed and wasalready unit-tested, but was never being fed more than one id.
Affected:
families/llamaonly (build path + native runtime plugin). Noother family is touched.
Bundle/artifact format change:
runtime.json'seos_token_idfieldchanges from sometimes-scalar to always-array. This is a breaking change to
the bundle wire format (see Notes for details) — no public API or ABI change.
Change categories
Validation
Commands and Results
Regression check (not an automated test, manual verification): rebuilt
tinyllama-1.1b(plain scalareos_token_id: 2) with this fix, confirmedruntime.jsoncorrectly contains"eos_token_id":[2]and the native runtimeloads and runs it without error (see Notes for a separate, pre-existing,
unrelated generation-quality issue found while doing this check).
Hardware, Environment, and Revisions
upstream/main(fast-forward, zerodivergent commits at time of testing)
mode, CUDA 13.3 userspace)
nvcr.io/nvidia/tensorrt:26.07-py3torch==2.12.0+cu130(matchesDockerfile.dev.x86-gpu, the community GPU CI environment)openbmb/MiniCPM5-2B(main),TinyLlama/TinyLlama-1.1B-Chat-v1.0(main) — both unpinned/latest at time of testing
Not Run / Remaining Gaps
requires license acceptance). Validated the mechanism generically (full
id-list preservation, confirmed against a public mirror's
config.json/generation_config.jsonshape for Llama-3.1-8B-Instruct) and validatedend-to-end against MiniCPM5-2B's real multi-id config instead.
falcon3-1b,minitron-4b-*,nemotron-nano-4b) were not re-run against real checkpoints in thissession; their code path is unchanged in kind (just array-wrapped), so
risk is believed low but this is unverified.
tensor_parallel_size > 1) and dual-profile/dynamic-KVengine layouts were not separately exercised for the multi-id case (only
the default "split" layout was tested);
eos_token_idparsing happens oncein
parse_runtime_configbefore any layout-specific logic, so this isbelieved layout-independent but not explicitly run.
Contributor Self-Review
Additionally, two independent rounds of focused review (correctness, test
coverage, contribution readiness) were performed; all findings from the
first round were addressed and re-verified in the second.
Notes For Future Readers
runtime.json'seos_token_idfield changes fromsometimes-scalar to always-array. A bundle built with the pre-change llama
plugin cannot be loaded by the post-change runtime, and vice versa (strict
field parsing rejects the wrong shape). No migration path or version field
is added: llama bundles are build-and-consume artifacts produced and
immediately consumed by matching family code, not persisted or distributed
release artifacts, and the repository has no existing convention for
versioning a family section's internal field shapes. Anyone holding an
existing llama bundle must rebuild it against this commit.
bos_token_id(andpad_token_id)have the same missing-vs-zero bug the pre-fix
eos_token_idhad(
d.get(field, -1) or -1maps a legitimate0to-1). Confirmed againstMiniCPM5-2B's real config (
bos_token_id: 0). Left untouched here to keepthis PR single-purpose.
single-EOS case, found that the existing
tinyllama-1.1b.jsone2e casefails against unmodified
upstream/main— the native engine's first decodestep predicts EOS immediately for a simple prompt, producing empty output,
versus a correct HF reference ("Capital: Paris"). Reproduced identically
against the unmodified upstream
config.py/model.py/plugin.cpp,confirming this pre-dates this branch and is unrelated to
eos_token_idhandling (this PR's diff never touches chat-template detection/rendering
code). Suspected root cause:
chat_templates.cpp's format-detectionheuristic substring-matches on
<|user|>/<|assistant|>tags andmisclassifies TinyLlama's template as "Phi" format, injecting the wrong
turn-separator token. Filing as a separate issue.
config.py→model.py→plugin.cpp→ tests.Risk level
Risk rationale: the bundle wire-format change is breaking but confined to an
internal build-and-consume artifact, not a persisted/distributed one; the
stop-token matching behavior change affects every llama-family model (not
just multi-EOS ones, since the field is now always array-wrapped), validated
broadly (16 unit/GPU tests + 1 real e2e correctness-oracle run) but not
against every existing llama manifest.