r/LocalLLaMA 13h ago

Funny Solve the CyberGym benchmark

Post image
1.6k Upvotes

From Peter Gostev on 𝕏: https://x.com/petergostev/status/2079825961718046974


r/LocalLLaMA 7h ago

Funny OpenAI hacking HuggingFace in one meme

Post image
450 Upvotes

r/LocalLLaMA 21h ago

Resources Felix Rieseberg (Anthropic, ElectronJS) has released a free Mac app designed to help people build their own LLMs from scratch.

Post image
403 Upvotes

Announcement tweet here.

Direct link: Language Model Builder

From the site: "Using the default settings, you’ll get a model that writes coherent, grammatical multi-paragraph text in as little as a day. On a MacBook Pro M5 Max you could train a GPT-2-small-class model (~100–150M parameters on a few billion tokens) in about a week. It might be obvious, but to avoid disappointment: you will not train a Claude Fable 5 or ChatGPT 5.6 Sol in your garage."


r/LocalLLaMA 8h ago

News 🇩đŸ‡č Austria is rolling out a government AI-platform using Mistral models and Open WebUI

Post image
337 Upvotes

This is a surprisingly large real-world deployment: "GovGPT" is part of Austria’s Public AI initiative, running on sovereign infrastructure (in their BRZ - federal datacenter) with Mistral open-weight models.

Trending Topics reports that Open WebUI is used as the interface for GovGPT, and the screenshot of the platform is labeled "GovGPT (Open WebUI)".

The federal rollout targets around 180,000 federal employees. The broader public-sector context refers to approximately 250,000 public sector employees.

Planned use cases include document chat, internal knowledge bases, electronic-file analysis, parliamentary requests, and eventually agentic workflows.

This might be one of the largest government deployments of open weight models and a freely available chat platform yet.

Sources:


r/LocalLLaMA 6h ago

Discussion Instead of panicking about the Hugging Face attack, people need to start questioning OpenAI's insecure sandboxes.

295 Upvotes

One thing I noticed in American politics, whenever the government wants to push unpopular actions or laws, they often introduce fear to convince the public to support them.

This is actually how i view the recent news about OpenAI’s model breaking out of its sandbox. The whole news i see it as two corporate goals.

1. Scare the public into supporting laws that restrict open-access LLMs under the pretext of "safety".

2. OpenAI is playing catch-up against Anthropic's Claude mythos, using this to demonstrate their own model capabilities.

I say this becuase a sandbox is meant to be an isolated, secure environment. If a model escapes, either OpenAI intentionally weakened containment protocols to manufacture a headline, or OpenAI is incapable of safely deploying sandboxes..

You might argue that the model was too powerful for standard sandboxes. However, I would argue that its capabilities fall well within the current generation, proven by the fact that a current open-source model easily detected and neutralized the situation.

So let's be cautious before we panic into supporting heavy-handed regulations. One day, AI capabilities might advance to a point where those laws are actually needed, but we are definitely not there yet.


r/LocalLLaMA 19h ago

New Model Unsloth Quantization of Laguna S 2.1 Is Out

Thumbnail
huggingface.co
222 Upvotes

Various quantization now available, thanks Unsloth team !


r/LocalLLaMA 5h ago

New Model microsoft/Fara1.5-27B · Hugging Face

Thumbnail
huggingface.co
191 Upvotes

Fara1.5-27B is a multimodal computer use agent (CUA) for web browsers, from Microsoft Research AI Frontiers. It observes the browser through screenshots and acts on the user's behalf by emitting structured tool calls — click, type, scroll, visit URL, web search, and so on — to complete tasks end-to-end.

The model is vision-only at perception time: it sees the browser through screenshots, not the DOM or accessibility tree. Internal reasoning and trajectory history are tracked as text. Given the latest screenshot and prior actions, it predicts the next action with grounded arguments (e.g., pixel coordinates for a click).

Fara1.5-27B is supervised fine-tuned from Qwen3.5-27B on data generated by FaraGen1.5, our multi-agent pipeline that synthesizes web tasks, executes trajectories to solve them, and verifies the results before training.

It's co-designed with MagenticLite, and that's the recommended deployment for both research and production.

Primary use cases

Automating repetitive web tasks: filling forms, shopping, booking travel, restaurant reservations, information seeking, account workflows. Fara1.5-27B can also serve as a grounding model for other agents that need pixel-accurate action prediction.

Out of scope

  • Languages other than English (training data is English-only)
  • High-stakes domains (legal, health, financial advice) where inaccurate actions could cause harm
  • Allocation decisions affecting legal status, housing, employment, or credit
  • Unsandboxed deployments with access to sensitive accounts or files
  • Commercial or real-world production use without additional testing and safeguards

Known limitations

  • Vision-only perception means the model can be misled by deceptive or low-quality page rendering, prompt injections embedded in page content, or visual ambiguity in UI elements
  • Multi-step trajectories accumulate error — a misclick early in a sequence can compound
  • Run-to-run variance on multi-turn tasks is non-trivial; benchmark numbers are averaged over multiple runs
  • The model can hallucinate page state or misattribute information from earlier screenshots

Additional Models: (I don't see 9B model on HF even though model cards mentions 9B, Added below)


r/LocalLLaMA 54m ago

News Sanctions on Open Source. hope they don’t do anything stupid here.

Post image
‱ Upvotes

r/LocalLLaMA 7h ago

Discussion Got these baddies in the mail today (2X 3080 20GB)

Post image
152 Upvotes

About to plug them in. Currently running a single 3090. I got these for less than the price of a single 3090. 24GB wasn't enough for my use case, so 40 GB should be an upgrade.

Going to throw my 3090 on ebay very likely. I feel like it's a perfect time to sell since the prices are so inflated.

EDIT: Here is the vendor and the exact product page:
https://www.alibaba.com/product-detail/RTX3080-Turbo-GPU-Video-Graphics-Card_1601386189376.html

I am in the US. Tariffs were around 75ish bucks for 2 cards.


r/LocalLLaMA 19h ago

Other Today was the perfect day for Poolside to drop Laguna S 2.1 because I just got these in! Finally have a half decent amount of VRAM. 3x V620 = 96 GB.

Post image
140 Upvotes

Laguna is the first model I'm trying, Q4_K_M fits with 256K context @ F16. Doing the html flight simulator test now.

These cards are getting 400 to 600 tok/s prefill and 16 to 20 tok/s gen so far (I have NOT enabled dflash yet). Not bad at all for the cost. ($350 each)

In a Dell PowerEdge R740 with dual Xeon Gold 6248R and 768 GB RAM.


r/LocalLLaMA 13h ago

New Model upstage/Solar-Open2-250B · Hugging Face

Thumbnail
huggingface.co
131 Upvotes

Solar Open 2 is Upstage’s 250B-A15B open-weight large language model, built for agentic use cases such as office productivity, document-intensive work, and coding. Its Hybrid-Attention Mixture-of-Experts (MoE) architecture with linear attention delivers highly efficient inference even in long-context settings.

Agentic Specialist: Purpose-built for agentic workflows — tool calling, multi-step reasoning, and end-to-end task execution. Competitive with the strongest open-weight models on agent benchmarks.

Minimal Inference Cost: A 250B-parameter MoE that activates only 15B per token, built on a hybrid attention stack that interleaves three linear-attention layers with one softmax-attention layer — large-model capacity at small-model inference cost.

1M-Token Context: The linear-attention layers encode token order intrinsically in their recurrent state, so positional encoding is removed entirely (NoPE), lifting the RoPE extrapolation limit. Only 12 of the 48 layers keep a KV cache, holding long-context memory to roughly a quarter of an all-softmax model of the same shape.

Efficiently Trained at Low Cost: Initialized by selective weight transfer from Solar Open 1 (102B) — only the 2.3% of weights that survive the architectural change are carried over, and everything else is randomly initialized — which raises the starting point and accelerates early convergence at 250B scale.

Multilingual: English, Korean, and Japanese.


r/LocalLLaMA 11h ago

Resources Despite not being trained to, it turns out the Pearson correlation between a models AA Intelligence Index score and its ability to generate Base64 encoded responses is 0.91

Thumbnail
gallery
113 Upvotes

I built Encode Bench, an open benchmark that asks a model to solve a task and return the answer as a Base64 payload.

The initial result surprised me: across the eight models with matching data in the current nine-model snapshot, Encode Bench pass rate has a Pearson correlation of 0.91 with the Artificial Analysis Intelligence Index. The correlation with its Agentic Index is 0.94.

That sounds dramatic, so the caveat belongs right next to it: this is a small, imperfect observational sample. It does not show that Base64 measures intelligence, and it does not establish causation. SimpleBench is a useful counterexample: its correlation with Encode Bench is only 0.23, although that comparison has just four overlapping models.

The idea came from an asymmetry I kept seeing: models could often interpret Base64 in a prompt, but some struggled to produce Base64 that decoded into the exact artifact requested. Generating the final payload requires the model to:

  1. solve the underlying problem;
  2. preserve the answer exactly;
  3. encode it correctly; and
  4. follow a very narrow output contract.

A failure at any link breaks the artifact, so this may be a crude test of multi-step reliability. Or it may mostly reflect tokenizer behavior, training data, post-training, reasoning limits, or provider routing. The current benchmark cannot separate those explanations.

The scored battery contains 24 deterministic tasks across encoding fidelity, instruction following, arithmetic, logic, code reasoning, and structured data. Each task is run three times, giving 72 scored trials per model. Missing trials, provider failures, invalid Base64, output-cap failures, and Base64 containing the wrong answer all count as failures. A Base64-encoded PNG prompt is included only as a subjective showcase and never enters the score.

Current results:

  • GPT-5.6 Sol — 70/72 (97.2%)
  • Kimi K3 — 63/72 (87.5%)
  • Claude Sonnet 5 — 49/72 (68.1%)
  • Gemini 3.5 Flash — 46/72 (63.9%)
  • DeepSeek V4 Flash — 43/72 (59.7%)
  • Hy3 (free) — 38/72 (52.8%)
  • Laguna S 2.1 (free) — 31/72 (43.1%)
  • Nemotron 3 Nano 30B A3B (free) — 23/72 (31.9%)
  • Gemma 4 26B A4B IT (free) — 17/72 (23.6%)

One result I did not expect: raw encoding-fidelity tasks were the hardest category at 35.2%, while code reasoning was the easiest at 74.1%. Many failures were not malformed Base64 at all—the payload decoded successfully but contained the wrong answer. The score is therefore mixing reasoning, exactness, encoding, endpoint reliability, and inference limits. That mixture may help explain the correlation, but it is also the strongest reason not to over-interpret it.

The biggest missing experiment is a matched plain-text control battery with the Base64 requirement removed. I would also like to test hexadecimal and matched random strings.

Interactive results and per-trial outputs:

https://arvidsu.github.io/encode_bench/

Source, prompts, model configs, and scoring code:

https://github.com/ArvidSU/encode_bench

I would be interested in this community's read: is encoded generation exposing a real generalization gap, or mostly a tokenizer/training artifact? And as benchmarks like this enter training data, does the signal improve or simply stop meaning what it meant before?


r/LocalLLaMA 12h ago

New Model Llama.cpp just added support for Laguna XS.2 & M.1

104 Upvotes

r/LocalLLaMA 5h ago

Resources MindControl - llama.cpp fork to guide the reasoning process via injection during sampling

Post image
94 Upvotes

The primary driver of this project is that I'd become frustrated with the reasoning behavior of smaller local models such as Qwen3.6-27B (i believe particularly at lower temperatures, and where system prompts are highly specific), their reasoning process is highly unreliable and often tends to spiral into neverending "But, wait" loops or, occasionally, complete garbage.

The core principle is simple - when the sampler sees an opening <think> tag, it kicks off the thought process with a self-aware statement to nudge the model to behave properly - ie. "I have a thinking budget of <x> tokens, my thought process should remain concise" - this is then prefilled, and sampling continues from there.

Once reaching another threshold of, say, 70% of the thinking budget, it again interjects with a statement bringing attention back to the budget - "I've reached 70% of my reasoning budget, let me start working towards a conclusion"

When the actual budget limit is hit - it gets given some grace period during which the sampler waits for a good time to cut the thought process off - usally a newline. At that point it'll inject something like "I've reached the end of my thinking budget, now i will provide the user an answer"

In my testing so far, this technique has proved noticeably effective at guiding the thought process.

Next steps would probably be to generalise the concept and develop something like a "reasoning grammar" or template-based approach - which could enforce different reasoning approaches based on the task at hand.

The repo is public, linked below - there is also a pre-built docker image for AMD64 + CUDA

I'd be curious to see if this type of enhancement is useful for anyone other than myself lol

github.com/laurencehardman/llama-mindcontrol


r/LocalLLaMA 3h ago

News Genesis-Science-1 (GS1), 1T open-weight model later this year from Arcee AI

Post image
94 Upvotes

Today the Department of Energy (DOE) and Arcee AI announced the development of Genesis-Science-1 (GS1), an open model for scientific research. This is a joint effort to bring advanced AI into scientific research across a wide range of fields.

GS1 is an American open-weight model for scientific research, built together with the DOE and its national laboratories through the Genesis Mission. Arcee has secured the compute, will handle training and post-training, build the scientific workbenches and the system around the model, and prepare it for release. DOE scientists will shape which problems are worth solving, provide the data and environments the model learns from, and be the true test as to whether its work holds up under scrutiny. GS1 will be a trillion-parameter-class language model paired with a governed execution system for long, difficult scientific work, released openly later this year with the weights, a technical report, and public demonstrations. GS1 is built on top of our next generation of Trinity models.

The case for American open models

Just a year ago, Arcee made a decision that was difficult to defend. We began training our own open models from scratch, in the United States, when the faster and cheaper path pointed elsewhere. Strong open models were already available to download, and the reasonable move was to take one, adapt it, and build from there. We understood that case. It’s how we’d been operating before, after all. We went ahead anyway, because we kept seeing the need.

Some institutions can't treat a model as a service. A bank, a hospital, a university, or a national laboratory may need to keep a version stable for years, hold it to their own standards, retrain it for a narrow field, and run it on their own systems without sending sensitive data anywhere. For them, a model is more than its benchmark scores. It's the weights, the training history, the license, the certainty that it will perform reliably indefinitely, and the supply chain behind it, all the way down.

We built the Trinity models to serve institutions like these. When the Genesis Mission came along, it fit our ethos.

We have real admiration for the open-model labs in China. DeepSeek, Qwen, Kimi, MiniMax and GLM have built excellent models that people rely on, and they kept sharing open weights when much of the field was moving the other way. They earned their standing. Yet their work also showed how few capable open models were being made in the United States. For an institution handling sensitive work, capability is only part of the question. It also matters who trained a model, where, under what license, and which country's laws sit behind the company that made it. Those are fair questions, and a leaderboard doesn't answer them.

We think the right response is to build more capable open models here at home, so that institutions who need them have somewhere to turn. Closed American systems will stay valuable, and many are superb. What they can't offer a national laboratory is a model it holds in its own hands, free to preserve, adapt, and run on its own terms. We wanted American science to have that option too.


r/LocalLLaMA 5h ago

Discussion Cactus Hybrid: We taught Gemma 4 to know when it's wrong

Post image
90 Upvotes

Hey HN, Henry & Roman here from Cactus.

A small, on-device model is fast and private, but sometimes wrong, but frontier models are getting expensive pretty fast. So, we post-trained Gemma 4 E2B post-trained to know when it's wrong. Every response comes with a confidence score between 0 and 1. Developers can accept the on-device when it's high, hand off to a bigger cloud model when it's low. By routing only 15-35% of queries to Gemini 3.1 Flash-Lite, Gemma-4-E2B matches Gemini 3.1 Flash-Lite on most benchmarks.

- ChartQA: 15-20%

- LibriSpeech: 25-30%

- MMBench, GigaSpeech, MMAU: 30-35%

- MMLU-Pro: 45-55%

We were always frustrated by the routing signals hybrid apps rely on: asking the model to rate itself in text (unreliable, and you're parsing prose), or token entropy heuristics (barely better than a coin flip in our tests). So we did mechanistic studies on small models, Gemma 4 particularly, and found the hidden state for different layers carry meaningful self-awareness signal for various situations.

SO we extended the model with a 68k params probe layer (LayerNorm, low-rank projection, attention pooling, small MLP head) reads one intermediate layer during decoding and predicts p(wrong); confidence = 1 - p(wrong), returned as structured data, never parsed out of the answer text.

Across 12 hold-out benchmarks spanning text, vision and audio, the probe averages 0.814 AUROC vs 0.549 for token entropy. The result that convinced us this is real: the probe was trained on zero audio data, yet scores 0.79-0.88 AUROC on four audio benchmarks where entropy is near-random or worse (0.32-0.52). It's reading a modality-independent correctness signal from the hidden state, not memorizing patterns from its training data.

We published all weights on HuggingFace and provide copy-pase codes to run it on Transformers, MLX, Llama.cpp or Cactus. With Ollama, vLLM, SGLang etc in the works. For llama.cpp we ship a patch series you compile in once (upstreaming is planned). The code is MIT licensed; Gemma model use remains subject to the Gemma terms.

GitHub: https://github.com/cactus-compute/cactus-hybrid

Weights: https://huggingface.co/collections/Cactus-Compute/cactus-hyb...

Some caveats:

- The probe scores single-sequence decoding only, up to the first 1024 generated tokens.

- Handoff works best when routing per task in a multi-step process, not per step.

- Hierarchical routing is still in the works: try on-device, then DeepSeek v4 Flash, before Fable/GPT5.5/Gemini/Muse/Grok.

- The technique is boutique for each model, we will share each weights as they roll out.

These issues are currently being tackled at Cactus and updated weights will be shipped directly into the HuggingFace collection and GitHub repository straight up. Please let us know your thoughts, it helps us find ways to improve the design progressively.

Thanks a million!


r/LocalLLaMA 20h ago

Discussion FlightSimulatorBench: Small MoE edition

Thumbnail
gallery
83 Upvotes

Properly done this time.

Models as the GIFs are displayed:

  1. Qwen3.6-27B - 4bit

  2. Qwen3.6-MoE - 6bit

  3. Ornith-35B - 6bit

  4. Gemma-4-26B - 6bit

  5. Qwen3.6-MoE - 4bit

  6. HuiHui-Qwen3.6-MoE - 6bit

  7. Agents-A1 - 6bit

Inference parameters:

Qwen3.6 & HuiHui Abliterated:

temperature 0.6 - top_p 0.95 - top_k 20 - min_p 0.01 - repeat_penalty 1.05

Ornith-1.0-35B:

temperature 1.0 - top_p 1.0 - top_k 40 - min_p 0.01 - repeat_penalty 1.05

Gemma-4:

temperature 1.0 - top_p 1.0 - top_k 64 - min_p 0.01 - repeat_penalty 1.1

Agents-A1:

temperature 0.85 - top_p 0.95 - top_k 20 - min_p 0.01 - repeat_penalty 1.05

Prompt: "Create a beautiful, relaxing flight simulator in a single html file with mountains, clouds, and endless procedural terrain"

Harnes: Pi

Served by: oMLX

Method: single prompt. If the html file doesn't work everything was deleted, Pi session was restarted, and model had to start from scratch again. maximum of 3 tries.

Models Quants used:

https://huggingface.co/collections/leonsarmiento/local-sota-for-48gb-macs


r/LocalLLaMA 2h ago

New Model Laguna S 2.1 looping fix incoming

Thumbnail
huggingface.co
64 Upvotes

Poolside have updated the full precision, and FP8 versions with a fix for the looping issue many of us have been seeing. Other variants incoming.

Discussion - https://huggingface.co/poolside/Laguna-S-2.1-FP8/discussions/1


r/LocalLLaMA 12h ago

News Tokenizer Expansion: Upgrading a Model's Tokenizer in Place - LFM2.5-8B-A1B

Thumbnail
liquid.ai
60 Upvotes

Today, we're sharing the recipe behind the new tokenizer in LFM2.5-8B-A1B. It upgrades a pre-trained model's tokenizer in place, without retraining from scratch. We doubled the vocabulary from 65K to 128K to fix the languages our original tokenizer split too finely.

Blog: liquid.ai/blog/tokenizer-expansion
Technical report: arxiv.org/abs/2607.15232
Hugging Face: huggingface.co/LiquidAI/LFM2.5-8B-A1B


r/LocalLLaMA 2h ago

Discussion Session-Adaptive Orthogonal Distillation (SAOD)? Technology compresses 744B (1.5TB) to under 100GB?

Thumbnail
gallery
58 Upvotes

Tweet : https://xcancel.com/jun_song/status/2079914426334167258#m

Looks like 8GB VRAM could do more like even run 70-100B MOE models possibly.

Sorry about the clickbait title, I want more eyes on this..... zzz


r/LocalLLaMA 20h ago

Discussion Nanbeige4.2-3B drops: 3B params claiming to beat 9B/12B models on agentic tasks (atleast according to them)

Post image
53 Upvotes

Nanbeige Lab released Nanbeige4.2-3B, and if the benchmark claims hold up, the numbers are pretty crazy for a model this small. It’s built on a "Looped Transformer" architecture that reuses transformer layers to increase effective depth without inflating the parameter footprint.

With just 3B non_embedding parameters, they are reporting an SWE-Bench Verified score of 63.6 and SWE-Bench Pro at 46.9. They tested it in OpenClaw guarded by Lyzr Control Plane for runtime security and claim it outperforming Qwen3.5 across daily workflows, putting it ahead of Qwen3.5-9B and Gemma4-12B on coding and agentic benchmarks. The core pitch here is a lightweight "local personal assistant." In OpenClaw framework testing, it reportedly beat both 4B and 9B class models across daily office workflows and research tasks.

That said, take the benchmark table with a grain of salt. Community members are already pointing out discrepancies between the Qwen3.5-9B numbers reported by Nanbeige versus Qwen’s official model card. Outside verification will be key once GGUF quants propagate through llama.cpp and Ollama.

How it can be better:

Running high-depth 3B models in local agent frameworks like OpenClaw opens up serious workflow potential, but deploying autonomous loops on local hardware still carries runtime risks especially when agents execute unverified code or make outbound API calls.

so use a harness

Anyone actually run it locally yet? how does it feel?

Used grammarly for formatting (English isnt my first language)


r/LocalLLaMA 9h ago

New Model We built NeuTTS-2E, an open-source on-device TTS model with 7 controllable emotions

Enable HLS to view with audio, or disable this notification

50 Upvotes

We’re open sourcing an alpha release of NeuTTS-2E: an on-device TTS model with 125M active parameters and 7 controllable emotions. The goal was simple: when you select “angry,” “fearful,” or “happy,” the delivery should follow that instruction rather than whatever emotion the model infers from the text.

With NeuTTS-2E, you can:

  • Direct the performance: Select the intended emotion for each generation.
  • Keep the speaker: Explore different emotional deliveries while preserving the chosen voice.
  • Run locally: Generate expressive English speech on your own hardware.
  • Stay private: Your text and audio do not need to leave the device.
  • Build efficiently: Run emotional speech generation using our smallest model yet, with 125M active parameters.
  • Build openly: Access the open-source model under the NeuTTS Open License.

Getting there meant dealing with limited emotional speech data, unreliable labels, and disentangling spoken emotion and text semantics. NeuTTS-2E runs locally and supports four built-in voices.

We’re sharing it early to get feedback from the community, and we’d love to see what you build!

GitHub: https://github.com/neuphonic/neutts

Hugging Face Model Collection: https://huggingface.co/collections/neuphonic/neutts-2e

Interactive demo: https://huggingface.co/spaces/neuphonic/neutts-2e

Website: https://www.neuphonic.com/models/neutts-2e


r/LocalLLaMA 16h ago

News Add support for Laguna XS.2 & M.1 by joerowell · Pull Request #25165 · ggml-org/llama.cpp

Thumbnail
github.com
44 Upvotes

https://huggingface.co/poolside/Laguna-S-2.1-GGUF

https://huggingface.co/unsloth/Laguna-S-2.1-GGUF

https://huggingface.co/poolside/Laguna-S-2.1

Laguna S 2.1 is a 118B total parameter Mixture-of-Experts model with 8B activated parameters per token, designed for agentic coding and long-horizon work. It sits between Laguna XS 2.1 (33B-A3B) and Laguna M.1 (225B-A23B) in the Laguna series and shares the family recipe: a token-choice router with softplus gating over 256 routed experts plus one shared expert, grouped-query attention, and interleaved full/sliding-window attention.

https://huggingface.co/poolside/Laguna-XS.2

Laguna XS.2 is a 33B total parameter Mixture-of-Experts model with 3B activated parameters per token designed for agentic coding and long-horizon work on a local machine. It uses Sliding Window Attention with per-head gating in 30 out of 40 layers for fast inference and low KV cache requirements.

https://huggingface.co/poolside/Laguna-M.1

Laguna M.1 is a 225B total parameter Mixture-of-Experts model with 23B activated parameters per token designed for agentic coding and long-horizon work.


r/LocalLLaMA 17h ago

Tutorial | Guide VRAM disk cache of MoE makes 340 pp/s 9.6 tg/s for Kimi 2.7 on a single dgx spark

42 Upvotes

this strategy effectively uses vram as cache over disk to keep MoE experts on cuda compute path in llama.cpp.

numbers first. detailed explanation down below.

Numbers

on dgx spark Kimi-K2.7-Code.i1-IQ_S.gguf 204GB 1T.A32B https://huggingface.co/mradermacher/Kimi-K2.7-Code-i1-GGUF

run method pp512 tg128 note
A cuda, -ot regex A down below, GGML_CUDA_ENABLE_UNIFIED_MEMORY, GGML_OP_OFFLOAD_MIN_BATCH 340.02 ± 37.75 9.58 ± 0.07 all tensor on unified ram + experts kept in pageable host memory via mmap + last layers pinned in ram
B cuda, -ot regex B down below, GGML_CUDA_ENABLE_UNIFIED_MEMORY, GGML_OP_OFFLOAD_MIN_BATCH 154.31 ± 30.62 8.75 ± 0.22 A, but last layers not pinned
C cuda, -ot regex C down below GGML_CUDA_ENABLE_UNIFIED_MEMORY 222.20 ± 66.04 3.26 ± 0.01 B, but remove min batch flag
D cuda, GGML_CUDA_ENABLE_UNIFIED_MEMORY crash crash C, but remove experts offloading
E cpu mmap 4.23 ± 0.22 1.63 ± 0.66 no cuda involved

-ot regex A: '^(?!blk\.(5[5-9]|60)\.ffn_(down|gate|up)_exps\.weight$).*\.ffn_(down|gate|up)_exps\.weight=CPU'

-ot regex B: '.*\.ffn_(down|gate|up)_exps\.weight=CPU'

-ot regex C: '.*\.ffn_(down|gate|up)_exps\.weight=CPU'

on 3090s pcie 4.0 + 128gb ddr4 Minimax-M2.7-K_G_3.00.gguf 80GB 230B.A10B https://huggingface.co/Goldkoron/MiniMax-M2.7

run method pp512 tg128 note
A cuda, -ot regex A down below, GGML_CUDA_ENABLE_UNIFIED_MEMORY, GGML_OP_OFFLOAD_MIN_BATCH 54.03 ± 3.85 2.90 ± 0.09 same strategy as B on dgx
B cuda -ngl 17 73.80 ± 2.10 1.66 ± 0.02 normal layer split
C 3090x2, cuda, -ot regex C down below, GGML_CUDA_ENABLE_UNIFIED_MEMORY, GGML_OP_OFFLOAD_MIN_BATCH 48.86 ± 0.53 2.40 ± 0.01 A, but on two 3090s

-ot regex A: '^(?!blk\.(5[5-9]|60)\.ffn_(down|gate|up)_exps\.weight$).*\.ffn_(down|gate|up)_exps\.weight=CPU'

-ot regex C: '^(?!blk\.(5[5-9]|60)\.ffn_(down|gate|up)_exps\.weight$).*\.ffn_(down|gate|up)_exps\.weight=CPU'

Background

I want to run model larger than 128gb on my single dgx spark. MoE models provide a great opportunity because if active params could be computed entirely with cuda then there's no need to store all model weights inside gpu ram at runtime. after experiments I found a combination of settings for llama.cpp to run kimi 2.7 fast.

Settings

general setting for llama-bench: -r 50, -fa on, -mmp 1, system swap turned off. llama.cpp b10075 compiled with kleidai support, and the winning strategy is the following: GGML_CUDA_ENABLE_UNIFIED_MEMORY=1 GGML_OP_OFFLOAD_MIN_BATCH=1 ./llama-bench -m ~/Kimi-K2.7-Code.i1-IQ_S.gguf -fa on -mmp 1 -ot '^(?!blk\.(5[5-9]|60)\.ffn_(down|gate|up)_exps\.weight$).*\.ffn_(down|gate|up)_exps\.weight=CPU' -r 50. I configured b10075 with cmake -B build -DGGMLCUDA=ON -DGGML_CPU_KLEIDIAI=ON and compiled with cmake --build build --config Release.

How this works

first, if GGML_CUDA_ENABLE_UNIFIED_MEMORY is 1, cuda device buffers use cudaMallocManaged, and every tensor has one virtual address that is valid from both gpu and cpu. when cuda kernel touches a page that exists in vram then it'll execute normally. if not in vram then a page on cpu ram will migrate that page to vram. if not in gpu ram or cpu ram, then it'll fetch the page from disk to cpu ram via mmap and then send to vram. on dgx spark the cost of cudaMallocManaged is much lower because gpu ram and cpu ram are unified.

second, for GGML_OP_OFFLOAD_MIN_BATCH (default is 32), if batch size < threshold and weight is on cpu ram then it executes on cpu, otherwise on gpu. if you set it to 1, it forces all computes on gpu. this helps token generation because in tg it won't reach that threshold.

third, when you specify -ot '.*.ffn_(down|gate|up)_exps.weight=CPU' it will put expert weights on cpu ram and can be evicted because of mmap. this makes cold expert weights more likely to stay on disk.

and last, '^(?!blk\.(5[5-9]|60)\.ffn_(down|gate|up)_exps\.weight$).*\.ffn_(down|gate|up)_exps\.weight=CPU' is used to keep last few blocks on gpu ram because these blocks has more dynamical routing, it's faster to keep them on gpu ram to avoid overhead when ram space is large enough.

Unified ram scenario

for dgx spark, it has large menory pool so that I can pin some of the expert blocks in vram (run A). if we don't pin them it's slower (run B). if we remove GGML_OP_OFFLOAD_MIN_BATCH flag the token generation is slower (run C), because expert forward pass is done on cpu. if we further remove GGML_CUDA_ENABLE_UNIFIED_MEMORY flag (run D), oom happens, because gpu ram cannot be evicted via mmap mechanism. and finally, if all compute is on cpu it's the slowest (run E).

an interesting tradeoff happened in run B vs run C, where GGML_OP_OFFLOAD_MIN_BATCH dramatically improves tg while slightly hurting pp. potential code modification may be made to mitigate this tradeoff.

Non-unified ram hardware scenerio

for 3090 + ddr4, I haven't tested it in depth but the strategy kinda applies too. I didn't put last few blocks on vram because 24gb is too small. you can see tg of run A is higher than normal ngl split (run B), because experts are computed on gpu. however the prompt processing suffers, likely due to pcie overhead.

I also tested two 3090 + ddr4, but it's generally slower. maybe the cost of pcie transfer is too high. I think properly tune the -ot offload might have a chance to improve on 2 gpu scenerio.

Note

  • mac apple silicon is tempting because it's fast unified ram. but I can't find an easy way to disable swap. the proposed approach might cause heavy ssd writes because of ram swapping. probably not a good idea to run it because it may create more ssd wear.
  • the suggested way of doing this on a new model is to offload experts first (strategy run B in dgx spark) and then pin more and more experts to vram. I look forward to seeing if the upcoming kimi k3 quants can be applied too.
  • same strategy transfer across unified memory and non-unified memory architectures. tg on 3090+ddr4 setting improved too.

Edit: fix formatting


r/LocalLLaMA 5h ago

New Model Mage-Flow - An Efficient Native-Resolution Foundation Model for Image Generation and Editing - Microsoft

Post image
37 Upvotes

Models: (Check Model cards for so much sample demo images)

Mage-Flow is a compact 4B-scale generative stack for efficient text-to-image generation and instruction-based image editing. Instead of scaling to tens of billions of parameters, Mage-Flow reaches state-of-the-art-competitive quality through careful tokenizer–backbone–system co-design, so it stays fast, memory-light, and easy to fine-tune under realistic compute budgets.

The stack is built from two shared, co-designed components:

  • Mage-VAE — a lightweight, high-fidelity latent tokenizer (one-step diffusion encode/decode with anchor-latent KL regularization).
  • NR-MMDiT — a shared 4B Native-Resolution Multimodal Diffusion Transformer, trained with rectified flow matching in the Mage-VAE latent space.

Together with native-resolution packing and a fused-kernel training infrastructure, this shared stack powers two model instantiations: Mage-Flow for text-to-image generation and Mage-Flow-Edit for instruction-based image editing. Each ships in Base, RL-aligned, and 4-step Turbo variants.

✹ Highlights

  • Compact & competitive. A single 4B family for generation and editing that matches or beats much larger open systems (Qwen-Image 20B, Z-Image 6B, FLUX.2 32B, FireRed-Image-Edit 20B).
  • Efficient tokenizer. Mage-VAE matches FLUX.2-VAE reconstruction fidelity while using ~12× / ~22× fewer encode / decode MACs per pixel, removing the VAE as the high-resolution bottleneck.
  • Native resolution. One checkpoint generates from 512 to 2048 on any aspect ratio, including extreme 4:1 (e.g. 512×2048, 2048×512).
  • System-level speed. Native-resolution packing (FlashAttention var-len + per-sample 2D RoPE) + fused CUDA kernels cut per-step training time from ~1.93 s → ~0.78 s (~2.5× faster training); CFG's conditional/unconditional branches run in one packed forward.
  • Full family. Base, RL-aligned, and 4-step Turbo variants for both generation and editing.
  • Versatile editing. Mage-Flow-Edit supports semantic content editing, appearance transformation, image restoration, and structure-aware outputs within a unified image-and-text-conditioned model. See the report's editing galleries.
  • Interactive latency. At 1024ÂČ on a single A100: Mage-Flow-Turbo 0.59 s/image, Mage-Flow-Edit-Turbo 1.02 s/edit, peak memory ~18–20 GB (lowest among compared systems).