Skip to content

[Bug/Feature] Auto Compaction triggers at a fixed ~75% of configured Context Length regardless of available VRAM/RAM — no UI control to adjust threshold or disable #9671

Closed

Description

@jocomatek-creator

name: Unsloth Studio Bug
about: Report a problem with the Unsloth Studio desktop app or web UI
title: "[Studio Bug] "
labels: bug
assignees: ""

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:
Windows 11 Pro

GPU model(s) and accelerator backend:
NVIDIA CUDA. GPU 0: RTX 5060 Ti, 16GB VRAM. GPU 1: GTX 1660 Ti, 6GB VRAM (22GB total VRAM across both). System RAM: 32GB DDR5-6000.

Versions:
Latest Unsloth Desktop release (auto-compaction shipped in v0.1.801-beta)

What happened?

Steps to reproduce:

  1. Load a large GGUF model that fits comfortably in available VRAM/RAM (gemma-4-31B-it-GGUF, Q4_K_S)
  2. Set Context Length to 32,768 (or 65,536)
  3. Run a long conversation with a large, load-bearing system prompt
  4. Watch the context usage counter as the conversation grows

Expected behavior:
Auto Compaction should trigger based on actual available VRAM/RAM capacity, or at minimum have a user-configurable threshold. Ideally there should also be a toggle to disable it entirely for users who prefer a hard context limit over silent eviction.

Actual behavior:
Auto Compaction fires at a fixed percentage of the configured Context Length, not based on real capacity:

  • With Context Length set to 32,768: compaction triggers at ~25,000 tokens used (~76%)
  • With Context Length set to 65,536: compaction triggers at ~48,000 tokens used (~73%)

This happens despite 22GB total VRAM and 32GB of system RAM sitting completely unused during inference. Run Settings shows an "Exceeds estimated VRAM capacity" warning, but the underlying estimate isn't visible or adjustable anywhere in Run Settings or Advanced Settings.

When compaction fires, it evicts effectively the entire active context at once rather than trimming incrementally. Recovering evicted context requires the model to call a recall/search tool, which takes roughly a minute and only happens if the user explicitly asks for it. For sessions with a large, load-bearing system prompt (e.g. long-running roleplay/agent sessions where the system prompt defines core rules), this means the model silently "forgets" its instructions mid-session with no warning.

Model and operation involved:
gemma-4-31B-it-GGUF (Q4_K_S), inference, Studio Chat tab, GGUF/llama.cpp backend.

Diagnostics and logs

Desktop application

Additional Notes

This may be related to #4971 (context auto-reduced to a "safe" value despite free VRAM/RAM, running with --fit off) and #8497 (feature request to offload context to RAM instead of reducing it) — both point to the same underlying issue: capacity estimation is overly conservative and not exposed or configurable to the user.

Activity

  1. added
    feature request
    on Aug 25, 2026
  2. mithulaartigala commented on Aug 25, 2026

    @mithulaartigala

    Hey i am sorry this eply is not that hlpful, but what TPS do u get with that setup on that model?

  3. jocomatek-creator commented on Aug 25, 2026

    @jocomatek-creator
    Author

    Unsloth desktop 9 TPS, LMstudio 7 TPS

  4. crackcocaine69 commented on Aug 25, 2026

    @crackcocaine69

    This is a serious issue for me, chats are basically completely useless after the first compact as they stay at roughly 15-23% of my context forever. Had to stop using the app entirely. Unlike the original issue I am using no system prompt.

    In my limited testing the trim is too aggressive and triggers much too early, mostly around 75% like the original poster found but sometimes far sooner (64k out of 128k). It also seems to then trigger every subsequent run.

    I would really like a toggle for a standard moving window or middle out transform instead of this compact at least until its matured as a feature (at which point I'm sure it will be great like the rest of the app).

    Unsloth Version
    v0.1.803-beta
    Package Version
    2026.8.21
    Desktop App Version
    0.1.803-beta
    llama.cpp Version
    b10472-mix-4b653db
    Model:
    Qwen3.8-27B-Q4_K_M (Unsloth)

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

    bugfeature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions