Skip to content

[Bug] Context Length slider max is locked to current effective value, preventing increasing context length after lowering it #4670

Description

@NourEldin-Osama

Note: Please do not remove the questions. Answer beside them.

  1. Colab or Kaggle or local / cloud - Kaggle
  2. Number GPUs used, use nvidia-smi - 2
  3. Which notebook? Please link! Kaggle Notebook

Bug Description
When using Unsloth Studio's chat tab, after loading a GGUF model and lowering the context length via the slider/input in Chat Settings, you cannot increase it back because the HTML max attribute is incorrectly overwritten to the current context length instead of retaining the maximum allowed context length.

Steps to Reproduce:

  • Step 1: Open Unsloth Studio and go to the Chat tab.
  • Step 2: Load a GGUF model (e.g., a model with context length of 97,792).
Image
  • Step 3: Open the Chat Settings panel, lower the Context Length slider to a lower value (e.g., 80,000), and press Apply.
Image
  • Step 4: Try to increase the Context Length back to the original maximum value (97,792). Notice that the UI prevents you from doing so.
Image

Expected Behavior
The slider's maximum bound should remain static at the highest available context length for the loaded model, allowing the user to freely scale the value up and down within that limit.

Note for Developers:
While the selected model natively supports a maximum context length of 262,144, device hardware limitations cause llama.cpp to auto-reduce the maximum context to 97,792 (to accommodate the VRAM needed for the KV cache). The bug specifically occurs when trying to scale the slider back up to this auto-reduced maximum (97,792) after it has been lowered.

Relevant Logs:

{"timestamp": "2026-03-29T00:48:38.702980Z", "level": "info", "event": "Detected remote GGUF repo 'unsloth/qwen3.5-4b-gguf', variant=UD-Q4_K_XL, vision=True"}
{"timestamp": "2026-03-29T00:48:38.961821Z", "level": "info", "event": "GGUF download: 2.7 GB needed, 1181.7 GB free on disk"}
{"timestamp": "2026-03-29T00:48:38.961904Z", "level": "info", "event": "Resolving GGUF: unsloth/qwen3.5-4b-gguf/Qwen3.5-4B-UD-Q4_K_XL.gguf"}
{"timestamp": "2026-03-29T00:48:39.088816Z", "level": "info", "event": "GGUF resolved from cache: /root/.cache/huggingface/hub/models--unsloth--qwen3.5-4b-gguf/snapshots/e87f176479d0855a907a41277aca2f8ee7a09523/Qwen3.5-4B-UD-Q4_K_XL.gguf"}
{"timestamp": "2026-03-29T00:48:39.214688Z", "level": "info", "event": "Downloading mmproj: unsloth/qwen3.5-4b-gguf/mmproj-BF16.gguf"}
{"timestamp": "2026-03-29T00:48:39.466633Z", "level": "info", "event": "GGUF metadata: context_length=262144"}
{"timestamp": "2026-03-29T00:48:39.466733Z", "level": "info", "event": "GGUF metadata: chat_template=7816 chars"}
{"timestamp": "2026-03-29T00:48:39.466779Z", "level": "info", "event": "GGUF metadata: model supports reasoning (enable_thinking)"}
{"timestamp": "2026-03-29T00:48:39.466851Z", "level": "info", "event": "GGUF metadata: model supports tool calling"}
{"timestamp": "2026-03-29T00:48:39.505403Z", "level": "info", "event": "Context auto-reduced: 262144 -> 97792 (model: 2.7 GB, est. KV cache: 7.5 GB)"}
{"timestamp": "2026-03-29T00:48:39.505469Z", "level": "info", "event": "GGUF size: 2.7 GB, est. KV cache: 7.5 GB, context: 97792, GPUs free: [(0, 14910), (1, 14910)], selected: [0], fit: False"}
{"timestamp": "2026-03-29T00:48:39.505516Z", "level": "info", "event": "Reasoning model: enable_thinking=False by default"}
{"timestamp": "2026-03-29T00:48:39.505628Z", "level": "info", "event": "Using mmproj for vision: /root/.cache/huggingface/hub/models--unsloth--qwen3.5-4b-gguf/snapshots/e87f176479d0855a907a41277aca2f8ee7a09523/mmproj-BF16.gguf"}
{"timestamp": "2026-03-29T00:48:39.505677Z", "level": "info", "event": "Starting llama-server: /root/.unsloth/llama.cpp/llama-server -m /root/.cache/huggingface/hub/models--unsloth--qwen3.5-4b-gguf/snapshots/e87f176479d0855a907a41277aca2f8ee7a09523/Qwen3.5-4B-UD-Q4_K_XL.gguf --port 36905 -c 97792 --parallel 1 --flash-attn on -ngl -1 --jinja --chat-template-kwargs {\"enable_thinking\": false} --mmproj /root/.cache/huggingface/hub/models--unsloth--qwen3.5-4b-gguf/snapshots/e87f176479d0855a907a41277aca2f8ee7a09523/mmproj-BF16.gguf"}
{"timestamp": "2026-03-29T00:48:56.414761Z", "level": "info", "event": "llama-server ready on port 36905 for model 'unsloth/qwen3.5-4b-gguf'"}
{"timestamp": "2026-03-29T00:48:56.415117Z", "level": "info", "event": "Loaded GGUF model via llama-server: unsloth/qwen3.5-4b-gguf"}
{"timestamp": "2026-03-29T00:48:56.435454Z", "level": "info", "event": "Loaded default model defaults from /kaggle/working/unsloth/studio/backend/assets/configs/model_defaults/default.yaml"}
{"timestamp": "2026-03-29T00:48:56.438782Z", "level": "info", "event": "request_completed", "method": "POST", "path": "/api/inference/load", "status_code": 200, "process_time_ms": 17993.32}
{"timestamp": "2026-03-29T00:48:56.662728Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/models/list", "status_code": 200, "process_time_ms": 3.66}
{"timestamp": "2026-03-29T00:48:56.670379Z", "level": "info", "event": "Loaded default model defaults from /kaggle/working/unsloth/studio/backend/assets/configs/model_defaults/default.yaml"}
{"timestamp": "2026-03-29T00:48:56.673711Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/inference/status", "status_code": 200, "process_time_ms": 6.9}
{"timestamp": "2026-03-29T00:48:56.887938Z", "level": "info", "event": "Found 0 trained LoRA adapters in /root/.unsloth/studio/outputs"}
{"timestamp": "2026-03-29T00:48:56.888115Z", "level": "info", "event": "Found 0 exported models in /root/.unsloth/studio/exports"}
{"timestamp": "2026-03-29T00:48:56.888453Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/models/loras", "status_code": 200, "process_time_ms": 1.29}
{"timestamp": "2026-03-29T00:48:59.193652Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/models/local", "status_code": 200, "process_time_ms": 1.67}

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