You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] The long-context chat has started to lag. #12552
GPU model(s) and accelerator backend:
Geforce RTX 3070 8Gb,
Backend CUDA
Python 3.13.13
Torch 2.11.0+cu130
Transformers 5.5.0
Versions:
Версия Unsloth v0.1.902-beta
Версия пакета 2026.9.14
Версия настольного приложения 0.1.902-beta
Версия llama.cpp b11160-mix-a6922cc
What happened?
Steps to reproduce:
Get a model response of 5k+ tokens (including the reasoning process).
Expected behavior:
The chat window should not lag with long contexts, including after the response is complete.
Actual behavior:
The active chat tab slows down significantly while the model is generating a response following the latest updates. This happens regardless of whether I use Unsloth Desktop or the web interface.
The integrated processor accelerator handles browser rendering and Unsloth Desktop. If the graphics card performing model inference handles these tasks instead, the chat window lags even more.
i've been having this for many weeks, it's unusable, it pegs a single cpu core to 100% every time i try to type even a few characters, i can't use the chat pane at all, as it takes MULTIPLE seconds for EACH letter to print o.O
there's no cpu usage for any related process, US, or llama.cpp, etc and despite my Intel 10900x (10c/20t) @5ghz, 64GB RAM, it just crawls like i'm using an intel 486 with 1GB of RAM o.O
it seems to be related to compacting, and large-ish kv caches ?
i'm using what i consider a modest 50k kv cache with qwen 3.8 27b on a triple gpu setup with 30GB vram, when it works, it's great, ~30t/s and chat pane is responsive, as it should be, but eventually as the cache fills, and compaction hits, the chat pane goes to hell and my only option is to start a new session entirely.
I can confirm this issue, and in my case it becomes severe enough to make the entire Studio UI almost unusable in very long-running unattended agent sessions.
Environment
OS: Windows 11
Unsloth Studio: 903 beta
Hardware: AMD Ryzen AI Max+ PRO 395
GPU: Radeon 8060S / gfx1151
Backend: ROCm
llama-server: build 10995 (c2d005ffc)
Model: Qwen3.8 Flash-Next
Quantization in the attached log: Q5_K_M
Physical context size: 150,016 tokens
Rolling Context: enabled
Speculative decoding / MTP: enabled
Single agent / single slot
I have also observed the same frontend degradation on previous Unsloth Studio versions.
It is not specific to Q5_K_M either. I have reproduced the same behavior with Qwen3.8 Flash-Next Q4 XS and Q4 M variants as well.
So far this appears independent of model quantization and backend inference performance.
Workload
This is a long-running unattended agent workload.
The agent is intentionally designed to continue working autonomously for many hours without requiring user input between every step. It performs many tool calls, analysis steps and reasoning turns while progressing through the same task and the same saved conversation.
Rolling Context allows the agent to continue far beyond a single physical context window.
At the time of the captured log, the run had already reached:
more than 18.5 hours of continuous server runtime
854 completed inference requests, with the next request still running
repeated Rolling Context cycles
~2.24M prompt + generated tokens processed by llama-server
The agent/backend was still healthy and actively processing when the log capture ended.
During the run the active prompt repeatedly grows to roughly ~112k tokens and is then reduced by Rolling Context to roughly ~51–54k tokens.
So the model-side context remains bounded, while the same persistent Studio conversation continues accumulating agent turns, tool calls, reasoning blocks, Markdown and tool output.
This is therefore not just a manually accumulated long chat. It is a real unattended multi-hour agent workflow using Rolling Context as intended.
Observed UI behavior
The slowdown affects the entire Studio frontend, not only the message composer.
After the conversation becomes very large:
typing can effectively freeze the entire Studio window for a long time
typed text may only become visible much later
in severe cases I estimate these stalls at roughly 30–90 seconds, although I have not measured them precisely
the duration appears to increase with the amount of text being typed
scrolling through the conversation is also laggy
opening or interacting with other Studio UI elements, including the Settings menu, is also heavily delayed
the entire application frontend feels stalled during these periods
Meanwhile, the agent/backend and llama-server continue working normally.
This is important: the agent can continue executing tasks in the background while the Studio UI is effectively frozen.
The problem also persists with the saved conversation itself:
reopening the same long-running saved chat immediately reproduces the severe lag
restarting/interruption does not make that conversation responsive again
a new/fresh chat is immediately responsive
the slowdown therefore appears tied to the size/complexity of the persistent conversation rather than server uptime
Reduce Motion workaround
I tested UI Settings from Above.
This improves responsiveness slightly, but does not solve the problem.
The severe UI stalls, slow scrolling and general frontend lag remain.
Rolling Context seems to amplify the problem
This appears related to the already known long-thread/frontend scaling issues, but Rolling Context increases the practical impact substantially.
Without Rolling Context, a conversation would eventually hit the model context limit and normally be replaced by a new conversation.
With Rolling Context, an unattended agent can continue working in the same saved conversation for many hours and through many effective context windows.
The model context remains bounded through rolling/compaction, but the persistent frontend conversation appears to continue growing.
In other words:
model context:
bounded by Rolling Context
saved Studio thread:
continues growing across every agent turn, tool call and reasoning block
This seems to turn an existing long-conversation UI performance issue into a serious scaling problem for long-running unattended agents.
The agent itself remains healthy, but frontend responsiveness progressively degrades as the persistent thread grows.
Related issues / previous frontend performance work
The important difference in this case is the scale enabled by Rolling Context and unattended agent execution: the same conversation can continue autonomously across many context cycles instead of naturally ending after one context window.
I can attach the llama-server log from the ~18.5 hour run if useful, and I can also provide Studio diagnostics or a frontend/browser performance trace if needed.
Additional observation after updating to Studio 904:
The issue is still reproducible in 904.
Before restarting Studio, while the affected long-running conversation was open, WebView2: Chat - Unsloth had grown to approximately 4.47 GB RAM.
After a fresh Studio restart, the same Chat WebView used only ~137 MB RAM.
Then, with no model loaded and no inference running:
simply reopening the affected saved long-running conversation increased the Chat WebView to ~986 MB
typing only two short sentences (~20–30 words) into the composer, without submitting them, increased it further to ~1.64 GB
during this typing, the same severe UI lag/freeze occurred
the entire Studio UI is affected, not only the composer
During the stall, the Chat WebView also showed ~3.1% CPU usage. On this 32-thread system, that is roughly consistent with one logical core being saturated.
So the problem can be reproduced entirely in the frontend:
fresh Studio -> ~137 MB
open affected long-running chat -> ~986 MB
type ~20–30 words -> ~1.64 GB + severe UI lag
previous long-running state -> ~4.47 GB
This strongly suggests that the persistent conversation/frontend state is the main driver, rather than model inference or the llama-server backend.
I tested the merged fix from #13059 in a self-compiled Windows Tauri Desktop EXE.
First, thank you for the substantial improvement! The fix clearly works in the real Windows WebView2 environment. Subjectively, responsiveness feels like roughly 3x better in my long-running agent conversation, although this is not a controlled benchmark.
However, some noticeable lag remains.
Interesting observations:
Long saved agent conversation, no model loaded: typing is now smoother, acceptable expirience.
Same long conversation, model loaded but completely idle (no generation or streaming): typing still has more noticeable latency. Better than before, but still not good experience.
New, empty conversation with the same model loaded: typing is smooth. Just switched to new chat, old one working.
Environment: Windows 11, Ryzen AI MAX+ PRO 395, Radeon 8060S, ROCm, Qwen3.8 Flash Next AP Q5_K_M, very long agent conversation with repeated Rolling Context cycles.
The self-compiled test build in my quick-test used different model-loading parameters from my usual configuration, so the perceived speedup is only an approximate observation.
This may suggest that the remaining issue is specifically triggered by the combination of a large persistent conversation and an active loaded-model state.
The improvement from #13059 is significant, but long agent conversations are not yet fully responsive under normal operating conditions.
Happy to provide further diagnostic traces if useful.
Would it be possible to fundamentally decouple the full persistent chat history from the actively rendered conversation?
I think this could be especially beneficial for long-running agents using Rolling Context.
And thanks for your great work! I love Unsloth Desktop, especially the flexibility with custom llama.cpp setups and its capabilities for autonomous agent workflows, while still being easy to use. The agent permission system is also very intuitive!
@Sneakr Yes, thank you a lot, this solved the lag/stuck issue.
I worked on a feature to decouple rendering from stored chat massages.
It works great for me and reduces needed resources, e.g. Ram.
My hope is that this adds to your work.
Since it is my first work with github environment and totally coded by GPT6 Chat, I'm not sure if it is usable for merging in a future unsloth desktop release. You may have a look: #14001
On my system it works great, reduces ressources and even in long running sessions - no problems, smooth experience.
Tried to give good options to activate/deactivate globally and even individually for each chat.
Activity
tehtelev commentedon Oct 4, 2026
Setting this option to "Off" slightly alleviates the situation.
p3ngwin commentedon Oct 5, 2026
i've been having this for many weeks, it's unusable, it pegs a single cpu core to 100% every time i try to type even a few characters, i can't use the chat pane at all, as it takes MULTIPLE seconds for EACH letter to print o.O
there's no cpu usage for any related process, US, or llama.cpp, etc and despite my Intel 10900x (10c/20t) @5ghz, 64GB RAM, it just crawls like i'm using an intel 486 with 1GB of RAM o.O
it seems to be related to compacting, and large-ish kv caches ?
i'm using what i consider a modest 50k kv cache with qwen 3.8 27b on a triple gpu setup with 30GB vram, when it works, it's great, ~30t/s and chat pane is responsive, as it should be, but eventually as the cache fills, and compaction hits, the chat pane goes to hell and my only option is to start a new session entirely.
tehtelev commentedon Oct 5, 2026
@p3ngwin Try setting the options highlighted in red exactly as shown in my screenshot.
p3ngwin commentedon Oct 6, 2026
no change at all :(
Griggelor commentedon Oct 7, 2026
I can confirm this issue, and in my case it becomes severe enough to make the entire Studio UI almost unusable in very long-running unattended agent sessions.
Environment
I have also observed the same frontend degradation on previous Unsloth Studio versions.
It is not specific to Q5_K_M either. I have reproduced the same behavior with Qwen3.8 Flash-Next Q4 XS and Q4 M variants as well.
So far this appears independent of model quantization and backend inference performance.
Workload
This is a long-running unattended agent workload.
The agent is intentionally designed to continue working autonomously for many hours without requiring user input between every step. It performs many tool calls, analysis steps and reasoning turns while progressing through the same task and the same saved conversation.
Rolling Context allows the agent to continue far beyond a single physical context window.
At the time of the captured log, the run had already reached:
The agent/backend was still healthy and actively processing when the log capture ended.
During the run the active prompt repeatedly grows to roughly ~112k tokens and is then reduced by Rolling Context to roughly ~51–54k tokens.
So the model-side context remains bounded, while the same persistent Studio conversation continues accumulating agent turns, tool calls, reasoning blocks, Markdown and tool output.
This is therefore not just a manually accumulated long chat. It is a real unattended multi-hour agent workflow using Rolling Context as intended.
Observed UI behavior
The slowdown affects the entire Studio frontend, not only the message composer.
After the conversation becomes very large:
Meanwhile, the agent/backend and llama-server continue working normally.
This is important: the agent can continue executing tasks in the background while the Studio UI is effectively frozen.
The problem also persists with the saved conversation itself:
Reduce Motion workaround
I tested UI Settings from Above.
This improves responsiveness slightly, but does not solve the problem.
The severe UI stalls, slow scrolling and general frontend lag remain.
Rolling Context seems to amplify the problem
This appears related to the already known long-thread/frontend scaling issues, but Rolling Context increases the practical impact substantially.
Without Rolling Context, a conversation would eventually hit the model context limit and normally be replaced by a new conversation.
With Rolling Context, an unattended agent can continue working in the same saved conversation for many hours and through many effective context windows.
The model context remains bounded through rolling/compaction, but the persistent frontend conversation appears to continue growing.
In other words:
model context:
bounded by Rolling Context
saved Studio thread:
continues growing across every agent turn, tool call and reasoning block
This seems to turn an existing long-conversation UI performance issue into a serious scaling problem for long-running unattended agents.
The agent itself remains healthy, but frontend responsiveness progressively degrades as the persistent thread grows.
Related issues / previous frontend performance work
This appears related to:
The important difference in this case is the scale enabled by Rolling Context and unattended agent execution: the same conversation can continue autonomously across many context cycles instead of naturally ending after one context window.
I can attach the llama-server log from the ~18.5 hour run if useful, and I can also provide Studio diagnostics or a frontend/browser performance trace if needed.
Griggelor commentedon Oct 7, 2026
Additional observation after updating to Studio 904:
The issue is still reproducible in 904.
Before restarting Studio, while the affected long-running conversation was open,
WebView2: Chat - Unslothhad grown to approximately 4.47 GB RAM.After a fresh Studio restart, the same Chat WebView used only ~137 MB RAM.
Then, with no model loaded and no inference running:
During the stall, the Chat WebView also showed ~3.1% CPU usage. On this 32-thread system, that is roughly consistent with one logical core being saturated.
So the problem can be reproduced entirely in the frontend:
fresh Studio -> ~137 MB
open affected long-running chat -> ~986 MB
type ~20–30 words -> ~1.64 GB + severe UI lag
previous long-running state -> ~4.47 GB
This strongly suggests that the persistent conversation/frontend state is the main driver, rather than model inference or the llama-server backend.
danielhanchen commentedon Oct 8, 2026
We're investigating
Studio: notify every row when a hidden branch changes the repository (#…
p3ngwin commentedon Oct 8, 2026
oh wow!
looks like you guys solved it, holy cow, well done, and THANK YOU ! ❤️
ah, maybe not, i was initially reacting the previous comments, i haven't compiled that release yet to test :(
Griggelor commentedon Oct 8, 2026
I tested the merged fix from #13059 in a self-compiled Windows Tauri Desktop EXE.
First, thank you for the substantial improvement! The fix clearly works in the real Windows WebView2 environment. Subjectively, responsiveness feels like roughly 3x better in my long-running agent conversation, although this is not a controlled benchmark.
However, some noticeable lag remains.
Interesting observations:
Environment: Windows 11, Ryzen AI MAX+ PRO 395, Radeon 8060S, ROCm, Qwen3.8 Flash Next AP Q5_K_M, very long agent conversation with repeated Rolling Context cycles.
The self-compiled test build in my quick-test used different model-loading parameters from my usual configuration, so the perceived speedup is only an approximate observation.
This may suggest that the remaining issue is specifically triggered by the combination of a large persistent conversation and an active loaded-model state.
The improvement from #13059 is significant, but long agent conversations are not yet fully responsive under normal operating conditions.
Happy to provide further diagnostic traces if useful.
Griggelor commentedon Oct 8, 2026
Would it be possible to fundamentally decouple the full persistent chat history from the actively rendered conversation?
I think this could be especially beneficial for long-running agents using Rolling Context.
And thanks for your great work! I love Unsloth Desktop, especially the flexibility with custom llama.cpp setups and its capabilities for autonomous agent workflows, while still being easy to use. The agent permission system is also very intuitive!
Sneakr commentedon Oct 13, 2026
@Griggelor This has now been solved #13255 and merged, should appear in the next release now.
tehtelev commentedon Oct 13, 2026
The situation has definitely improved. Thanks
Griggelor commentedon Oct 17, 2026
@Sneakr Yes, thank you a lot, this solved the lag/stuck issue.
I worked on a feature to decouple rendering from stored chat massages.
It works great for me and reduces needed resources, e.g. Ram.
My hope is that this adds to your work.
Since it is my first work with github environment and totally coded by GPT6 Chat, I'm not sure if it is usable for merging in a future unsloth desktop release. You may have a look: #14001
On my system it works great, reduces ressources and even in long running sessions - no problems, smooth experience.
Tried to give good options to activate/deactivate globally and even individually for each chat.