Skip to content

[Bug] AMD NPU: chat titles run on the loaded NPU model and evict the chat's conversation cache, so the next turn re-prefills the whole conversation - #17532

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
LeoBorcherding:studio/npu-skip-model-titles
Nov 14, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
LeoBorcherding:studio/npu-skip-model-titles

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

With auto chat titles on, or when "Refresh title" is used from the chat row menu, the title request went to the active local checkpoint, including NPU models (lemonade: ids). FastFlowLM on the NPU keeps one conversation cache (on qwen3.8, one conversation slot plus head-only slots), so the title request evicts the chat's cache and the next turn re-prefills the whole conversation, which takes minutes at NPU prefill speed on a long chat. It also ties up the single NPU while the title is generated.

titleCheckpoint now returns no checkpoint when the active model is an NPU model, so both paths fall back to the existing heuristic title. A chat answered by an external connection still asks that connection.

Tests

New case in chat-title-refresh.test.ts (fails on main). npu/api.ts imports authFetch from @/features/auth/api so chat-title.ts stays loadable in the node test harness; the npu-api.test.ts stub key follows.

Tested on Windows 11, Ryzen 9 9950X + 2x R9700, no NPU: frontend typecheck and the 56 related test files (1010 pass). Not run on a Ryzen AI NPU.

Real-NPU measurement (FastFlowLM 1.0.12, Lemonade 2026.44.1, the shipped pins)

AMD Strix Halo NPU (XDNA2, Linux), Studio at this PR's merge base, temperature 0, a ~2,360-token first turn then a follow-up, 4 repeats per variant. Time to first streamed token of turn 2:

model nothing between turns title request between other long chat between (control) turn 1 (full read)
qwen3.5-9b 2.69, 2.51, 2.68, 2.52 s 2.57, 2.58, 6.89, 6.99 s 2.60, 2.69, 6.99, 7.02 s 5.8 s
qwen3.8-mtp-27b 21.4 s 21.4 s 21.4 s 21.3 s

On qwen3.5-9b the first two repeats still hit the cache, but once FastFlowLM's conversation caches are full the title request evicts the chat and turn 2 reads the whole conversation again, exactly like the unrelated-chat control. qwen3.8-mtp reads the full conversation every turn regardless, so it is unaffected either way. The title request itself holds the NPU for 3.0 s (9B) and 11.3 s (27B).

The NPU keeps one conversation cache, so a title request on it evicted the chat's
prefill and the next turn re-prefilled the whole conversation. The heuristic title
is used instead, for both auto titles and the row menu's refresh.
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Measured on a real NPU: AMD Strix Halo (DevLab runner, Linux), FastFlowLM 1.0.12, Lemonade 2026.44.1, fork phase 5 92c2fbb, temperature 0 (oobabooga/unsloth run 43276227073). The test chat has a ~2,360-token first turn, then a follow-up, with and without a title request sent to the same model in between.

title

On FastFlowLM 1.0.12 the title request didn't evict the chat's prompt cache. Both second turns hit it: 3.98 vs 4.01 s to first token on Qwen3.6-35B-A3B-NPU2, and 2.21 vs 2.28 s on Qwen3.5-9B-NPU2, against 11.6 and 5.5 s for the full first read. So this PR has no measurable speed effect on 1.0.12. It still keeps the title off the loaded NPU model, but the speed-up the title describes didn't show up on this build.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T17:59:13.427327Z 610223a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 610223a197

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants