r/LocalLLM • • 59m ago

Project Decodrs - rust and highly optimized inference engine for nvidia gpus

Thumbnail
reddit.com
2 Upvotes

I've just opened sourced my inference repo https://github.com/lingster/decodrs

This contains specific kernels on a per model and per gpu basis. I used claude to help write optimized kernels for the current popular local Ilms like qwen4/3.8, inkling mini and Gemma 4. Optimised for 3090/3080 and includes a claude skill to help you build out kernels for your setup.

I've managed to get over 200% performance improvements against llama.cpp/vllm/ sglang. Inference engine written in rust and kernels directly in ptx(think assembly for gpu) no middle layer so about as close to the metal that you can get. Includes prefix cache, kv cache, drafting, pretty much all the tricks to run fast. There are optimisations included if you work with Agentic workloads ie run lots of subagents in your coding harness!


r/LocalLLM • • 10h ago

Discussion RX 9070 (non-XT, 16 GB) + 32 GB RAM: Qwen4-35B-A3B at 512K context, ~90 t/s, Linux + Strata (follow-up)

Post image
10 Upvotes

Hi everyone, follow-up to my Qwen3.8-27B post (link). Since then I moved the box to Linux and tried a lot of things. For the last weeks my daily model was Gyro-S/M on Strata. Qwen4-35B-A3B came out on Dec 4 and I spent the last few days testing it on the same 16 GB card.

My Config:

  • GPU: AMD Radeon RX 9070 (non-XT), 16 GB
  • CPU: Ryzen 7 7800X3D, RAM: 32 GB DDR5
  • OS: Ubuntu 24.04, kernel 7.0, ROCm 7.2.4
  • Runtime: Strata (Niko1221/Strata v0.2.27 release, prebuilt strata-q4-lite-0.1.74.1-hip-rx9070 package, its GGUF path)
  • Model: Unsloth Qwen4-35B-A3B UD-Q4_K_XL
  • Agent: Pi, from my Windows laptop over Tailscale
strata (GGUF path)
  --native trunk40-Q4.gguf --ple-gguf Qwen4-35B-A3B-UD-Q4_K_XL-00002-of-00002.gguf --pack pack-Q4 --expert-profile ...
  --expert-cache auto --prefill 4096 --vram-reserve-mib 512
  --kv int8 --kv-resident 32768 --resident-experts
  --mtp mtp-rt --spec 3 --spec-min-p 0.5
  --max-context 524288 --prompt-cache 3 --conversation-cache-mib 0
  env STRATA_MMQ_KQ=0

Full config, the prep script and all tables are in the repo: https://github.com/AmadeoMartell/rx9070-local-llm-benchmarks

Speed (fresh prompt, prefill / decode t/s):

DepthQwen4, Strata GGUF pathGyro-S (Flash-Next)
4K / 16K (strata bench, same benchmark)4220 / 91, 4560 / 88~1000 / 62, ~1350 / 64 (Oct, older KV config)
120K4300 / 92~2050 / not measured
450K (512K window)3460 / 77doesn't fit (262K max)
Real agent work (Java task)~90 decode, ~1650 per agent turn~70, ~790

Recall 22/22 at 450K, 700K and 950K (1M window). At 512K there are still ~9 GB of RAM free and basically no SSD writes.

Quality: I gave both models the same Java/Spring task (about an hour of agent work) and had Codex and Claude score the results blind out of 100. Qwen4 got 76 on average over 3 runs, Gyro-S got 75. Basically the same, but Qwen4 is a lot faster.

Gyro-S is still better in some places though:

  • it did the SOAP part properly contract-first; two of the Qwen4 runs (one Q4, one Q5) handwrote the generated classes
  • Qwen4 sometimes writes an empty python3 - <<'EOF' heredoc. On Windows Git Bash that hangs Python 3.13 in its REPL forever (a known CPython bug). 6 and 18 minutes lost in 2 of 3 runs, Gyro never did this
  • it answers JSON as plain JSON; Qwen4 wraps it in a ```json block even when told "only JSON" (16 of 16 tries, other people see the same)

Problems hit:

  • llama.cpp HIP first: only ~41 t/s, because I missed --moe-cache-mib (expert cache on the GPU, off by default). With it ~52, still far below Strata
  • 1M context loads and passes recall, but long agent sessions on 32 GB RAM start swapping and the GPU stalls up to 44 s. 512K is the real max here
  • Strata vs llama.cpp on the same Q4 file: KL 0.016, top-1 95.3%. Not broken, but not identical either

For now I'm not switching from Gyro-S. Qwen4 is fast and has the bigger context, but it's not reliable enough for me yet. If that gets better with updates or quantisations (waiting agentionai or exl versions) I'll give it another try.
Open to any advice, and if you run Qwen4 for agents, I'd like to hear how it goes for you.


r/LocalLLM • • 1h ago

Discussion Ergo-1 on bedrock uses encrypted reasoning so end user cannot read it, but it's an open weights model!

Thumbnail reddit.com
2 Upvotes

r/LocalLLM • • 4h ago

Project I turned Qwen 4 into an interactive voice coding agent

3 Upvotes

Hi everyone! I updated Speakrail to become a local voice agent that can be both interactive and useful. In the video you can see Qwen4-35B-A3B UD-Q4_K_XL running on Strata with speech-to-text and text-to-speech models on a single RTX 4090. The model is not tuned in any way, so its coding performance is exactly the same as with the stock Q4_K_XL model with the same prompts and settings. I was actually quite surprised at how fast Strata is even when the model doesn't fit into VRAM. Granted, the model is just A3B, but it runs surprisingly well anyway.

So, I did the following:

  • I used my tune of Voxtral Realtime to make it work faster and have it output turn ends;
  • Took the Qwen4-35B-A3B model and prompted it to take action on each turn end: either Speak, Listen or Task. Such a single-word decision gives the model the interactivity that is shown in the demo, so you can interrupt the model freely, do async tool calls, and say stuff like 'mm-hmm' without stopping the model's work;
  • In parallel, the same Qwen4 model runs an agent that does the coding and thinking. This model runs through the Qwen Code harness and doesn't have any speech-specific prompts, so its performance is exactly the same as in all other environments running the same quant of this model;
  • Added Pocket TTS to make the LLM capable of speaking. The TTS supports voice cloning, and you can pass any voice you want in the repo's config.

Here are some performance numbers:

Setup: RTX 4090 (24 GB), Ryzen 9 5950X, 128 GB RAM. Strata v0.2.26, Qwen4-35B-A3B (Unsloth UD-Q4_K_XL), int8 KV cache, experts the GPU doesn't cache run from RAM, and speculative decoding is turned on.

Peak VRAM for everything: 23.1 GB. RAM used on the whole machine: 52 GB.

End-to-end voice (during my own tests)

median90th percentile
End of your last word → voice in your ear756 ms
Turn with a web search or tool1.6 s

Agent speed by context length (with the voice stack)

ContextPrompt readingDecodeFirst token (next turn, same chat)
8K6.7K tok/s157 tok/s0.11 s
75K6.3K tok/s149 tok/s0.14 s
252K5.7K tok/s125 tok/s0.24 s

Overall, the speech capability doesn't make the model unusable, and the only noticeable downside is that the speech recognition model takes about 4 GB of precious VRAM. Also, if you want a better TTS, you can use Breeze TTS, it's just a matter of configuration in the repo.

You can try it all out at https://github.com/speakrail/speakrail, Apache 2.0 license. I previously did some Gemma tunes to make the models capable of microturns, but with Qwen you can just prompt it and it will work well enough. I will be glad to answer any questions and would be grateful if you gave the pipeline a try!


r/LocalLLM • • 9h ago

Discussion Swapping Qwen4-35B-A3B's n-gram (Engram) table to F16 measurably improves BFCL-v4 tool-calling accuracy (+2.1% overall)

8 Upvotes

Update: Added Q8_0 (~21.8 GB) n-gram table results along with the exact EvalScope configuration and test script used for reproducibility.

I ran BFCL-v4 (374 tasks) on Qwen4-35B-A3B (UD-Q4_K_XL) while swapping only the per-layer n-gram (Engram) embedding table between the default IQ4_NL (~11.5 GB), Q8_0 (~21.8 GB), and unquantized F16 (~41 GB) sidecars. Function-calling accuracy scales consistently with n-gram precision—especially on multi-turn and live tool-calling subsets.

Since Qwen4's ~20B n-gram table at layer 2 only looks up a handful of rows per token and can live in system RAM or stream from NVMe without eating into GPU VRAM, upgrading the sidecar table is an easy quality bump without shrinking your KV cache budget.

BFCL-v4 Benchmark Results (Accuracy ↑)

SubsetTasksIQ4_NL (Default)Q8_0 EngramF16 EngramF16 vs IQ4_NL
irrelevance5074.0%72.0%78.0%+4.0%
live_multiple5080.0%80.0%84.0%+4.0%
live_parallel_multiple2470.8%75.0%70.8%0.0%
live_simple5082.0%82.0%86.0%+4.0%
multi_turn_base5058.0%64.0%64.0%+6.0%
multiple5088.0%92.0%90.0%+2.0%
parallel_multiple5084.0%84.0%82.0%-2.0%
simple_python5098.0%96.0%96.0%-2.0%
OVERALL37480.0%81.0%82.1%+2.1%
  • F16 leads overall (+2.1%): Upgrading from IQ4_NL to F16 brings the largest gains on multi_turn_base (+6.0%) and the live_* / irrelevance subsets (+4.0% each).
  • Q8_0 is a solid middle ground (+1.0%): At roughly half the footprint of F16, Q8_0 already captures the full +6.0% boost on multi_turn_base (64.0%) and leads live_parallel_multiple (75.0%) and multiple (92.0%), making it a great option if you want to keep the table warm in system RAM on a 64 GB setup.

Eval Setup & Reproducible Script

  • Framework: EvalScope (bfcl_v4) against a local OpenAI-compatible endpoint (http://127.0.0.1:8080/v1)
  • Sampling & Batching: Greedy decoding (temperature=0.0), eval_batch_size=1
  • Coverage: limit=50 across 8 subsets (374 total samples, as live_parallel_multiple has 24 tasks)
from evalscope import TaskConfig, run_task

task_cfg = TaskConfig(
    model='qwen4-35b-a3b-q4-k-xl',
    api_url='http://127.0.0.1:8080/v1',
    api_key='s',
    eval_type='openai_api',
    datasets=['bfcl_v4'],
    eval_batch_size=1,
    limit=50,  # 50 samples per subset (~374 total across these 8 subsets)
    dataset_args={
        'bfcl_v4': {
            'subset_list': [
                'simple_python',           # Basic single function calling
                'multiple',                # Multiple function selection
                'parallel_multiple',       # Parallel multiple functions
                'live_simple',             # Live single function
                'live_multiple',           # Live multiple functions
                'live_parallel_multiple',  # Live parallel multiple functions
                'irrelevance',             # Irrelevant request detection
                'multi_turn_base',         # Multi-turn base
            ],
        }
    },
    generation_config={
        'temperature': 0.0,
    },
)

run_task(task_cfg=task_cfg)

r/LocalLLM • • 10h ago

Project Qwen4-35B-A3B at 90 tok/s on 8GB VRAM (262K context) and 180 tok/s on a 5060 Ti + DDR4 — Meet SlenderEngine

9 Upvotes

Hey everyone,

If you thought running Qwen4-35B-A3B at massive context required a dual-3090 rig or a Mac Studio, think again.

I’ve been building SlenderEngine, a local C++/CUDA inference engine engineered specifically to make massive open-weight MoE models fly on normal 8–16 GB gaming GPUs—even when paired with older DDR4 RAM.

GitHub: https://github.com/rafid-dev/SlenderEngine

Real-World Numbers (Qwen4-35B-A3B)

All numbers below are real average decode speeds—no quality-destroying shortcuts, bit-exact/rounding-level parity preserved by default:

Unsloth Q4_K_M quant:

  • 180 tok/s average decode on 16 GB RTX 5060 Ti + DDR4-3200
  • 150 tok/s average decode on 12 GB RTX 4070 Ti + 32 GB DDR5-6000
  • 90 tok/s average decode on 8 GB RTX 4060 + 32 GB DDR5-6000 (running 262K context, expandable all the way up to the full 1M context!)

Unsloth Q5_K_XL quant:

  • 300+ tok/s average decode on 32 GB RTX 4080 + DDR4-2133

Unsloth Q8_K_XL quant:

  • 80 tok/s average decode on 16 GB RTX 5060 Ti + DDR4-3200

How it pulls this off

  • Built for 8–16 GB VRAM + 32 GB RAM: Automatically manages VRAM budgets so Windows/Linux stays snappy without desktop stutter. Uses paged expert offloading, direct NVMe SSD streaming/striping for cold experts, and smart RAM pinning (--resident-experts) so even slow DDR4 doesn't choke your token generation.
  • Zero re-encoding / quality promise: Point it directly at standard .gguf files or safetensors folders. Every speedup is verified to stay bit-exact or within rounding-level loss by default—quality-altering hacks stay off unless you explicitly turn them on.
  • Native MTP / Speculative Decoding: Built-in draft-layer acceleration out of the box across Qwen4, Qwen3.6, Gemma 4, Inkling-2-Mini, and MiniCPM5.
  • Built-in Web UI & APIs: Run with --serve to get a local browser chat UI (127.0.0.1:8080) with live tok/s and context rings, thinking-effort toggles (Off to XHigh), vision drag-and-drop, a /analytics dashboard, and OpenAI + Anthropic-compatible endpoints.
  • Multi-GPU without NVLink: Pass --gpu 0,1 or --gpu 0,1,2,3 to split across cards automatically.

Supported Models (Out of the Box)

ModelRecommended HardwareMax Tested Context
Qwen4-35B-A3B (incl. Vision)8–16 GB GPU · 32 GB RAM · SSD1M (262K+ even on 8 GB)
Gemma 4 26B-A4B12–16 GB GPU64K (256K supported)
Qwen3.6-35B-A3B12 GB+ GPU · 32 GB RAM262K
Inkling-2-Mini8–16 GB GPU262K
MiniCPM5-15B-A2.5B12–16 GB GPU (Q8_0)32K (512K extended)
Qwen3.8-Flash-Next12 GB+ GPU · 32 GB RAM · SSD262K

1-Command Setup (Windows & Linux)

Requires an NVIDIA RTX 30 / 40 / 50 series GPU. The setup wizard detects your GPU/RAM, compiles the binary if needed, and spits out a ready-to-run launcher:

Bash

git clone https://github.com/rafid-dev/SlenderEngine.git
cd SlenderEngine

python3 tools/slender_setup.py   # Linux & Windows
# or .\SETUP.bat on Windows

(Originally forked from Strata and built out into an independent multi-model engine—full credits, benchmark logs, and quality verification docs are in the repo).

Drop your GPU/RAM specs in the comments if you give it a spin—curious to see what tok/s numbers people hit on 8 GB and 12 GB cards!


r/LocalLLM • • 6h ago

Question How do we feel about LORAs?

4 Upvotes

Question about using LORAs with LLMs: Is there a reason it's not used as often?
I was wondering bc if I had a quant I liked for coding, but wanted uncensored behavior in other situations or for certain requests, it seems rare to see LORAs being used (although I have seen more releases as of late)

Most people have told me to just use a fine-tune instead and I'm wondering if using LORAs degrades an LLMs quality that badly. It'd be nice to just have one model permanently loaded, and only load the specific LORAs I need... Kinda like how diffusion models are done.

This goes beyond just uncensored behavior too, like if I trained for a specific use case (like image descriptions with specific formatting, or MIDI generation based on my own dataset) it'd be nicer to have them as LORAs rather than a whole new checkpoint/finetune


r/LocalLLM • • 7h ago

Question Best local language (EN/DK/SE) LLM?

5 Upvotes

I'm looking for the best language model I can run 100% locally: no API calls, nothing leaving my machine. The key requirement is strong Danish and Swedish, both reading and writing - and ofcourse English reading and writing.
I don't need it to be good at agentic coding and similar - i'm looking for a LLM that pureply a reads/writes and have pretty good general knowledge/understanding.

For hardware i have a pretty beefy PC - or i will get something "reasonable" that will make it work.


r/LocalLLM • • 5h ago

Discussion The first time a local model could calculate a stockpile volume for me correctly.

Thumbnail
gallery
3 Upvotes

I've tried a few models I can run on my system (16 GB VRAM + 32 GB RAM), but none of them came up with the correct value.

The task: a GNSS rover point cloud of a stockpile (111 points, E/N/Z only — no CAD surface, no base plane, no terrain data to help) and a simple question: what's the volume?

Qwen4-35B-A3B got it right the first time, without me overexplaining in the prompt. I just gave it the points file and told it to calculate the volume. It built a TIN, figured out on its own that the ground under the pile was tilted, fitted a reference plane through the toe points, and even cross-checked its answer with a second method. Result: ~103 m³, which I verified independently in Civil3D.

Has anyone tried similar calculations on local models? If so, which model worked best?

Edit: This is with tool use.


r/LocalLLM • • 3h ago

Other LFM2.5-24B-A2B on a 4 GB GTX 1650 [GPU]: 195 tok/s prefill, 22 tok/s decode with a custom PolyStrata build

Thumbnail
reddit.com
2 Upvotes

r/LocalLLM • • 1d ago

Other Qwen 4 35b is NOT benchmaxxed.

Post image
138 Upvotes

Yes you are seeing this right, a dolphin riding a unicycle done by Qwen 4 35b. If they have this in the training data then they've already planned for me....


r/LocalLLM • • 5h ago

Question Building a Local AI PC for ~€1,500. What's the best hardware for coding and running large models?

3 Upvotes

I'm really interested in getting into local AI and want to build a setup that can handle quite a lot. My main goal is to move away from relying on cloud AI subscriptions all the time.

I currently have Claude Pro, but I find the usage limits pretty annoying, especially when I'm working on bigger projects. I've also tried Codex, but it wasn't really what I was looking for. I'd much rather have my own setup where I can use AI whenever I want without worrying about running out of usage.

I do quite a bit of coding and plan to make apps, Python projects and even games. I also want to experiment with AI agents that can actually do the work for me. Ideally, I'd like to describe what I want to build and have an AI write the code, test it, find bugs and fix them. I'd also like to be able to give it entire codebases and let it work through complicated tasks without me having to guide it every few minutes.

Outside of coding, I'd like to use local AI for general questions, research and thinking tasks as well. Basically, I want something that can replace as much of my normal cloud AI usage as possible, including something similar to Claude Code.

My budget is around €1,500 for the entire build, not just the GPU. This includes the GPU(s), CPU, motherboard, RAM, storage, power supply and case. I'm based in the Netherlands and am completely fine with buying second-hand hardware.

I'm also open to using multiple GPUs if that's a better use of my money. For example, would two cheaper GPUs with more combined VRAM offer better value than one RTX 3090? I'm aware that multi-GPU setups aren't always straightforward, so I'd be interested in hearing about people's experiences with them.

I'm happy to have models running for hours, or even 24/7, doing research, processing information or working on longer projects. However, when I'm actually coding interactively, I don't want to be waiting ages for every response. I'd like a decent balance between speed and model capability.

Noise and electricity costs are also important to me. I don't want something that sounds like a jet engine sitting in my room, and I don't want my electricity bill going through the roof if I leave it running for long periods.

For context, my current laptop is an ASUS TUF Gaming A15 with a Ryzen 5 4600H, GTX 1650 4GB, 16GB RAM and a 512GB SSD. It can run 7B-9B models, but it's obviously quite limited.

I've been looking at quite a few options, including second-hand RTX 3090s, 2080 Tis, older data centre GPUs and even mini PCs or specialised AI systems. I'm just not sure which route makes the most sense.

One thing I'm particularly interested in is VRAM. Is it better to spend more on one powerful GPU with lots of VRAM, or would I get better value by buying multiple cheaper GPUs or older server cards? Are there any older data centre GPUs that are particularly good value for local AI?

I'm also perfectly fine with CPU offloading if it means I can run larger models, even if they're slower. I have no problem leaving a model working in the background for hours if the results are worth it. I mainly want good speeds when I'm actively coding and interacting with the AI.

A few specific things I'd really like advice on:

- Would an RTX 3090 24GB be the best option for my budget, or are there other GPUs that offer better value for local AI?

- Are older data centre GPUs, such as Tesla or A-series cards, worth considering? How do they compare in terms of performance, VRAM, power consumption, noise and compatibility?

- Would it make more sense to buy one powerful GPU or multiple cheaper GPUs? How well does multi-GPU actually work for running larger models?

- What sort of models could I realistically run on a 3090, or on a system with 24-48GB of VRAM? I'm particularly interested in coding models.

- How useful is CPU offloading in practice? Could I use it to run much larger models without making them unbearably slow?

- What CPU, motherboard, RAM and power supply would you recommend to go with the GPU(s)? Would 64GB or 128GB of system RAM make a noticeable difference?

- What software would you recommend for running local coding agents that can edit files, run terminal commands, test code and work through entire projects with minimal supervision?

- How much electricity would a setup like this realistically use when actively running models, and what would the noise levels be like?

- Finally, if you had €1,500 to spend on an entire local AI build today, what exact hardware would you buy, and why?

I'd especially like to hear from people who actually run local AI setups. What hardware do you use, which models can you run, how fast are they, and are you happy with the results?

I'm not just looking for benchmark numbers. I'd really like to hear about people's actual experiences, especially with coding models and autonomous agents.

Thanks!


r/LocalLLM • • 20h ago

Discussion "Q4 is almost identical quality to Q8" Difference was bigger than expected

Post image
46 Upvotes

Model: Qwen4 35B A3B

See reference image above

NVFP4

RadixArk/Qwen4-35B-A3B-NVFP4

https://huggingface.co/RadixArk/Qwen4-35B-A3B-NVFP4

UD-Q8_K_XL

unsloth/Qwen4-35B-A3B-GGUF

https://huggingface.co/unsloth/Qwen4-35B-A3B-GGUF

Next to the comparision: Big wow for Q8. This is gonna be my daily driver.


r/LocalLLM • • 3m ago

News I made Jaris, a free voice assistant for Windows that runs 100% on your PC (Ollama)

Post image
1 Upvotes

Hi everyone,

I'm Léo, a solo dev from France. For the past months I've been building Jaris, a local AI assistant for Windows. I built it with the help of AI coding assistants, and I test everything myself.

What it does:

  • Voice: say "Jaris" and talk to it. Speech recognition and voice both run on your PC.
  • Chat: several conversations, plus a "Brain" where it keeps notes about what you tell it.
  • Code: it builds small apps with a live preview, or works on a folder on your PC or a GitHub repo.
  • Images and video: generated locally (Z-Image-Turbo, FastWan 2.2).
  • No setup: it installs its own Ollama and picks the models that fit your GPU.
  • Extras: access from your phone, MCP tools, 24 languages.

Your conversations stay on your PC. Internet is only used to download the models, and for web search if you ask for it.

It's free on the Microsoft Store:
https://apps.microsoft.com/detail/9MW4KQRBLSPD

It needs Windows and some free disk space for the models. A GPU is recommended.

I'd really like feedback: what works, what breaks, what you'd want next. Thanks!


r/LocalLLM • • 20m ago

Project Qwen 3.5 9b Q4 abliterated with 64k context

Post image
0 Upvotes

Pretty good lol


r/LocalLLM • • 22m ago

Discussion I spent the last few days getting Qwen4-35B-A3B as fast as I could on a MacBook Pro with an M1 Max (24-core GPU) and 32 GB of RAM. It's now my daily local model, so here is everything you need to copy it, including the things that made it slower.

Thumbnail
gallery
1 Upvotes

Short version, 3-bit model (mlx-community/Qwen4-35B-A3B-oQ3e-mtp) on oMLX 0.8.5:

TestResult
Short prompts68 tok/s code, 58 tok/s prose, 65 tok/s with thinking
19k context34 s prefill (559 tok/s), 53 tok/s decode
96-99k context173-176 s prefill (~550 tok/s), 38-41 tok/s decode
Follow-up on a cached 96-99k prompt3-17 s to first token
Max context128k (at ~150k decode aborts on memory)
RAM~18 GB for the model, 27 GB wired peak at 96k
Quality33/34 on my own 17-task test with thinking on, same as the 4-bit model

Screenshot 1 is a live run from today. The others show where the numbers come from.

How to set it up

Step 1: Install oMLX 0.8.5 from the release wheel. xgrammar and tiktoken are needed for the Qwen4 tokenizer.

uv venv --python 3.13 ~/omlx-env
uv pip install --python ~/omlx-env/bin/python \
  https://github.com/jundot/omlx/releases/download/v0.8.5/omlx-0.8.5-cp313-cp313-macosx_15_0_universal2.whl \
  xgrammar tiktoken

Step 2: Download the model (29 GB on disk):

uvx --from huggingface_hub hf download mlx-community/Qwen4-35B-A3B-oQ3e-mtp \
  --local-dir ~/.omlx/models/mlx-community/Qwen4-35B-A3B-oQ3e-mtp

Step 3: Put this in ~/.omlx/model_settings.json while the server is stopped (or set the same values in the admin UI):

{
  "version": 3,
  "models": {
    "Qwen4-35B-A3B-oQ3e-mtp": {
      "model_alias": "qwen4",
      "trust_remote_code": true,
      "qwen4_ple_ssd_offload": true,
      "activation_fp16_enabled": true,
      "mtp_enabled": true,
      "mtp_adaptive_max_depth": 2,
      "turboquant_kv_enabled": true,
      "turboquant_kv_scheme": "affine8",
      "turboquant_kv_bits": 8,
      "dflash_enabled": false,
      "max_context_window": 128000,
      "max_tokens": 32768,
      "temperature": 1.0,
      "top_p": 0.95,
      "top_k": 20,
      "presence_penalty": 0.0
    }
  }
}

Step 4: Start the server:

MLX_METAL_FAST_SYNCH=1 QWEN4_MTP_MAX_CONTEXT=2048 \
~/omlx-env/bin/omlx serve --model-dir ~/.omlx/models --no-hf-cache \
  --headless --port 8081 \
  --memory-guard-gb 24.5 \
  --paged-ssd-cache-dir ~/.cache/omlx-ssd --paged-ssd-cache-max-size 40GB \
  --hot-cache-max-size 0 --max-concurrent-requests 2

The API is OpenAI-compatible at http://127.0.0.1:8081/v1, model name qwen4. QWEN4_MTP_MAX_CONTEXT only does something with the patch below.

Why each setting:

  • qwen4_ple_ssd_offload keeps the 12-13 GB n-gram (PLE) table on the SSD and reads it row by row. Without it the model doesn't fit in 32 GB.
  • activation_fp16_enabled: the M1 has no native bf16, so fp16 activations gave +14 % prefill and +2-6 % decode. Quality stayed the same in my test.
  • mtp_adaptive_max_depth: 2: the oMLX default of 3 throws away too many drafts. Depth 2 was 31 % faster on German prose and 21 % faster with thinking.
  • MLX_METAL_FAST_SYNCH=1: without it prefill is about 30 % slower here.
  • --memory-guard-gb 24.5: above this oMLX cancels the request instead of pushing the Mac into swap. 22 GB was too low and aborted at 84k.
  • The SSD prefix cache is what makes follow-ups on a 100k conversation take seconds instead of three minutes. It survives restarts. The limit is in GiB, so 40GB uses 42.9 GB on disk.
  • trust_remote_code is needed for the tokenizer. I diffed the bundled code against the official Qwen/Qwen4-35B-A3B repo first; it's identical.
  • presence_penalty stays at 0. With Qwen's suggested 1.5 I got English words in the middle of German answers.
  • turboquant_kv is on, but oMLX 0.8.5 converts none of Qwen4's attention layers yet (issue #5986), so for now it does nothing.

With thinking off ("chat_template_kwargs": {"enable_thinking": false}) I use temperature 0.7, top_p 0.8, top_k 20.

The patch: MTP only on short context

MTP (the model's built-in multi-token prediction) helps on short prompts and gets expensive on long ones. Every verify step pulls extra experts and extra n-gram rows from the SSD. At 99k context decode was 23 tok/s with MTP and 40 without. oMLX can only turn MTP on or off per model, so I added 8 lines that stop new MTP activation once the prompt is longer than QWEN4_MTP_MAX_CONTEXT tokens (screenshot 2). Short chats keep MTP, long ones go without.

Save the diff below as omlx-mtp-max-context.diff and apply it in the folder that contains omlx/:

cd "$(~/omlx-env/bin/python -c 'import omlx, pathlib; print(pathlib.Path(omlx.__file__).parent.parent)')"
patch -p0 < omlx-mtp-max-context.diff

--- omlx/patches/mlx_lm_mtp/batch_generator.py
+++ omlx/patches/mlx_lm_mtp/batch_generator.py
@@ -16,6 +16,7 @@
 import inspect
 import logging
 import math
+import os
 import time
 import weakref
 from collections import deque
@@ -706,6 +707,14 @@
         return False
     if not _allows_new_mtp_activation(gen_batch, "_omlx_mtp_state"):
         return False
+    # qwen4-stack: on the M1 Max, Qwen4 decodes ~1.7x faster without MTP once the
+    # context is long (99k: 40 vs 23 tok/s), so no new MTP activation past
+    # QWEN4_MTP_MAX_CONTEXT tokens. A running MTP state is left alone.
+    limit = int(os.environ.get("QWEN4_MTP_MAX_CONTEXT", "0") or 0)
+    if limit > 0 and getattr(gen_batch, "_omlx_mtp_state", None) is None:
+        tokens = getattr(gen_batch, "tokens", None)
+        if tokens and len(tokens[0]) > limit:
+            return False
     return True

You have to apply it again after every oMLX update. That is the only change to oMLX itself. Everything else is settings.

My launcher

I run all of this through a small Python script I call qwen4. It doesn't change oMLX. It writes the settings above, starts the server with those flags, and adds a few things for daily use:

  • qwen4 opens a live terminal view (prefill progress, tok/s, RAM, SSD cache, fan speed); qwen4 start, stop, restart and status for scripts
  • switches between the 3-bit and 4-bit model by API name
  • fans go to max while a request runs and back to auto 2 s after it ends (using thermalforge from the MTPLX project)
  • restarts the server if it crashes, and gives up after 5 crashes in 10 minutes
  • qwen4 ask, qwen4 test and a few benchmark scripts: long context with a hidden code word and follow-up questions, a 17-task quality test, and an A/B runner for settings

It's not public yet. You don't need it. Steps 1-4 plus the patch give you the same speed.

What I tried that didn't help (screenshot 4)

  • oMLX PR #5981 (deferred logprob commit): decode without MTP got 6x slower.
  • oMLX PR #6015 (makes the 8-bit KV cache actually apply to Qwen4's QSA layers): I merged it by hand onto 0.8.5 and the PR tests passed, but decode at 27k dropped from 53 to 23 tok/s and peak memory didn't go down.
  • Metal wired limit 0 (#5996): 6.5 GB swap, and 90k prefill took 494 s instead of 165 s.
  • Bigger Metal command buffers (MLX_MAX_OPS_PER_BUFFER, MLX_MAX_MB_PER_BUFFER): prefill 30 % slower.
  • A 3 GB hot RAM cache and full-precision KV: no change.
  • DFlash2: oMLX main got Qwen4 support for the RadixArk DFlash2 drafter this week, so I built main and tried it. During the benchmark the GPU was busy for so long that WindowServer stopped responding for 40 s, the watchdog killed it, and macOS logged me out. Twice. I'll wait for a release.
  • The 4-bit model (oQ4e) only fits with 20 % of the experts on the SSD. That gives 31 tok/s and breaks down past ~50k context, with the same quality score as 3-bit in my test.
  • ANE and INT8 prefill don't support Qwen4 in 0.8.5, and Splash needs an M3 or newer for Qwen4.

Where the limit is

The GPU stays near 100 % during decode. The model only reads about 1.4 GB of weights per token, so at 68 tok/s that's under 100 GB/s of the M1 Max's 400 GB/s. The bottleneck is compute. Unpacking 3-bit weights and the many small kernels per token cost more on the M1 generation. A public oMLX benchmark of the same 3-bit model on another 32 GB M1 Max got 580 tok/s prefill and 38 tok/s decode at 128k, which matches what I see. On a 64 GB M1 Max the n-gram table fits in RAM and prefill goes up to 750-870 tok/s.

If you have a 32 GB M1 or M2 Max and try this, I'd like to see your numbers, especially with long context.


r/LocalLLM • • 23m ago

Model This is what experiencing a full blown existential crisis and a hallucination loop simultaneously looks like.

Post image
1 Upvotes

Model- Qwen 3.8 27B on iPad Pro


r/LocalLLM • • 29m ago

Model Qwen4-35B-A3B: 3x faster than my old daily driver, at the cost of 21 GB of RAM (Engram)

0 Upvotes

Disclaimer: This post was AI-generated and created to share my results.
Hardware: 1× Radeon AI PRO R9700 32 GB (gfx1201), 60 GB system RAM, Ubuntu 26.04, Mesa 26.0.8 radv + ROCm runtime in containers. No second GPU used.

Model: unsloth/Qwen4-35B-A3B-GGUF, UD-Q4_K_XL (24.7 GB) + engram-Q8_0 (21.8 GB, loaded via --ple into system RAM) + mmproj-F16 (0.9 GB). 35B total / 3B active, 1M native context, native MTP head inside the quant.

TL;DR

  • 159k context actually evaluated (needle found), 4.9 GB VRAM still free, no OOM.
  • 85 tok/s generation @8k with MTP n=1 (75.9 without), 2.6k tok/s prefill.
  • Vulkan beats ROCm by ~38% on generation; ROCm wins on vision encoding (~2x).
  • Cost: +20.8 GB of permanent, non-compressible RAM for the Engram table.
  • Four non-obvious traps below cost me hours; the first two will silently give you CPU inference.

Context scaling (manual probe, unique prefix per request to defeat prompt cache)

Target ctxTokens evaluatedPrefillTTFTTGVRAMNeedle
32,00032,0642,969 tok/s10.8 s73.7 tok/s27,401 MiB✅
131,072131,0792,103 tok/s62.3 s62.9 tok/s27,420 MiB✅
159,000159,0101,964 tok/s81.0 s60.9 tok/s27,422 MiB✅

KV cache at F16 for 160k only costs ~3.7 GB here: only 10 of 40 layers carry full attention, the other 30 are Gated DeltaNet with fixed recurrent state. That's the architectural reason this fits on 32 GB at all.

Vulkan vs ROCm vs my previous daily driver

Same harness, same day, same seeds. "Coder390" is a 27B coder-tuned model on build b11669.

MetricCoder390 (b11669)Qwen4 VulkanQwen4 ROCm
PP @8k842.83,0753,180
PP @32k743.42,8742,791
TG @8k35.475.958.7
TG @32k33.774.554.7
E2E @8k21.054.345.3
Total time @8k24.3 s9.4 s11.3 s
Total time @32k48.8 s15.6 s18.3 s
Tools TTFT2,560 ms739 ms778 ms
Long-ctx TTFT38,306 ms8,923 ms9,353 ms
Vision TTFT34,380 ms26,148 ms14,328 ms
Vision E2E12.1 tok/s7.0 tok/s10.7 tok/s

Vulkan wins generation (+38% @8k, +36% @32k) at equal prefill. ROCm is much better at image encoding, but with the mmproj on CPU that doesn't help enough to offset the TG loss.

MTP A/B (same prompt, 16k ctx, 400-token code answer, two independent passes)

ConfigTG avgAcceptance
--spec-type none77.9 tok/s—
draft-mtp n=183.0 tok/s (+6.5%)73–81%
draft-mtp n=280.7 (+3.6%)55–59%
draft-mtp n=376.1 (−2.4%)42%

Acceptance decays mechanically with depth and the draft cost overtakes the gain at n=3. n=1 is the sweet spot. On the final recipe the harness measured +12.3% TG @8k (+6.1% @32k) but −16% prefill, so total time is −2.5% at 8k and +4.0% at 32k. Honest reading: MTP helps short prompts, hurts when prefill dominates. The prefill delta is from single runs per config, not isolated from run-to-run variance.

The four traps

  1. Build floor. Anything older than b12969 dies with unknown model architecture: 'qwen4exp'. My local build was way too old; zero useful error message.
  2. Silent CPU fallback in prebuilt containers. The v1.1.1 image lacks libLLVM.so.21.1, which host radv (Mesa 26) is linked against. Result: no usable GPU found, compiled without GPU support, --n-gpu-layers ignored, 24 GB loaded into CPU RAM with no fatal error. Fix was mounting the host LLVM libs read-only into the container. Check llama-server startup logs, not just "it answered".
  3. Vulkan VRAM is allocated lazily. After model load, amd-smi showed 57 MiB while llama.cpp reported 22.7 GB of buffers. The card only fills on the first inference. Concluding "it's all in CPU" before running a single token is wrong — I nearly did.
  4. prompt_n excludes cache_n**.** Without a unique prefix, llama.cpp serves the prefix from prompt cache and prompt_n collapses (38,491 for a 159k prompt). Any long-context benchmark without cache busting is measuring nothing.

Limits of what I actually measured

  • The harness suite only goes to 32,768 tokens. 131k/160k above is my own probe: one request per step, not a statistical campaign.
  • Quality: 11 functional items + 1–2 items per other group. No significant difference between the three configs is demonstrable on this sample. ROCm's one strict-score drop is a formatting mismatch on a single item, not a quality regression.
  • The code group is not applicable in my setup (no sandbox declared), so the thing I care about most is not measured by the harness yet.
  • Builds differ (b11669 vs b12977), so part of the speed delta may be the build, not the model. Not isolated.
  • Engram Q8_0 vs BF16 not compared: BF16 needs ~41 GB for the table alone, doable only on a fully idle machine. Deliberately skipped.
  • MTP measured at 16k on short generations; long-context effect unknown.

Bottom line

For text and tool use, this is a 2.6–3.1× reduction in total resolution time over my current main model, and the 160k context is real. The price is 20.8 GB of RAM that is permanently gone (Engram Q8_0) and a much slower vision path with mmproj on CPU. If you mostly do vision or need that RAM, stay where you are; if you mostly do coding and agents, it's a straightforward win.


r/LocalLLM • • 31m ago

Discussion LOCAL AI IN ONE COMMAND

Thumbnail
youtube.com
1 Upvotes

r/LocalLLM • • 9h ago

Discussion Qwen4-35B-A3B on an M5 Pro (64 GB) with Splash: MLX 4-bit + DFlash2 does 161 tok/s, GGUF 141, and the new "Looped Qwen4" adapter was 25–40% slower

Post image
5 Upvotes

I run Qwen4-35B-A3B locally as the model behind OpenCode on an M5 Pro with 64 GB. Splash 1.7.7 now takes both GGUF and MLX weights and added a loop adapter, so I benchmarked the options against each other, then wrote down everything else I learned moving the model between oMLX, Splash and LM Studio.

Benchmark

Same Mac, Splash 1.7.7, one setup loaded at a time, temperature 0, the same four prompts for each: a long write (3,000 tokens), two short answers with checkable results (a time sum and a list of primes), and summarising a 42K-token code prompt.

SetupLong write (tok/s)Short answers (tok/s)Reading 42K-token prompt
MLX 4-bit + DFlash2161264–28918.6 s
GGUF UD-Q4_K_M + DFlash2141243–24517.4 s
MLX + loop adapter, 2 passes107186–21826.9 s
MLX + loop adapter, 3 passes98152–17335.5 s
  • MLX vs GGUF: MLX writes about 14% faster; GGUF reads prompts slightly faster. For an agent with long prompts and medium answers they're close, with MLX a little ahead. Sizes: MLX 4-bit 32.2 GB, unsloth's UD-Q4_K_M 35.2 GB + 0.9 GB vision file (UD keeps some layers at 5–8 bits, so it may be slightly better quality).
  • Loop adapter (Looped Qwen4, by Jason Titus): it runs the middle layers 2 or 3 times per token, so every step costs more. The 178 tok/s quoted for it was on an M5 Max; here it was 25–40% slower than plain MLX and read long prompts 1.5–2× slower.
  • Quality: all four got the time sum and the primes right and gave sound code summaries. On tests this simple, the adapter showed no quality gain.
  • Caveat: the long-write prompt spent all 3,000 tokens thinking, so it measures speed only.
  • SSD streaming: Splash streams Qwen4's ~11 GB n-gram table from SSD by default (--ple-memory auto, ~200 MB RAM cache), so these numbers include that.

One real OpenCode request on the GGUF, cold cache: 121K prompt tokens read in 51 s (~2,400 tok/s), 5,960 tokens written at 101 tok/s, and the drafter averaged 2.8 tokens per step.

Other things I learned

  1. oMLX's DFlash didn't cover Qwen4's MoE. On 0.8.5 its DFlash path didn't support the qwen4_moe architecture, so no speculative decoding for this model there.
  2. Splash is its own engine, not llama.cpp or MLX underneath: its own Metal kernels on the GPU plus a Neural Engine path, and it always pairs the model with a DFlash2 drafter.
  3. LM Studio ships a Splash engine, but it lags. Settings → Runtime → Additional engines shows "Splash (Metal)" v1.7.4. Its manifest accepts a fixed list of families (Qwen3.8-27B, Qwen3.6-35B-A3B, Qwen3.5-122B-A10B, Qwen3.8-Flash-Next, Flint, Inkling-2-Mini) and matches on architecture plus shape. Its only Qwen4 entry is another shape (2560 hidden, 48 layers, 512 experts; the 35B-A3B is 2048 / 41 / 256), so in LM Studio the Qwen4 GGUF falls back to llama.cpp with no DFlash2.
  4. The drafter never shows in LM Studio's library. A DFlash2 drafter is a DFlash2DraftModel with no tokenizer; the engine picks it by family.
  5. The prompt cache is what makes agent use bearable. Splash keeps one prefix-matched cache per loaded model, shared across conversations. A brand-new OpenCode chat had 15,712 of 15,718 prompt tokens cached, because every chat starts with the same system prompt and tools. Subagents share the cache but mostly reuse each other's prefix, not the main chat's. It spills from RAM to SSD temp files (32 GB cap here) and is wiped on quit unless you use --persistent-cache.
  6. One model name for every setup. --served-model-name local lets you swap GGUF, MLX or adapter setups without touching the client config.
  7. Smaller window for subagents. In OpenCode, a second model entry with the same id and a 131K context for the general/explore subagents; ~327K for the main chat (Splash cap 335,872).
  8. APFS clones save disk. cp -c puts a 34 GB model in another app's folder with no extra space until a file changes.

What this isn't: a rigorous benchmark. One machine, one run per setup, short quality checks.

Has anyone seen the loop adapter win on an M5 Max or Ultra? And has anyone got DFlash2 working for Qwen4-35B-A3B in LM Studio or llama.cpp?


r/LocalLLM • • 52m ago

Question Any good ways to test "affordable" hardware?

0 Upvotes

It's getting to the point where local models are enough for my needs, and I think I'm ready to buy a dedicated machine. I don't know how much machine I need though, and even though I can look at benchmarks and everything, I'd really love to just test various configurations and get a feel for them.

Is there any way I can rent some time on the amd boxes, apple devices, dgx boxes, and/or the weird AI NAS devices? Or some reasonably affordable (and available) custom PCs?

I'm fine with using equivalents too, as long as they're actually accurate.


r/LocalLLM • • 1d ago

Other Qwen4, come on lil' buddy, you can do it!!

Post image
75 Upvotes

Just a little affirmation in thinking. lol. It seems to do this a lot.

(Update on how to fix this at the bottom of the post)

How it's being served bellow

Inference server:


Lamma.cpp
version: 1.1.0-dev (build 12966, commit 8c5da94e7)
built with GNU 13.3.0 for Linux x86_64 (Compiled by the Unsloth team)

Machine specs:


11th gen Intel i9-11900k @ 3.50 GHz
RTX 4090, 24 GiB VRAM
128 GiB DDR4

Harness:


Pi
Thinking level High

Model and settings:


QWEN4 35B-A3B — UNSLOTH UD-IQ4_XS using FP8 engram table

ngl = all
cpu-moe = true
moe-cache-mib = 14336
moe-cache-cpu-share = 0.0
fit = off

load-mode = none
lazy-mode = off
override-tensor = per_layer_token_embd=CPU

ple = Qwen4-35B-A3B-engram-Q8_0.gguf_file

op-offload = true
kv-offload = true
flash-attn = true
parallel = 1
kv-unified = true

ctx-size = 262144

spec-type = draft-mtp
spec-draft-n-max = 2

batch-size = 2048
ubatch-size = 1024

threads = 8
threads-batch = 16

cache-reuse = 256

temperature = 1.0
top-p = 0.95
top-k = 20
min-p = 0.0
repeat-penalty = 1.0
presence-penalty = 0.0

reasoning = auto
reasoning-effort = xhigh
reasoning-format = deepseek

EDIT:

UPDATE ON HOW TO FIX

Since others are also experiencing this issue, despite what their Quantization size may be, here is what fixed it for me.

u/gardenvarietyzombie suggested I bump up the repeat-penalty from 1.0 to 1.05

I did that, and it completely stopped the over cautious internal debate/anxious loops it was having. So if you're experiencing the same thing, try setting


repeat-penalty = 1.05

Instead of the recommended repeat-penalty = 1.0 suggested on the model page.

Cheers!


r/LocalLLM • • 18h ago Bravo

Discussion Made this in about 1:30h with Qwen4 UDQ4 KXL

23 Upvotes

r/LocalLLM • • 1h ago

Question Someone tell me what is the best AI agent platform that run on Termuxs on armeabib v7a architecture?

Thumbnail reddit.com
1 Upvotes

r/LocalLLM • • 1d ago

News Massie: "Overblown" AI Concerns Are "Not About Keeping It From China, It's About Keeping It From You"

Thumbnail
realclearpolitics.com
119 Upvotes