fix(sampling): preset fallback (not greedy 0) when generation_config absent — #228 review guard#267
fix(sampling): preset fallback (not greedy 0) when generation_config absent — #228 review guard#267rsafier wants to merge 1 commit into
Conversation
[BETA] Automated PR review — SeedSource AI pipelineAdvisory only, not a merge gate. AI-generated (internal risk-triage, Atlas serve gate, GLM-5.2 review), attributed per Atlas convention. Triage
Serve gate
GLM-5.2 code reviewCorrectness: Logic is sound. Field-by-field fallback via Risk: Low. The change replaces hard-coded fallbacks (0.6/20/0.95) with preset values. If Quality: Clean extraction into Pipeline: build+serve on GB10, GLM-5.2 via NVIDIA NIM, internal risk-triage classifier. External diff treated as untrusted input. Public repo. |
ac6bb1c to
b22b2e9
Compare
…eration_config absent Addresses the #228 review (SeedSource/GLM-5.2): the generation_config.json sampling-defaults feature shipped, but its absent/unparseable-config fallback used hard-coded constants (0.6/20/0.95) that duplicate — and can drift from — the model's curated MODEL.toml preset. The review flagged the risk that a missing/malformed config could leave defaults at a silent greedy 0. Guard: source the per-field fallback from the same `[sampling.non_thinking]` preset that already drives the penalties, so there is a single source of truth and the defaults are provably non-degenerate. A config that is *present* and legitimately requests `temperature=0` is still honored — the guard only backfills absent fields. - runtime.rs: split the field resolution into a pure, testable `resolve_sampling_defaults(Option<&Value>, &SamplingCategory, ..)`; `load_sampling_defaults` now takes the preset and warns when the config is absent. - serve.rs: pass `&sampling_presets.non_thinking` (Copy, still available downstream). - Regression tests: missing config → preset (non-greedy); present config overrides; partial config falls back per-field; present temperature=0 is honored. fmt + clippy -D warnings + spark-server tests (569) all pass.
b22b2e9 to
f02716f
Compare
Adds the guard requested in the #228 review, on top of current
main.Background
The generation_config.json sampling-defaults feature from #228 was absorbed into
mainduring the #229 merge (sampling_setup.rs/completions.rsnow default temp/top_k/top_p fromstate.default_*). What did not land is the guard the SeedSource/GLM-5.2 review made a merge condition:Main's
load_sampling_defaultscurrently avoids literal greedy (it falls back to hard-coded0.6/20/0.95), but those magic constants duplicate the model's curatedMODEL.tomlpreset and can silently drift from it — so the fallback is safe-by-accident, not by construction, and there was no test locking it in.The guard
Source the per-field fallback from the same
[sampling.non_thinking]preset that already drives the penalties. Single source of truth; the defaults are provably non-degenerate for any well-formed MODEL.toml. Behavior whengeneration_config.jsonis present (every shipped Holo/Qwen model) is unchanged — a present config that legitimately requeststemperature=0is still honored; the guard only backfills absent fields.runtime.rs: field resolution split into a pure, testableresolve_sampling_defaults(Option<&Value>, &SamplingCategory, top_n_sigma, min_p);load_sampling_defaultsnow takes the preset andwarn!s when the config is absent/unparseable.serve.rs: pass&sampling_presets.non_thinking(SamplingPresetsisCopy, still used downstream).Review items closed
temperature=0honored.Validation
cargo fmt -p spark-server --checkclean.cargo clippy -p spark-server -- -D warningsclean.cargo test -p spark-server --bin spark→ 569 passed, 0 failed (incl. the 4 new).Delivers the guard #228 asked for; #228's own branch predates #229 and is closed as absorbed. Signed commit.