Repository navigation
Studio: reuse the native prompt count in a GGUF chat's context fit - #19159
Conversation
…nd native counts Both count paths now compute the native key once and look it up before the native call; the miss test also covers a changed system prompt and template options.
llama-server renders tool schema keys in the order the request sends them, so reordered parameters change the prompt and its count (267 vs 266 tokens on Qwen3.5). Sorting keys made both orders share one memo entry, letting the context fit reuse a count for a different prompt.
…e count A render count hitting the native memo returned before any cancellation check, so a cancelled turn's context fit could take the cached count and go on to trim and archive. Poll should_abort before the shared lookup for every caller, and reorder nested schema keys in the key-order miss test.
|
Pushed three small follow-ups on top of the original commit, plus a merge of the latest
Validation: on |
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex converged on CI: upstream runners were backed up, so CI ran on a staging copy with the same head and base (now closed): Lyxot#280. 46 jobs passed. The 5 failures are unrelated to this change: the same 10 tests (Spark-TTS codec handoff, the diffusion HIP gate guard, the stub-heavy-imports guard) also fail on current Changed during this workflow: merged the latest |
…-11-23..25) Merge of unslothai/unsloth main 2e1afd5..bd1ddf2. No textual conflicts; audited for Ganjalf invariants (Claude API alignment, thinking budget, Qwen thinking presence 0, check_page, guards, plugins/hooks/run_agent stop, branding via messages.ts, Ganjalf updater): all intact. Taken: llama.cpp/GGUF fixes (thinking budget counted with the real template unslothai#19143, native prompt count in context fit unslothai#19159, host RAM growth priced before pinning unslothai#19231, second quant of a loaded repo unslothai#19169, small Auto context on low-RAM CPU hosts unslothai#19142), security and stability hardening (media bytes checked, remote-code gate, sandbox cache, managed accounts, IPv6 loopback listeners), chat fixes (Files menu, deleted turns from other tabs, composer, tool approvals tied to their tool), MCP, chat templates (phi-3, mistral), training/core kernels, installer AMD/ROCm mixed hosts, Tauri security bumps, unsloth-zoo>=2026.11.11. Branding stays Ganjalf (upstream strings are rebranded at runtime by i18n/messages.ts). Ganjalf follow-up: the thread sampling simulation oracle expects presence 0 for Qwen 3.5/3.6 with thinking (non-thinking 1.5), as the chat table does since 369d05c. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EVYBhJeMQGvLT6Ka4nMMUE
Every GGUF chat turn counts the same prompt twice: once for the admission reservation and once for the context fit. Both return the same number. #18931 caches the native count, but the fit never reads that cache, so it still renders and tokenizes the whole prompt every turn.
The fit now reuses the cached native count when it would render the exact same request. Anything different is still counted fresh, and a failed native count is never cached.
RTX 5000 Ada, Qwen3-4B-Instruct-2507 Q4_K_M: