Repository navigation
fix(npu): default 32k context on NPU profile, resolving the 4096↔32768 mismatch - #1747
Conversation
…8 mismatch The NPU profile pinned a 4096-token context at three sites while the runtime load path requested 32768, so `gaia init --profile npu` reported 4096 but GAIA loaded the model at 32k — a config/runtime mismatch (#1676). NPU now defaults to 32768 to match GPU/CPU. The E2B/FLM build is confirmed loading at 32k on a Ryzen AI 7 350 / 16 GB; cold-NPU validation pending. Closes #1745
|
@claude perform a deep code review of this PR, make sure this is documented. |
SummaryThis is a clean, well-scoped fix that aligns the NPU profile's context window to 32768 everywhere, so The change correctly avoids touching the generic Issues Found🟡 Cold-NPU load is the real merge gate, not the Python tests — The unit tests only confirm the constants moved together; they can't prove FLM serves a 32k window on a cold NPU. This is exactly the failure mode the original 🟢 Eval note (informational) — This touches a model ctx-load path, which normally triggers the "run agent evals" rule. It's not actionable here: the committed baselines are the GPU GGUF Strengths
VerdictApprove with suggestions — The code is correct, scope-clean, and well-tested at the unit level. There are no blocking code defects. The one true gate is the cold-NPU hardware validation the author already flagged; that checkbox must be ticked (against a cold start, not a warm cache) before merge. |
|
Deep review: the code is correct and complete, the change is self-documenting in code/tests, but there's no user-facing doc — and that's the one gap worth closing before merge. I traced the mismatch end-to-end and it confirms the PR's premise (with a bonus finding below). The only blocking gate remains the cold-NPU hardware load the author and the first review already flagged. Code correctness — ✅ consistent and completeAll paths that encode the NPU window now agree at 32768:
I grepped for stragglers: the remaining 4096s are correct to leave — the generic Bonus finding — this is more than a cosmetic report fixThe runtime 32768 wasn't arbitrary: the chat preflight Scope note — 🟢This Documentation — 🟡 the actual gapThe change is well-documented in code comments and tests, but no doc file is touched and
Merge gate — 🔴 unchangedThe cold-NPU 32k FLM load is the real gate, and it's now a louder one: Net: approve the code, please add the two doc lines, and hold merge on the cold-NPU check. |
|
Verdict: Approve This flips the NPU/FLM context window from 4096 to 32768 across the three places it was pinned (the model requirement, the device config, and the One leftover: a comment elsewhere in the codebase still claims "NPU's FLM build runs at 4K," which now contradicts this change — worth a one-line fix so the doc trail stays consistent. Non-blocking. 🔍 Technical details🟢 MinorStale "runs at 4K" comment missed by the sweep ( The PR updated the comments at the three flipped sites but this one still documents the old window, now contradicting the new 32768 default: That's the only lingering Strengths
|
Before:
gaia init --profile npureported a 4096-token context window, but at runtime GAIA loaded the FLM chat model atctx_size=32768— a config/runtime mismatch (#1676) that left the init report lying about the window actually in use. After: the NPU profile defaults to 32768 everywhere, matching GPU/CPU, so what init reports is what the loader requests.The fix flips the three pinned-4096 sites — the
gemma-4-e2bmodel requirement, the NPUDeviceConfig, and the npu init profile — to 32768, and updates the comments/tests that documented the old 4096 NPU window.Closes #1745
Validated on NPU hardware — Ryzen AI MAX+ 395 (cold start)
The risk flagged in the issue (the #1655 lesson) was that flipping the window blind could OOM/fail an FLM load on a cold NPU. It does not — verified end-to-end against Lemonade serving the FLM build on a Ryzen AI MAX+ 395:
POST /api/v1/load {model_name: gemma4-it-e2b-FLM, ctx_size: 32768}→{"status":"success"}, HTTP 200, 11.4 s, no OOM. Health then reportsdevice: npu,recipe_options.ctx_size: 32768— the 32k window is really allocated, not silently clamped to 4096.finish_reason: stop), at 22.85 tok/s decode — in line with the documented ~24 tok/s NPU figure. (KV occupancy 0.137 % at 45 tokens ⇒ total ≈ 32,775 ≈ 32768, independently corroborating the window.)gaia init --profile npureports 32768. Run from this branch on the box, it prints✓ Context size verified: 32768 tokensandgemma4-it-e2b-FLM - OK (ctx: 32768)(exit 0) — the old4096is gone.Test plan
python -m pyteston the 4 affected unit files — 69 passedpython util/lint.py— black + flake8 clean (E501 ignored by repo config); CI Run Code Quality Checks greengaia init --profile npureports32768(not 4096) — verified on a Ryzen AI MAX+ 395gemma4-it-e2b-FLM) loads atctx_size=32768on a Ryzen AI APU from a cold NPU start — verified, no OOMCI: two red jobs are a pre-existing, unrelated infra failure
Test Lemonade Embeddings APIandTest RAGfail onnomic-embed-text-v2-moe-GGUF: llama-server failed to start(HTTP 500) — the embedding model's server, which this PR does not touch. The same failure hits unrelated branchfix/lemonade-version-ci-triggerat the same time and reproduces on both Lemonade 10.7.0 and 10.8.1. The previously-failingLemonade Server Smoke Testnow passes after main's 10.8.1 bump (#1869) merged in. All unit, lint, CLI, and Agent-SDK integration jobs are green.