QVAC-24114 fix: fail the load when the model cannot decode - #4039
Draft
simon-iribarren wants to merge 1 commit into
Draft
QVAC-24114 fix: fail the load when the model cannot decode#4039simon-iribarren wants to merge 1 commit into
simon-iribarren wants to merge 1 commit into
Conversation
Contributor
License compliance — cleanNo new dependency license findings in this PR. Warn-only (shadow) mode — this check does not block merges yet. Updated automatically by the canonical license compliance workflow. NOTICE presence (advisory)Missing NOTICE (advisory, does not block):
|
A model can survive init and still be unable to decode: on a 24 GiB M4 Pro, Gemma 4 31B Q4_K_M at ctx 1024 loads (Metal over-commits past recommendedMaxWorkingSetSize) and then every decode fails with 'failed to decode next token'. Fabric's warmup would not catch it — common_init_from_params discards the warmup decode status — and LoadFitNormalization disables warmup anyway. Run one strict BOS/EOS probe decode after context creation and throw UnableToLoadModel on failure, leaving no KV trace. A successful probe doubles as a warmup. Skipped for finetuning, which never serves inference from this context.
simon-iribarren
force-pushed
the
fix/qvac-24114-probe-decode
branch
from
August 26, 2026 09:55
bbd0380 to
7fe18b3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 What problem does this PR solve?
loadModelreturning a model id does not mean the model can run. Measured on a 24 GiB M4 Pro with Gemma 4 31B Q4_K_M (18.25 GiB):ctx_size 1024, gpu_layers 99: loads in 25 s (Metal over-commits pastrecommendedMaxWorkingSetSize), then the first completion fails with[TextLlm] failed to decode next token, and every later request fails withevalMessageWithTools: failed to decode input tokens.ctx_size 1024, gpu_layers 48: same — loads, cannot decode.device 'cpu': decodes (0.1 tok/s), so the GGUF is fine; this is a memory-placement failure surfacing at the worst possible time, on the first user request, with no way for the app to tell a usable load from a dead one.Two existing layers fail to catch it: fabric's
common_init_from_paramswarmup discards the warmup decode status, andLoadFitNormalizationdisables warmup outright (params.warmup = false).This is also the necessary complement to projection-based fitting (QVAC-24112 / tetherto/qvac-fabric-llm.cpp#214): macOS memory pressure is bistable, so a configuration can pass every static budget and still die at decode. Only an actual decode proves usability.
📝 How does it solve it?
After context creation in
LlamaModel, run one strict BOS/EOS probe decode (mirroring fabric's warmup shape, encoder models included) and check its status:UnableToLoadModelStatusError; no model id is handed out.No API change; the SDK surfaces the load error through the existing path.
🧪 How was it tested?
bare-makeon macOS arm64.mainfails identically beforeinitFromConfig, so the published-prebuild control confirms the harness and isolates the local build as the variable.ctx_size 1024, gpu_layers 99on a 24 GiB Apple silicon machine →load()must reject; Qwen3.5 0.8B/9B and gpt-oss-20B fixtures must keep loading (plus one warmup decode).