Skip to content

[Bug] --fit on prevents loading large MoE models like DeepSeek-V4-Flash on consumer hardware; request for UI control over llama-server flags #7022

Closed

Description

@dan64

Description

I'm encountering a critical issue when trying to load the DeepSeek-V4-Flash-UD-Q2_K_XL GGUF model (~100GB) in Unsloth Studio on my Windows 11 machine with 112GB RAM and an RTX 5070 Ti (16GB VRAM). The model fails to load with the default parameters that Studio currently passes to the underlying llama-server.

System details:

  • OS: Windows 11
  • GPU: NVIDIA RTX 5070 Ti (16GB VRAM)
  • RAM: 112GB
  • Model: unsloth/DeepSeek-V4-Flash-UD-Q2_K_XL (3-bit, ~100GB)

The Problem

Unsloth Studio currently launches llama-server with the following default flags for this model:

-c 4096 --parallel 1 --flash-attn on --no-context-shift --fit on

This configuration fails to load the model entirely. The issue is the --fit on flag.

According to the Studio's own PR #6098, --fit on is designed to auto-tune llama.cpp environment variables specifically for datacenter/professional NVIDIA GPUs (like B200, H100). It sets flags like GGML_CUDA_FORCE_CUBLAS_COMPUTE_32F=1 and GGML_CUDA_P2P=1 to optimize for multi-GPU NVLink setups. As noted in the PR, these optimizations can carry a "real throughput cost" on consumer GeForce cards, which is why they are gated for datacenter GPUs.

On consumer hardware like the RTX 5070 Ti, the --fit on flag attempts to apply datacenter-specific optimizations that are not appropriate. The memory management and layer placement logic it triggers are incompatible with the memory constraints of a consumer GPU with 16GB VRAM when handling a ~100GB MoE model.

The Working Configuration

After extensive testing, I found that the model loads and runs successfully only when replacing --fit on with the following set of flags:

-ngl auto --cpu-moe --no-mmap
  • -ngl auto – Automatically offloads the maximum number of layers that fit into the 16GB VRAM.
  • --cpu-moe – Forces all Mixture-of-Experts (MoE) layers to remain on CPU RAM. This is critical for MoE models like DeepSeek-V4-Flash, as the expert layers are too large to fit in consumer VRAM.
  • --no-mmap – Disables memory mapping, which improves stability on Windows when loading very large GGUF files (~100GB) by avoiding virtual memory fragmentation and file lock issues.

With these flags, I achieved 9.3 tokens/second on this setup.

Feature Request: Granular Control Over llama-server Parameters

The ability to tune llama-server parameters is essential for advanced users, especially those running large MoE models on consumer hardware. While Unsloth Studio supports passing extra arguments via the CLI (unsloth studio run --model ... --cpu-moe --no-mmap -t 16), this workflow forces users to abandon the convenient web UI.

Request: Add a "Custom llama-server Arguments" field or section in the Studio web UI's model settings panel. This would allow users to specify additional flags (e.g., --cpu-moe, --no-mmap, -t, --context-shift, etc.) that are then passed to the llama-server subprocess.

Existing Infrastructure: The backend already supports this via the LoadRequest.llama_extra_args field and has a denylist to prevent users from overriding critical flags like --model, --host, or --port. PR #5271 established this pass-through mechanism, and PR #5815 extended it to honor --ctx-size overrides in Studio's context-fit logic. Extending this same infrastructure to the UI would be a natural and valuable enhancement.

Proposed Solution

  1. Add a text input or key-value interface in the model settings panel (next to context size, parallel requests, etc.).
  2. Allow users to enter additional llama-server flags (e.g., --cpu-moe --no-mmap -t 16).
  3. Apply the same denylist validation already used for CLI pass-through to ensure system stability.
  4. Pass these flags to the llama-server subprocess via the existing llama_extra_args field.

Benefits

  • Power users can optimize performance for specific hardware without leaving the UI.
  • MoE models become loadable on consumer hardware by enabling --cpu-moe directly from the UI.
  • Testing becomes easier: users can A/B test flags like --flash-attn (which, counterintuitively, decreased performance from 9.3 to 7.5 t/s in my tests) to find the best configuration.
  • Documentation: Tooltips or a link to llama-server documentation would help users discover available flags.

Additional Context

  • The model loads successfully with: -ngl auto --cpu-moe --no-mmap -t 16 --context-shift
  • The model fails to load with: --fit on (the current Studio default)
  • DeepSeek-V4-Flash is a Mixture-of-Experts model with 284B total parameters (13B active). MoE models require special handling on consumer GPUs with limited VRAM, which --cpu-moe provides.

Thank you for considering this feature request. I'm happy to provide additional logs or testing if needed.

Activity

  1. MichK-tech commented on Aug 3, 2026

    @MichK-tech

    please add this option

  2. danielhanchen commented on Aug 28, 2026

    @danielhanchen
    Member

    This should be fixed now - sorry on the delay - please update Unsloth Studio to the latest via curl -fsSL https://unsloth.ai/install.sh | sh for Linux, Mac, WSL or irm https://unsloth.ai/install.ps1 | iex for Windows - if it's not fixed yet, it'll be in the next Studio release - if it's still not working after that, please open another issue - appreciate it again!

    Set GPU Memory to Manual and use the GPU Layers and MoE Layers on CPU sliders, or pass --cpu-moe --no-mmap in Extra Arguments, and the flags now reach llama-server rather than being overridden by --fit.

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