Repository navigation
Closed
Labels
Description
Environment
Where are you using Unsloth?
- Unsloth desktop application
- Unsloth web UI (
unsloth studio) - Unsloth CLI
- Python package or notebook
- Colab or Kaggle
Operating system and version:
Linux (Garuda Linux / Arch Linux)
GPU model(s) and accelerator backend:
AMD Radeon RX 9070 (ROCm / HIP 7.2.26015 & Vulkan)
Versions:
- llama-server: version 0.4.0-dev (build 10840, commit 58670d128)
- Unsloth Studio Desktop (AppImage)
What happened?
Steps to reproduce:
- Load
unsloth/gemma-4-12B-it-qat-GGUF(which automatically attachesmmproj-F16.gguf). - Verify that pure text-only prompts generate without issue.
- Attach/upload an image (e.g., standard game screenshot) and submit a question.
Expected behavior:
The vision encoder processes the image tokens and generates a multimodal description.
Actual behavior:
The backend crashes within 1–2 seconds with:
Lost connection to the model server. It may have crashed -- try reloading the model.
Model and operation involved:
unsloth/gemma-4-12B-it-qat-GGUF + mmproj-F16.gguf during multimodal inference.
Diagnostics and logs
Model-specific logs, if applicable
Excerpt from ~/.unsloth/studio/logs/llama-server/llama-*-try0.log:
0.42.992.719 I slot launch_slot_: id 3 | task 4 | processing task, is_child = 0
/home/runner/work/llama.cpp/llama.cpp/llama.cpp/src/llama-context.cpp:1749: GGML_ASSERT((cparams.causal_attn || cparams.n_ubatch >= n_tokens_all) && "non-causal attention requires n_ubatch >= n_tokens") failed
#2 0x00007f7dd135a286 in ggml_print_backtrace () from /home/v7508/.unsloth/llama.cpp/build/bin/libggml-base.so.0
#3 0x00007f7dd1372089 in ggml_abort () from /home/v7508/.unsloth/llama.cpp/build/bin/libggml-base.so.0
#4 0x00007f7dd076f621 in llama_context::decode(llama_batch const&) () from /home/v7508/.unsloth/llama.cpp/build/bin/libllama.so.0
#5 0x00007f7dd0773a7b in llama_decode () from /home/v7508/.unsloth/llama.cpp/build/bin/libllama.so.0
#6 0x00007f7dd0b088c5 in mtmd_helper_decode_image_chunk () from /home/v7508/.unsloth/llama.cpp/build/bin/libmtmd.so.0
## Additional context
Additional context
Root Cause
Unlike text generation (which relies on causal attention), Gemma 4's vision encoding requires non-causal attention across all image tokens (n_ubatch >= n_tokens).
llama-server defaults to a physical micro-batch size of ubatch = 512. Since single-image vision encoding on Gemma 4 produces more than 512 tokens, the GGML assertion fails immediately.
Working Workaround
Adding -ub 2048 -b 2048 to Extra Arguments in the model settings completely resolves the issue, and multimodal inference generates smoothly at ~80 tok/s.
Suggested Fix
Whenever --mmproj is attached (multimodal models), please consider automatically defaulting -ub and -b to at least 2048 when spawning llama-server.
Reacted by あめ and David Karlsson
Activity
marekorok commentedon Sep 9, 2026
thanks @biolord2012-ai ,
am I correct this is web GUI equivalent?
ok, working and not crashing anymore
biolord2012-ai commentedon Sep 9, 2026
Yes, exactly. Unsloth Desktop is essentially the native desktop wrapper (Tauri) for the Unsloth Studio web UI. Both share the exact same backend and inference code under the hood.
And for the troubleshooting test, I entered it into the extra arguments field, in case anyone is interested.
marekorok commentedon Sep 9, 2026
I guess the --batch-size is already default 2048, at least what I see in the field description:
biolord2012-ai commentedon Sep 9, 2026
I keep getting the error whenever I don't use the values that previously helped. I suspect an update changed something, causing the Auto to no longer set the 2048 value, or leading to other issues that would otherwise be resolved by that 2048 setting.
I lack the coding knowledge to dig deep into the files myself, and I’d likely cause more damage if I kept poking around and tinkering; an LLM handled reading the logs and calculating the fix.
Studio: floor the projector batch where the projector actually arrives
Studio: keep the projector floor to the sources recovery can see