Skip to content

[Bug] Preset persistence issues, tool reasoning streaming, and GGUF timeout on long-context prefill #5130

Closed

Description

@shashwata2020

Description:
I have been using Unsloth Studio for local inference and have identified three specific bugs that affect the user experience, particularly when attempting to maintain high-context conversations on low-end hardware.


Bug 1: Model Presets and KV Cache Settings Not Persisting on Load

Issue: When loading a model using a saved preset, the context window and KV cache quantization settings are not applied correctly on the initial load.

  • Behavior: The model defaults to a 4096 context window and F16 KV cache regardless of the saved preset.
  • Workaround: I must manually re-select the desired context window and KV cache settings in the UI and click "Apply," which triggers a secondary model reload. Only then do the settings persist.

Bug 2: Tool Reasoning Trace Is Not Streaming in UI

Issue: When a model utilizes tools, the reasoning/thought process does not stream live to the UI.

  • Behavior: Instead of a live trace, the UI displays a static block (e.g., "Thought for 1 seconds") only after the process is complete. This removes the ability to monitor the model's logic during execution.

Bug 3: GGUF Streaming Timeout During Long-Context Prefill

Issue: When resuming a conversation with a very large context (tested at 85.5k tokens out of a 148k limit), the engine fails to resume after a restart due to a timeout error.

  • Error Log: {"timestamp": "2026-04-22T10:25:23.033965Z", "level": "error", "event": "Error during GGUF streaming: timed out", "exc_info": true}
  • Observation: On low-end hardware with slower RAM, the prefill/prompt processing for 80k+ tokens takes longer than the currently hardcoded timeout threshold (appearing to be ~120 seconds). Since the engine is busy during this "silent" prefill phase, the UI/Wrapper assumes a hang and kills the connection.
  • Request: Implementation of a configurable/infinite timeout or a "Keep Alive" signal during heavy prompt processing to prevent the connection from dropping.

Environment & Hardware (Low-End Hardware Context)

  • OS: Windows (utilizing 49GB Page File)
  • GPU: NVIDIA RTX 2060 Super (8GB VRAM)
  • CPU: AMD Ryzen 5 3600
  • RAM: 32GB DDR4 @ 2866MHz
  • Model Used: Gemma 4 26B (A4B Q5_K_M GGUF)
  • Context Settings: 148k limit with Q8 KV Cache

Additional Context

Despite the hardware constraints, performance once the context is loaded is excellent (averaging 11.7 tps at 85k tokens). The primary bottleneck is the initial connection timeout and the manual "double-load" required for presets.

Activity

  1. Imagineer99 commented on Apr 22, 2026

    @Imagineer99
    Member

    thanks for sharing, these seem like real bugs, will investigate.

  2. Imagineer99 commented on Apr 22, 2026

    @Imagineer99
    Member

    was able to reproduce Bug 1, will tag here when fix is ready.

  3. shashwata2020 commented on Apr 23, 2026

    @shashwata2020
    Author

    was able to reproduce Bug 1, will tag here when fix is ready.

    Bug 2 is basically whenever the tools are active in a chat the reasoning does not stream and after its done reasoning it just shows the reasoning block and says thought for 1second, regardless if tools are being called or not.

    Image Image
  4. shashwata2020 commented on Apr 23, 2026

    @shashwata2020
    Author

    And bug 3 is probably a hardware edge case, cause i dont think its reproducible without very weak hardware.

  5. Imagineer99 commented on Apr 24, 2026

    @Imagineer99
    Member

    confirmed part of Bug 1 came from preset logic being too coupled to model-specific settings, which contributed to GGUF/runtime settings behaving inconsistently between initial load and reload

    I’ve put up a change to narrow presets to reusable generation settings (#5159) and will follow up separately with per-model config to fully address the issue

    will investigate Bug 2 and 3 shortly as well

  6. shashwata2020 commented on Apr 24, 2026

    @shashwata2020
    Author

    Thank you very much!

  7. kustomzone commented on May 11, 2026

    @kustomzone

    A quick fix for # 3 is to change the httpx read timeout, but for a currently working install this is in C:\Users\Administrator\.unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\core\inference\llama_cpp.py around line 3075, then restart & reload. (see /home/<username>/.unsloth/... on Linux)

    Tip: If the timer runs out again but the inference is still visibly running on your cpu/gpu then we can also click the re-gen (recycle) icon and when the inference finally finishes it should still output the full response without restarting.

    prefill_timeout = httpx.Timeout(
                    connect = 30,
                    read = 360.0,   <----
                    write = 10,
                    pool = 10,
                )
    
  8. shashwata2020 commented on May 11, 2026

    @shashwata2020
    Author

    Thanks ill give it a try!

  9. shimmyshimmer commented on Aug 21, 2026

    @shimmyshimmer
    Member

    Auto compaction / rolling context window is now available.

    Please update to the latest version: https://github.com/unslothai/unsloth/releases/tag/v0.1.801-beta

    CC: @shashwata2020

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions