Repository navigation
Description
Environment
Where are you using Unsloth?
- Studio desktop application
- Studio web UI (
unsloth studio) - Unsloth CLI
- Python package or notebook
- Colab or Kaggle
Operating system and version:
- Kubuntu 24.04.4 LTS
- Linux kernel
7.0.0-28-generic
GPU model(s) and accelerator backend:
- AMD Radeon 8060S
- ROCm through the llama.cpp runtime bundled by Unsloth
- Single GPU
- 128 GB system RAM
Versions:
- Unsloth Studio Desktop:
0.1.800-beta - Unsloth package:
2026.8.18 - llama.cpp:
10360 (90e6a9131), compiled by the Unsloth team
Model:
Qwen3.8-27B-UD-Q4_K_XL.gguf- GGUF metadata reports
general.architecture = qwen35 - Local GGUF chat inference
AI-assisted report submitted at the user's explicit request. The measurements below are from the user's live Unsloth/llama.cpp logs and terminal diagnostics.
Summary
In a long Studio conversation (~103k tokens), prompt/KV reuse works well while the same llama-server process remains alive, but a model reload/restart loses the reusable processed state. The next tiny prompt then forces a full ~103k-token prefill, taking about 11 minutes at 100% GPU utilization before generation begins.
After that one expensive rebuild, subsequent turns reuse the prefix correctly and become fast again.
Studio launches llama.cpp with --slot-save-path, but after reload the slot directory contains effectively no persisted conversation state, so reopening/continuing a long saved chat does not restore the already-computed state.
This makes long-running conversations painful to resume after any model reload, settings reload, Studio restart, or system restart even though the chat text itself is persisted.
Steps to reproduce
- In Unsloth Studio, load
Qwen3.8-27B-UD-Q4_K_XL.gguf. - Build a long chat of roughly 100k tokens.
- Use one slot and a sufficiently large prompt cache. The reproducing configuration was:
-c 131072
--parallel 1
--cache-ram 16384
--ctx-checkpoints 64
--checkpoint-min-step 2048
--slot-save-path <studio-home>/cache/llama-slots
- Send a small follow-up without reloading the model. Prefix reuse is fast.
- Reload the model (or restart Studio / llama-server).
- Return to the same saved long conversation and send a tiny prompt.
- Observe that llama.cpp processes the entire ~103k-token history from the beginning before generating.
- After that first full rebuild finishes, send another tiny prompt without reloading. Prefix reuse works immediately again.
Expected behavior
For a persisted Studio conversation, reloading/restarting the model should ideally restore a compatible saved llama.cpp slot/prompt state when the model and inference configuration match, so continuing a 100k-token chat does not require a full 10+ minute prefill every time the backend is restarted.
If persistent restoration is not currently possible for qwen35 hybrid/recurrent models, Studio should at minimum make this limitation explicit and provide a strategy to avoid or minimize the repeated full prefill (for example persistent slot state, server keep-alive across compatible setting changes, background re-warm, or clear progress/ETA on resume).
Actual behavior and measurements
First prompt after reload: full history reprocessed
The first request after reload processed essentially the entire conversation:
prompt processing, n_tokens = 102978, progress = 1.00
prompt processing, n_tokens = 102992, progress = 1.00
prompt eval time = 656111.75 ms / 102996 tokens
= 156.98 tokens/sec
total time = 659591.52 ms / 103022 tokens
That is about 10 minutes 56 seconds of prompt evaluation before the response can proceed normally.
During this period GPU utilization was 100%.
Immediate next tiny prompt: prefix reuse works
Without reloading the model, the next request reused the slot perfectly:
selected slot by LCP similarity, f_sim_best = 1.000, f_keep = 1.000
prompt eval time = 831.83 ms / 24 tokens
total time = 5981.29 ms / 57 tokens
This shows the hardware/model can reuse the long context efficiently inside the same process.
Larger subsequent paste: old context still reused
A later real-world request with several thousand new tokens also preserved the existing prefix:
selected slot by LCP similarity, f_sim_best = 0.941, f_keep = 1.000
prompt eval time = 63008.99 ms / 6510 tokens
Only the new material was processed rather than the full ~103k history.
Prompt-cache observations
Before increasing the cache limit, llama.cpp logged:
prompt state size 9681.129 MiB exceeds cache size limit 8192.000 MiB, skipping
Increasing to:
--cache-ram 16384
removed that 8 GiB ceiling as a likely per-process cache problem, and using:
--ctx-checkpoints 64 --checkpoint-min-step 2048
made long-chat reuse reliable while the process remained alive.
However, after a model reload and before sending the first new prompt, the configured slot-save directory was only:
4.0K <studio-home>/cache/llama-slots
with no useful saved long-conversation slot state visible. The next prompt therefore rebuilt the whole history.
Why this seems distinct from ordinary long-context cost
A ~103k prefill is naturally expensive, but it should not need to be repeated every time a persisted chat is resumed if reusable state can be safely persisted/restored.
The contrast is very clean:
- After reload: ~103k prompt tokens, ~656 seconds prefill
- Same process, next turn: 24 prompt tokens, ~0.83 seconds prefill,
f_keep=1.000
So the main usability problem is loss/non-restoration of processed conversation state across model/backend reloads, not steady-state generation speed.
Related issues
- [Bug] Preset persistence issues, tool reasoning streaming, and GGUF timeout on long-context prefill #5130 — long-context GGUF resume after restart causes very long silent prefill / timeout
- [Bug] Windows + full offload 模式下
--cache-ram 0 --ctx-checkpoints 0导致多轮对话每轮都重新 prefill,严重影响交互体验 #8774 — prompt cache and context checkpoint configuration can cause repeated full prefill
This report is specifically about state persistence/restoration across a model/backend reload on a current Qwen3.8 qwen35 GGUF, where in-process prefix reuse is proven to work correctly.
Suggested directions
- Persist and restore llama.cpp slot state for saved Studio threads when model + chat template + relevant inference configuration are compatible.
- If
qwen35recurrent/checkpoint state cannot currently be safely serialized/restored upstream, consider keeping the llama-server process alive across compatible UI changes rather than forcing a full reload. - Add explicit long-context resume progress/ETA in Studio so a multi-minute prefill is not presented as an apparently frozen chat.
- Consider automatically selecting prompt-cache/checkpoint defaults appropriate for long
qwen35chats instead of relying on manual Extra Arguments. - Surface a warning when the prompt state cannot be saved/restored (for example cache size too small or unsupported recurrent-state persistence).
I can provide additional sanitized llama.cpp log excerpts if useful.
Activity
jwminer commentedon Aug 16, 2026
Follow-up: hard context-window wall encountered in the same long chat
A second usability problem has now appeared in the same conversation and seems closely related to the persistence/resume issue reported above.
The Studio UI showed approximately:
but the next request failed with:
So the visible context meter understated the actual serialized request by roughly 18k tokens. That extra overhead appears to come from content added around the visible chat (system/tool/search/chat-template material), which means the user can hit a hard failure before the UI meter reaches the configured limit.
The user has temporarily increased Context Length back to the model's full
262144tokens, which required a model reload. That gets the current conversation moving again, but only postpones the same failure: once the serialized history approaches 262k, Studio currently has no apparent automatic compaction/rolling-context behavior and the conversation will dead-end again.This overlaps strongly with:
Suggested behavior
For long persisted chats, Studio should ideally:
Why this matters especially with the reload issue
The current workaround for the hard limit is to increase Context Length, but changing Context Length requires reloading the model. On a ~100k+ token Qwen3.8 chat, that reload then triggers the other issue in this report: the entire conversation has to be prefetched again because the reusable prompt state was not restored.
So these two behaviors compound each other:
A persistent slot/prompt-state solution plus automatic compaction/rolling context would together make long-running Studio conversations sustainable rather than eventually unusable.
jwminer commentedon Aug 16, 2026
Additional reproducible cache invalidation: changing Thinking/Reasoning level causes full long-context prefill
A further reproducible case was found in the same Qwen3.8-27B long chat.
After the 262,144-token context was loaded and the long conversation cache had been rebuilt, a tiny follow-up prompt returned in milliseconds, confirming healthy prefix reuse.
The user then changed only the Studio Thinking/Reasoning effort setting to High and sent a normal prompt. The next request immediately behaved like a cold start again.
Live llama.cpp log while the request was still running:
So this is not merely slower reasoning/decode caused by a higher reasoning effort. The backend was re-prefilling roughly the entire ~160k-token conversation, already spending over 19 minutes in prompt processing before generation.
Expected behavior
Changing the user-facing reasoning effort (Low/Medium/High/etc.) should not make a long cached conversation unexpectedly incur a full-context prefill if the underlying conversation history is otherwise unchanged. If the reasoning setting necessarily changes serialized prompt/template content in a way that invalidates the prefix cache, Studio should either:
For a ~160k-token chat, this UI setting currently has an unexpectedly severe performance side effect.
Practical impact
The user can have a fully warm chat where a tiny prompt answers in milliseconds, change only Thinking effort to High, and then immediately trigger a ~20-minute full re-prefill. On very long chats this makes ordinary reasoning-level adjustment effectively unsafe.
This appears to be another case where Studio-level request serialization/configuration interacts badly with llama.cpp prefix reuse and long
qwen35contexts.jwminer commentedon Aug 16, 2026
Confirmed: 20-minute first-token timeout cancels an actively progressing long-context prefill
The previous follow-up can now be confirmed from the llama.cpp log.
The long request triggered after changing Thinking/Reasoning to High continued making steady prompt-processing progress:
Then Studio's ~20-minute first-token timeout fired and the active llama.cpp task was explicitly cancelled:
The UI simultaneously reported:
This is a problematic false-positive timeout in this case: the backend was not hung. It was demonstrably making continuous progress through a very large prompt and had reached roughly 94% before Studio killed it.
Expected behavior
A first-token watchdog should distinguish between:
If prompt processing is still advancing, Studio should not cancel solely because no decoded token has appeared within a fixed 20-minute wall-clock period. Better options would be:
Compounding failure chain now reproduced
This makes the earlier cache-invalidation behavior even more severe, because the resulting cold prefill can be long enough that Studio prevents it from ever completing.
charliemb2 commentedon Sep 1, 2026
CachyOS, Studio WebUI (isolated install), 96 GB of VRAM, Intel 64-bit hardware.
Thanks for all that you do.
I am having most of these issues as well, with the 20 minute hard timeout for the first token being the most prominent.
For what I do loading larger than available-VRAM models and spilling into RAM is optimal. I've seen these problems with at least Unsloth UD-Q4_K_XL Minimax M2.7, and YanissAmz UD128 quant of Hy3.
I agree with OP's suggestions. But, if the OP's suggestions aren't going to be implemented soon-ish, then in the meantime please at least have a user-settable timer that is settable to at least a few hours.
[Edited to include model details and remove frustration commentary since overall I'm very thankful.]
Noct-GIT commentedon Sep 10, 2026
I was having this too, and I had assumed unsloth was just attaching an ungodly amount of extra info to my prompts because it somehow used 9k tokens on me saying "hi" or something with thinking off. If this could be fixed i would really appreciate it, and i hope to one day be able to select a very tiny model that does compaction, instead of having to let qwen do it.
[-][Studio Bug] Long Qwen3.8 GGUF chats lose reusable prompt state after model reload, causing ~11 minute full prefill[/-][+][Bug] AMD: Unsloth Studio redoes an 11-minute prefill on long Qwen3.8 chats after a model reload (Strix Halo, Linux)[/+][-][Bug] AMD: Unsloth Studio redoes an 11-minute prefill on long Qwen3.8 chats after a model reload (Strix Halo, Linux)[/-][+][Bug] Unsloth Studio / Desktop: long chats redo the full prefill after a model reload because slot KV is only saved on idle auto-unload[/+]nuke-web3 commentedon Oct 15, 2026
Getting the same behavior for very long running chats, for example:
It takes minutes with no GPU load before GPU kicks in and seconds till first token once that starts.
Studio: keep chat context when switching models (unslothai#16493)
Studio: keep a long GGUF chat's slot KV across a reload (#9037) (#17121)