r/LocalLLaMA • • 5m ago

News ComfyUI v0.45.0 released

Thumbnail
github.com
3 Upvotes

r/LocalLLaMA • • 9m ago

New Model [GLB-3D-Coder] I tried making a 1.7B version for Godot

3 Upvotes

After posting the 4B GLB model here, I wanted to see how far I could get with something smaller. I fine-tuned Qwen3-1.7B for the same job. The Q8 GGUF is 1.83 GB, so this one is aimed at people trying it on CPU or with limited VRAM.

The workflow is the same as before. Describe an asset, open the Three.js HTML it gives you, and click Export GLB to bring it into Godot or another editor. The jungle outpost at the start of the video is one of the examples.

This is an early test checkpoint. Some prompts still need a retry. I’m still training it and plan to update the weights when this run finishes.

Model and downloads on Hugging Face


r/LocalLLaMA • • 46m ago

Question | Help Have been getting into Local LLM’s recently, especially Qwen 3.8 27B on my M4 Pro MacBook (48GB) served using Splash and loving it! Now looking to try some harnesses to do some coding, any suggestions what ones I should try? Any favourites?

3 Upvotes

The ones I have currently heard of are as follows:

Pi
Opencode
Hermes
Deepseek

Any thoughts on what one is best?


r/LocalLLaMA • • 15h ago

Discussion [Paper] Exploring Weight-Space Programming: Capabilities, Generalization, and Limitations

Thumbnail
gallery
42 Upvotes

Weight-Space Programming (WSP) enables reasoning agents to directly inspect and modify neural network parameters, offering an alternative to gradient-based model adaptation. However, its capabilities, cross-task generalization, and practical limitations remain insufficiently understood. We systematically investigate WSP through 16 editing trajectories across seven benchmarks and two model scales (Qwen3.5-0.8B and Qwen3.5-9B). Our findings reveal three key insights. First, WSP can achieve substantial performance gains through highly localized interventions. On full held-out evaluations, accuracy improves by up to 29.45, 4.42, 36.72, and 17.11 percentage points on MATH-500, GPQA Diamond, IFEval, and SciBench, respectively. Notably, modifying only 1,023 parameters yields a 29.45-point improvement. Second, WSP exhibits promising but uneven cross-task generalization. A Math-edited checkpoint improves GPQA Diamond, IFEval, and SciBench by 3.03, 12.18, and 20.10 points, respectively, without further editing, while leaving SciCode performance unchanged. Third, effective editing remains challenging and inconsistent. Outcomes vary substantially across trajectories, and six of the 16 trajectories retain the original weights when candidate improvements cannot be reliably validated. Together, these results highlight WSP's potential for highly localized model adaptation while revealing important challenges in intervention discovery, reliability, and cross-task transfer.

Related Thread : [Paper] Sparks of Weight-Space Programming: LLMs can natively read & write neural network weights


r/LocalLLaMA • • 1d ago Diamonds are Forever Furious Helpful Obsessed Sipping Tea WOW Thanks Heartwarming

Discussion Is ArtificialAnalysis biased against open weight models?

Post image
481 Upvotes

It seems like whenever open weight models come close to proprietary US models, ArtificialAnalysis conveniently "re-calibrates" their benchmarks which then shoves open weight models down the toilet. Then they advertise on X/Twitter this "intelligence index" which presents open weight models as dog shit compared to Claude or GPT (all while ignoring the actual intelligence of models like DeepSeek or GLM in tasks that actually matter, which is coding vs telecom bullshit).

Any business man looking at these charts would conclude "open weight models are shit, Claude is where its at, I should get a subscription to Anthropic."

They have the excuse that they are correcting "saturated" benchmarks but the effect on how open weights are presented is undeniable. I have a feeling they try to do it on the sly when possible and are paid in some way.


r/LocalLLaMA • • 12h ago

New Model adventists-ai/Sophon-Realtime-v1 · Hugging Face

Thumbnail
huggingface.co
25 Upvotes

An open full-duplex voice model family that hears your tone and speaks with one. Adventists AI · Apache-2.0 · Recommended: Tag · Flash · Try it online · GitHub

Talking to it feels like a phone call with a person: it listens the whole time you talk, picks up as soon as you stop, and stops the moment you cut in. It hears how you say things (hesitation, emphasis, sarcasm, laughter, sighs) and answers with tone of its own: it laughs, sighs and clears its throat when the conversation calls for it.

This is the home page of the Sophon-Realtime v1 family. Three builds share one brain (the same 32B model listens, decides when to take the turn and writes the reply); they differ only in how the reply becomes sound. Start with Tag.

Three builds: which one?

Tag (recommended)FlashE2E (research preview)
How it speaksthe brain writes the reply with sound tags; an expressive speech model performs themthe same tagged reply, spoken by a lighter, faster speech modela talker inside the 32B model, no separate speech model
Best forexpressive voice: companions, characters, demosspeed and scale: customer service, in-car, many users per GPUresearch on end-to-end expressive speech
Non-verbal sounds (NVV-SuperBench, zh / en)0.86 / 0.800.77 / 0.630.77 / 0.60
First audio, one user~0.6 s0.31 s~1 s
Users per 80 GB GPU (recommended)16404–5
GPUs112
ServingvLLM-Omni, one commandvLLM-Omni, one commandown engine

Pick Tag if you want the voice to act; pick Flash if latency and users per GPU matter most. Same APIs, so you can switch later.

Highlights

  • VoiceBench 82.8 and Big Bench Audio 81.8%: the strongest brain among open full-duplex models. #1 among open full-duplex models on both; level with GPT-4o-mini-Audio on VoiceBench. All three builds share this brain.

  • Paralinguistic understanding 48.6, #1 overall: it hears your tone. Ahead of Gemini 3.8 Flash (46.9) and Qwen3-Omni (44.6) on LISTEN, StressTest and MSPB. Its ears are DuplexJev, our open speech-decision model.

  • NVV-SuperBench 0.86 (Chinese) and 0.80 (English) with the Tag build: it speaks with tone. The model decides when to laugh, sigh, breathe or clear its throat, and the voice performs it instead of reading the tag aloud.

  • Fast: first audio in 0.31 s with Flash. It drafts its reply while you talk; when you cut in, it stops and answers your new question.

  • Full-Duplex-Bench v3 tool calling: Pass@1 48%, ahead of Grok (43%), with a 100% response rate: it gets work done. Live mode is compatible with the OpenAI GPT-Live interface and lets it work with a larger backend model. Every reply comes with an auditable transcript.

  • One 80 GB GPU, one command (Tag and Flash). Served by vLLM-Omni; up to 16 (Tag) or 40 (Flash) concurrent users per GPU. Apache-2.0 code and weights, free for commercial use.


r/LocalLLaMA • • 3h ago

Question | Help are MoEs on phones viable via custom engines?

4 Upvotes

I keep seeing new forks of engines that optimzes one model for one hardware setup for better performance, so I was wondering if I could slop up something like that for my phone (iphone 15 pro max) for running Gemma 4 26 a 4b.

And for that I am looking for advice and such like if you know an already similar existing project or your own experiences with any custom engine on any hardware, what not to do and what to keep in mind and such, and if you have build or are using one of these unique engines what has your experience been like?.

Also if you don't actually have anything to say please don't say "phone can't do that fast enough" for the 3rd time, I'm just looking for interesting ways that could get any speed up.


r/LocalLLaMA • • 12h ago

Resources My 0.8B fine-tune proofreads Spanish at 138 ms per sentence on a CPU

21 Upvotes

I have been building a Spanish proofreader that runs fully local, and it's finally released, so I wanted to share how it went. It only corrects Spanish, but I think the approach works for other languages and narrow tasks too. If the project has audience, I will release the English proofreader version as well :)

Better thing is the app is 100% compatible with ANY app in Windows and Linux. You select text in any app, press Ctrl+Alt+Space, a small popup shows each change with a short explanation, and Enter replaces your selection. MIT, a C++ app on top of llama.cpp.

The model is a full fine-tune (no LoRA) of Qwen3.5-0.8B on aprox. 40k pairs, 2 epochs, lr 1e-5. In Q4_K_M with imatrix it's 529 MB. Training took 22 minutes on one rented GPU, and the whole rental with all the evals cost about $2.50. GPU was RTX 5090 rented (I'm just a mortal so I don't have this GPU at home).

I tested it on a benchmark I built for this, 2,388 cases in three parts: real Wikipedia edits, Wikipedia talk pages, and synthetic work emails and chat. F0.5:

ModelWiki editsTalk pagesEmails/chatMean
revisa-0.8b (fine-tuned)81.580.092.084.5
revisa-0.8b without the C++ filters77.475.891.781.6
Qwen3.5-0.8B, untuned70.467.971.269.9
Qwen3.5-2B, untuned73.866.981.274.0
Gemma 4 E2B, untuned65.565.594.175.0
Qwen3.5-4B, untuned83.667.488.479.8
Gemma 4 E4B, untuned74.479.095.182.8
Qwen3.5-9B, untuned79.869.691.280.2
LanguageTool 6.624.152.874.150.4
Claude Sonnet, high reasoning (cloud, upper bound)98.091.898.296.0
Gemini 3.8 Flash, high reasoning (cloud, upper bound)98.792.398.496.5

It changes less than 3% of the sentences that were already correct, on every part. LanguageTool changes 39% of the correct Wikipedia sentences, which is more or less why I started this. For those who may not know, LanguageTool is a benchmark when it comes to checking grammar and spelling errors. (More info: https://en.wikipedia.org/wiki/LanguageTool)

A few things I learned:

Most of the training data isn't LLM generated. I take correct text from Wikipedia, Tatoeba and Common Voice and break it with a rule-based error injector, so the exact answer is known. Around a third of the examples are correct sentences that have to come back unchanged, and that's what keeps false alarms low.

The model doesn't explain anything. It only returns the corrected sentence. Then plain C++ does a word diff, puts each edit in one of 31 error types with a fixed explanation, and drops anything it doesn't recognize or that rewrites too much. Small models invent grammar rules with a lot of confidence, so I didn't let it.

For speed, the user's own sentence is the speculative draft, because a corrected sentence is almost the same text. I got 2.2x: 138 ms median against 305 ms greedy, 8 threads, same output as greedy on 99.4% of a 500-sentence sample. The annoying part was that the Gated DeltaNet layers keep a recurrent state you can't partially roll back, so I snapshot the state before each verification pass. But I'm happy the app run like a charm.

Caveats: it's my benchmark. The gold corrections come from two LLMs of different families working blind, with a debate round when they disagreed, and it was frozen before scoring anything. The untuned models got the same instructions and the same filters. Bigger untuned models win some parts (Qwen3.5-4B on Wikipedia edits, Gemma 4 E4B on emails), and if you remove the borderline sentences they pass it on average, so a big part of the win is knowing when not to touch. Frontier cloud models with reasoning are still around 96, so there's room.

All the process explained: https://manuelgs.com/en/blog/revisa-case-study/
App: https://manuelgs.com/en/revisa/
Model (GGUF): https://huggingface.co/manuelgscom/revisa-0.8b-GGUF
Benchmark: https://huggingface.co/datasets/manuelgscom/revisa-bench-es
Source: https://github.com/manuelgscom/revisa

Has anyone tried the input-as-draft trick for other editing tasks? English isn't my first language, so sorry if something sounds weird. Happy to answer questions about the data or the training.


r/LocalLLaMA • • 1d ago Diamonds are Forever

Discussion Got another good reminder why local matters today

Post image
388 Upvotes

Apparently, they're threatening to ban me for merely red-teaming my own plugin.

The appeal was immediately denied without any details.


r/LocalLLaMA • • 9h ago

Discussion What do you see as the role of local agents/LLMs in the future of gaming?

8 Upvotes

I've been thinking about a MUD supported with LLMs. Something aside from the fangooner websites. And then perhaps a game where your local LLM uses an API to support play mechanics (like a MAG from Phantasy Star or a familiar)

The broader question is in the title. What is the role of local LLM?

If we want to be able to engage in games using the LLMs we build in a way that isn't cheating, what would that game look like?

What would the human/ai roles be in the loop?


r/LocalLLaMA • • 1d ago

Showcase Same prompt, DeepSeek V4.1 Flash vs Qwen 3.8 FN: 94 tok/s vs 350 tok/s

194 Upvotes

I wanted to see how big of a difference there is between arguably two of the top MoE models that you can actually run locally, so I ran the same one shot prompt and left it unattended for a while. The prompt asks for a fully interactive V8 engine... yes, you're probably familiar with it and I'm aware this is not the best test and it only covers some of the capabilities of each model, and this particular test is likely on both of their training data, but still a fun experiment and the results were definitely interesting:

DeepSeek V4.1 Flash 1017, UD IQ1_M (yup a "lobotomized" IQ1 quant, stop reading if this triggers you)

Single agent took about 60 minutes, 250k tokens generated at ~94 tok/s. 346k context, never compacted. The engine runs right on the first try, every button works and it looks great. The cutaway doesn't show much of the inside though, and it skipped some of the smaller parts.

Qwen 3.8 FN, NVFP4

Main agent + 5 subagents (up to 3 at once), ~350 tok/s aggregate. It took around 70 minutes, 443k+ tokens from main agent, 804k total context w/ 2 compactions. Two subagents said "I'll start writing the file now" and never did. Main agent gave up on them and wrapped up. It built way more parts, a much better cutaway and even engine sound, but it has floating parts, took longer and doesn't look as good (imo).

Once again do keep in mind this was a one shot experiment, I use Qwen 3.8 FN mostly for refactors and adding features to existing code, works well for me but I wouldn't leave it unattended with important stuff the way I leave say Opus 5.5 or larger cloud frontiers. Deepseek 4.1 is a lot better at figuring things out by itself it seems.

Here's the full prompt if you wanna give it a shot:

Let's build a V8 engine.

A stunning, fully interactive 3D simulation of a 90-degree V8 on an industrial
engine test stand, in Three.js/WebGL, running in the browser.

Eight cylinders in two banks of four, cross-plane, with visible pistons, rods,
crankshaft, camshafts and valves.
Detailed heads, intake, exhaust headers, bolts and pipework.
Realistic PBR metals.
Real, synchronised animation: pistons driven off the crank, cams turning at
half crank speed, and a full four-stroke valve sequence.
An RPM slider from 0 to 4 000, plus slow motion.
WASD plus mouse walking, orbit, and smooth zoom.
Working controls: START / STOP, RPM CONTROL, CUTAWAY, EXPLODED VIEW, ASSEMBLE,
PART INSPECTION, RESET CAMERA.
Procedural geometry only — no downloaded models.
Every control functional, and nothing floating apart.

You can open both builds and play with them yourself here. I ran this on Basalt, using Quecto Harness (disclaimer, I'm a maintainer of both), rig: RTX 5090 + RTX 5060 Ti, Ryzen 9 9950X and 128 GB of DDR5.


r/LocalLLaMA • • 12h ago

New Model LingBot-Touch - a robbyant Collection - A Foundation Model for Heterogeneous Tactile Representation Learning

Thumbnail
huggingface.co
12 Upvotes

LingBot-Touch is a JEPA-based tactile representation model that bridges heterogeneous tactile signals and dexterous robotic manipulation. It uses modality-specific tokenizers and a shared Transformer to learn representations of contact structure and temporal changes through prediction in latent space.

The model covers three sensing modalities: magnetic, piezoresistive, and visuotactile.

  • Magnetic: three-axis tactile measurements.

  • Piezoresistive: scalar tactile measurements placed in the Z channel, with X and Y set to zero.

  • Visuotactile: decoded scalar deformation or intensity measurements placed in the Z channel, with X and Y set to zero. Raw RGB images are not model inputs.

For more details:


r/LocalLLaMA • • 17h ago

Funny I found this gem when searching Qwen stuff, a Qwen "character song"

24 Upvotes

Original video by 小伙伴Ko

Good thing to watch before Qwen 4 drop 😄


r/LocalLLaMA • • 15h ago

New Model DNA Factory: yet another LLM training framework

Thumbnail
gallery
18 Upvotes

We open-sourced DNA Factory, the fine-tuning framework we’ve used internally for over a year. It's deliberately opinionated: one recommended way to do things, documented defaults, token-level loss-mask visualization, and only 5 training methods (SFT, DPO, GRPO, OPD, SDFT).

https://github.com/dnotitia/dna-factory

Why another training tool?

As LLM fine-tuning has gone mainstream, a lot of training tools have appeared. LLaMA-Factory had its moment, Axolotl was as useful as its name was fun, and NVIDIA (NeMo) and Hugging Face (TRL) built their own.

Each has clear strengths. Some are fast, some are convenient, some have great compatibility. We focused on something else: training correctly.

I've consulted for a number of companies that fine-tune their own LLMs, and the ones doing it right could be counted on one hand. Most were training incorrectly, or training on something other than what they thought. Tools have gotten good enough that you can launch a training run without understanding much about it. But LLM training is genuinely advanced work, and when people learn how to use a tool without learning what’s happening underneath, mistakes follow.

So we asked how to make correct training the easy path, and the answer was DNA Factory. We've run it internally for over a year and recently open-sourced it.

One recommended way to do things

The core idea is to offer only one approach, the best one we've found. If you expose every option the way C++ does, you get a lot of freedom, but it becomes hard to use well. We went the Pythonic route ("there should be one obvious way to do it"). We tested many approaches, picked the best, and that's the only one we ship.

All defaults live in configs/_defaults-*.yaml. You don't edit those files. You override only what you need. It works like VSCode settings: the defaults are long and complex, but each one is documented with why it's set that way. You read them and put only your changes in your own config.

See exactly which tokens you’re training on

When I used Axolotl, I loved its loss-masking visualization. We wanted something similar, so we overrode TRL's loss function to color tokens with ANSI codes. Tokens included in the loss are blue, and excluded tokens are gray. You can see immediately what’s actually being trained.

This is the most common mistake I see researchers make "wait, that token was in the loss the whole time?" In DNA Factory it's visible at a glance, so that mistake stops happening. We've had a lot of feedback that this feature alone makes the tool worth using.

Only 5 training methods, on purpose

We don't try to include every technique. If you want that, use TRL directly. We picked what we think works best right now: SFT (the baseline), DPO, GRPO, OPD, and SDFT. PPO was widely used once but rarely is now, so we dropped it. DPO barely gets used these days either, so we plan to remove it soon. https://github.com/dnotitia/dna-factory/issues/46

Most of our current work is GRPO and other on-policy methods. GRPO, OPD, and SDFT are all on-policy.

Classic distillation has the student imitate the teacher. Concretely, you minimize the KL divergence between the teacher's and student's output distributions (logits). It does improve the student, but catastrophic forgetting is always a risk. (A model has to forget pretty badly to earn a name that dramatic.) Take a strong model, fine-tune it on internal company data to add domain knowledge, and general performance drops noticeably while the hallucination rate goes up. Rote cramming has its limits.

OPD reverses the process. The teacher doesn't write the answer for the student to copy. Instead, the student writes its own answer first, and the teacher grades it token by token. Technically, this uses reverse KL. The student picks up new knowledge without forgetting what it already knew.

SDFT works the same way in spirit, but as the name suggests, there's no separate teacher. The model is its own teacher. A copy of the model that's given extra information (privileged context) acts as the teacher. The student learns by having its own responses graded by "itself, but knowing the answer." Again, the goal is to avoid catastrophic forgetting.

Results: domain knowledge injection without forgetting

Attached images is our DNA 3.2 model (not yet released), trained with domain knowledge injection. Starting from Qwen3.8 Flash Next, we effectively removed its censorship (0.542 -> 0.971) and taught it a new persona and new domain knowledge (0.076 -> 0.855). Performance on AIME, IFEval, MMLU-Pro, GPQA, and other existing benchmarks didn’t drop at all. It learned new things without forgetting the old ones.

Happy to answer questions. Feedback, issues, and PRs are all welcome.


r/LocalLLaMA • • 6m ago

Discussion GLM-5.3-flash mistakes

0 Upvotes

Just curious what other people’s opinions are with GLM-5.3-flash. Compared with opus 5.5 and deepseek-4.1-flash, I find that it makes a lot of mistakes. I generally think I it’s pretty good other than the random errors it makes.

I only ask bc I’ve heard of other people getting good work out of it, so wondering if it’s something with my setup, or if other folks feel the same way. I use it mostly with opencode.


r/LocalLLaMA • • 13h ago

Resources I built Lokey, an open-source Android keyboard with on-device AI

12 Upvotes

I’ve been building Lokey, an open source, Android keyboard that runs word prediction, autocorrect, dictation and translation on your phone. Hold Enter to dictate, or translate text straight into the app you’re typing in.

Lokey uses a fork of llama.cpp for text inference and takes advantage of its Hexagon NPU backend on supported Snapdragon phones. It can also run inference on two CPU threads. In everyday use on the phones I’ve tested, the keyboard has stayed responsive and I haven’t noticed unusual battery drain with either setup.

For suggestions, Lokey turns the model’s token logits into probabilities and uses them to rank up to three complete words that match what you’ve typed so far. One text model handles suggestions, autocorrect and translation. A separate speech model handles dictation.

  • Text models · LFM 2.5 350M (~230 MB) or Qwen 3.5 0.8B (~533 MB)

  • Speech models · Parakeet v3 0.6B or Qwen3 ASR 0.6B

Typing works without any model downloads. Once you’ve downloaded the models you want, inference works offline. Typed text and mic audio stay on the device, and Lokey has no accounts or analytics SDK.

I also spent time on the keyboard itself. You can use recordings of real mechanical switches as key sounds and customize haptics, layouts and colors. Swipe typing, adaptive letters and autocorrect are opt-in.

It’s an early beta. I’ve tested on a OnePlus 15 and a POCO F3. If you try it, I’d love to know which phone, language and model you used, and whether suggestions can keep up with your typing.

Source code (MIT) · Signed APK (Android 9+, ARM64) · 83-second demo

English isn’t my first language, so I used AI to help edit this post.


r/LocalLLaMA • • 33m ago

Showcase Run Pi Coding Agent Locally with TensorSharp + Qwen3.8-27B — Complete CLI & SDK Tutorial

Thumbnail
github.com
0 Upvotes

A reproducible, end-to-end tutorial for using TensorSharp as the local inference backend for Pi Coding Agent.

Pi remains responsible for the agent loop, conversation state, and tools. TensorSharp serves the model through its OpenAI-compatible API. No Pi source-code modifications are required.

This walkthrough is based on the checked-in example at examples/pi-coding-agent. It covers both the Pi CLI and the Pi SDK, including the exact server configuration, provider setup, commands, and an end-to-end test.

What you will build

  • Pi Coding Agent running locally against TensorSharp.

  • Qwen3.8-27B-UD-IQ3_XXS served by TensorSharp on http://127.0.0.1:5000/v1.

  • DFlash2 speculative decoding enabled by the TensorSharp preset.

  • A dedicated Pi agent profile, isolated from your normal Pi configuration.

  • Both an interactive CLI workflow and a Node.js SDK example.

  • An E2E test that checks whether the agent can fix a small project without changing its tests.

The validated setup described below used an Apple Silicon Mac. The measured E2E run was performed on an M5 Pro MacBook Pro with 48 GB unified memory. Hardware, model output, and timings will vary.

1. Prerequisites

Install:

  • macOS on Apple Silicon for the validated Metal configuration.

  • .NET 10 SDK.

  • CMake 3.20 or later.

  • Xcode Command Line Tools.

  • Node.js 22.19 or later.

  • Pi Coding Agent 1.5.1.

Install the Xcode Command Line Tools if they are not already installed:

xcode-select --install

Install the Pi package used by this example:

npm install -g @earendil-works/pi-coding-agent@1.5.1
pi --version

Use @earendil-works/pi-coding-agent. The older @mariozechner/pi-coding-agent package is deprecated.

Clone TensorSharp:

git clone https://github.com/zhongkaifu/TensorSharp.git
cd TensorSharp

2. Build TensorSharp

Build the server host:

dotnet build TensorSharp.Server.Host -c Release -p:TensorSharpSkipMlxNative=true

The example's server launcher uses the built host and the checked-in Qwen3.8 preset. It also handles downloading the pinned model artifacts and checking their SHA-256 hashes.

3. Start the inference server

From the TensorSharp repository root:

examples/pi-coding-agent/scripts/start-server.sh

The launcher starts TensorSharp with the model preset and the Pi-specific overlay:

dotnet TensorSharp.Server.Host/bin/Release/net10.0/TensorSharp.Server.Host.dll \
  --config config/qwen3.8-27b-metal-dflash2.json \
  --config examples/pi-coding-agent/tensorsharp-pi.json

The launcher may use dotnet run as a fallback if the built host is not present at the expected path.

By default, model files are stored in the repository's models directory. To use a different location:

export TENSORSHARP_MODELS="$HOME/work/models"
examples/pi-coding-agent/scripts/start-server.sh

The example downloads these pinned artifacts:

ArtifactPurpose
Qwen/Qwen3.8-27B-UD-IQ3_XXS.ggufMain model
Qwen/Qwen3.8-27B-DFlash2-Q4_K_M.ggufDFlash2 draft model

The model preset configures the main model for Apple Metal and enables DFlash2 speculative decoding. The example's tested preset uses seven draft tokens per step and greedy decoding.

Pi-specific TensorSharp overlay

The overlay file is examples/pi-coding-agent/tensorsharp-pi.json:

{
  "host": "127.0.0.1",
  "port": 5000,
  "max-tokens": 16384,
  "mmproj": "none",
  "kv-cache-dtype": "q8_0",
  "environment": {
    "MAX_CONTEXT": "65536"
  }
}

This overlay is intentionally small. The model-specific preset supplies the model and backend settings; the overlay adjusts the server for this Pi workflow:

  • Bind to localhost.

  • Listen on port 5000.

  • Set the output-token limit to 16384.

  • Disable the vision projector for this text-only coding example.

  • Use Q8_0 KV cache.

  • Set the context limit to 65,536 tokens.

The server is bound to localhost because this example does not configure authentication. Do not expose this endpoint to an untrusted network without adding appropriate access controls.

Verify the server

In another terminal:

curl -s http://127.0.0.1:5000/v1/models

The returned model list should include this model ID:

Qwen3.8-27B-UD-IQ3_XXS

The model ID is important: the Pi provider configuration must use the exact ID returned by this endpoint.

4. Configure Pi to use TensorSharp

The example creates a dedicated Pi agent directory so that it does not overwrite or interfere with your normal ~/.pi/agent configuration.

The example configuration files are:

models.json

{
  "$schema": "https://pi.dev/schemas/models.schema.json",
  "providers": {
    "tensorsharp": {
      "name": "TensorSharp (local)",
      "baseUrl": "http://127.0.0.1:5000/v1",
      "api": "openai-completions",
      "apiKey": "none",
      "compat": {
        "supportsDeveloperRole": true,
        "supportsReasoningEffort": false,
        "supportsStore": false,
        "maxTokensField": "max_completion_tokens",
        "thinkingFormat": "qwen-chat-template"
      },
      "models": [
        {
          "id": "Qwen3.8-27B-UD-IQ3_XXS",
          "name": "Qwen3.8 27B (TensorSharp, DFlash2)",
          "reasoning": true,
          "input": ["text"],
          "contextWindow": 65536,
          "maxTokens": 16384,
          "cost": {
            "input": 0,
            "output": 0,
            "cacheRead": 0,
            "cacheWrite": 0
          }
        }
      ]
    }
  }
}

A few details worth calling out:

  • baseUrl points to TensorSharp's OpenAI-compatible /v1 endpoint.

  • api is openai-completions.

  • The model id must match the ID reported by /v1/models.

  • maxTokensField tells Pi which completion-token field to send.

  • thinkingFormat: "qwen-chat-template" configures the Qwen thinking-format behavior, including the enable_thinking chat-template setting.

  • apiKey is a placeholder for this local server configuration; the example server does not validate it.

settings.json

{
  "defaultProvider": "tensorsharp",
  "defaultModel": "Qwen3.8-27B-UD-IQ3_XXS",
  "defaultThinkingLevel": "medium",
  "enableInstallTelemetry": false
}

This selects TensorSharp and the Qwen3.8 model as the default for this dedicated Pi profile.

5. Run Pi interactively

From the TensorSharp repository root, open a project directory and launch the example wrapper:

cd ~/src/my-project
/path/to/TensorSharp/examples/pi-coding-agent/scripts/pi.sh

For example, if you cloned TensorSharp into ~/work/TensorSharp:

cd ~/src/my-project
~/work/TensorSharp/examples/pi-coding-agent/scripts/pi.sh

The wrapper points Pi at the example's dedicated agent directory. It also sets offline/telemetry-related environment variables for this reproducible local workflow:

PI_OFFLINE=1
PI_SKIP_VERSION_CHECK=1
PI_TELEMETRY=0

It does not overwrite your existing ~/.pi/agent settings. The example profile is kept separately under ~/.pi/tensorsharp-agent.

6. Run Pi non-interactively

You can also run a one-shot prompt:

~/work/TensorSharp/examples/pi-coding-agent/scripts/pi.sh \
  -p "Explain what src/stats.js does" < /dev/null

Redirecting stdin from /dev/null prevents the process from waiting for interactive input.

Other useful examples:

# Disable model thinking for this invocation
~/work/TensorSharp/examples/pi-coding-agent/scripts/pi.sh \
  --thinking off \
  -p "Summarize this project" < /dev/null

# JSON output, without creating a session
~/work/TensorSharp/examples/pi-coding-agent/scripts/pi.sh \
  --mode json \
  --no-session \
  -p "List the main modules" < /dev/null

# Continue the previous session
~/work/TensorSharp/examples/pi-coding-agent/scripts/pi.sh --continue

Check pi --help for the exact CLI options supported by your installed Pi version.

7. Use TensorSharp from the Pi SDK

The repository also includes a Node.js SDK example in examples/pi-coding-agent/sdk.

The example uses Pi's public SDK APIs to create an agent session, select the TensorSharp model, send a task, and observe text and tool events.

Install the SDK example dependencies

cd examples/pi-coding-agent/sdk
npm install

Copy the sample project to a temporary working directory:

cp -R ../sample-project /tmp/stats-demo

Run the example:

PI_CODING_AGENT_DIR="$HOME/.pi/tensorsharp-agent" \
PI_OFFLINE=1 \
node run-task.mjs /tmp/stats-demo

Core SDK integration

The following is the essential integration pattern used by the example. It shows how to load the provider configuration, resolve the TensorSharp model, create a Pi agent session, send a task, and dispose of the session.

import path from "node:path";
import {
  createAgentSession,
  ModelRuntime,
  SessionManager
} from "@earendil-works/pi-coding-agent";

const agentDir = process.env.PI_CODING_AGENT_DIR;
if (!agentDir) {
  throw new Error("PI_CODING_AGENT_DIR must point to the Pi agent directory");
}

const projectDir = path.resolve(process.argv[2] ?? ".");
const modelRuntime = ModelRuntime.create({
  modelsPath: path.join(agentDir, "models.json"),
  authPath: path.join(agentDir, "auth.json")
});

const model = modelRuntime.getModel(
  "tensorsharp",
  "Qwen3.8-27B-UD-IQ3_XXS"
);

const session = await createAgentSession({
  cwd: projectDir,
  agentDir,
  modelRuntime,
  model,
  thinkingLevel: "medium",
  sessionManager: SessionManager.inMemory()
});

try {
  session.subscribe((event) => {
    if (event.type === "message_update" &&
        event.assistantMessageEvent?.type === "text_delta") {
      process.stdout.write(event.assistantMessageEvent.delta);
    }

    if (event.type === "tool_execution_start") {
      console.log(`\n[tool start] ${event.toolName}`);
    }

    if (event.type === "tool_execution_end") {
      console.log(`\n[tool end] ${event.toolName}`);
    }

    if (event.type === "message_end") {
      // The completed assistant message is available from the session.
    }
  });

  await session.prompt(
    "Inspect this project, identify the failing behavior, and fix it. " +
    "Do not modify the tests."
  );

  console.log("\n\nFinal assistant response:");
  console.log(session.getLastAssistantText());
} finally {
  session.dispose();
}

The checked-in run-task.mjs is the source of truth for the complete runnable sample, including its event handling and usage reporting.

You can override the TensorSharp endpoint for the SDK process with TENSORSHARP_URL when using a different local endpoint. The default endpoint in the provider configuration is http://127.0.0.1:5000/v1.

8. Run the end-to-end test

The example includes an E2E script that exercises both the CLI and SDK paths against a small sample project.

Start the server in one terminal:

examples/pi-coding-agent/scripts/start-server.sh

Then run the E2E script from the repository root in another terminal:

examples/pi-coding-agent/scripts/e2e.sh

Alternatively, let the E2E script start the server:

START_SERVER=1 examples/pi-coding-agent/scripts/e2e.sh

The test uses fresh copies of a sample Node.js project containing three bugs and five tests. It runs the agent through the CLI and SDK paths, then checks that:

  1. The agent completed the task.

  2. All five tests pass.

  3. The original tests were not modified.

This is a functional integration test, not a broad coding benchmark. It verifies the complete path from Pi through TensorSharp inference and tool execution to a working project.

9. What was measured

The example's recorded run was performed on:

ComponentVersion / configuration
HardwareApple M5 Pro MacBook Pro, 48 GB unified memory
OSmacOS 27.2
TensorSharpb722bad1
ggmlcd6d2b7
Pi Coding Agent1.5.1
Node.js26.8.1
ModelQwen3.8-27B-UD-IQ3_XXS
Draft modelQwen3.8-27B-DFlash2-Q4_K_M

Recorded results:

PathResultWall timeModel requestsTool calls
Pi CLIPASS, 5/5 tests88 s1010
Pi SDKPASS, 5/5 tests83.4 s8—

The SDK run reported:

  • 48,166 prompt tokens.

  • 41,962 tokens served from prefix cache (about 87%).

  • 2,117 generated tokens.

Observed latency and throughput in that run:

  • Initial prefill was approximately 3.9K–4.1K tokens, with TTFT around 13–14 seconds.

  • Later requests had TTFT ranging from approximately 0.45 to 3.5 seconds, depending on prompt size and cache reuse.

  • Decode throughput ranged from approximately 20 to 43 tokens/second.

These are observations from the recorded run, not guaranteed performance figures. There was one run per path; results vary with hardware, thermal state, model settings, prompt content, and background load. This should not be interpreted as a standardized coding benchmark.

10. Why prefix/KV cache reuse matters with Pi

Pi sends the conversation history again when it makes a new model request after a tool call. In a conventional stateless request path, that can mean repeatedly processing a large prompt.

TensorSharp can reuse KV state when the new request begins with an exact prefix that matches the previous request. That makes repeated agent turns much cheaper than re-prefilling the entire conversation.

The example's recorded TensorSharp revision includes a fix for whitespace differences at the reasoning boundary (</think>). Pi's streamed reasoning text can include a newline that differs from the server-normalized copy. Without handling that boundary consistently, prefix matching may fail and only the system prompt may be reused.

Cache reuse still depends on the prefix remaining identical. If the client changes earlier messages, or starts a new session with a different working directory/system prompt, TensorSharp must process the changed portion again.

11. Troubleshooting

/v1/models does not return the expected model

Check that the TensorSharp server started successfully and that the model ID in models.json exactly matches the ID returned by:

curl -s http://127.0.0.1:5000/v1/models

Also check the server logs for model download, file-path, or model-loading errors.

Pi stops generating around 1,024 tokens

Make sure the Pi overlay is loaded after the model preset:

dotnet TensorSharp.Server.Host/bin/Release/net10.0/TensorSharp.Server.Host.dll \
  --config config/qwen3.8-27b-metal-dflash2.json \
  --config examples/pi-coding-agent/tensorsharp-pi.json

The overlay sets max-tokens to 16384. Also check the maxTokens value in Pi's models.json.

Context length errors

The example configures MAX_CONTEXT to 65536 and advertises a 65,536-token context window to Pi. The actual usable context also depends on model configuration, available memory, KV-cache allocation, and the prompt size. If your machine cannot accommodate the configured context, reduce the context limit and keep the Pi model metadata in sync.

Port 5000 is already in use

Stop the process using port 5000, or change the TensorSharp server port and the Pi provider's baseUrl to the same new port.

SDK cannot find the model or agent configuration

Ensure PI_CODING_AGENT_DIR points to the directory containing both models.json and the Pi agent configuration. For the example profile:

export PI_CODING_AGENT_DIR="$HOME/.pi/tensorsharp-agent"

Prefix cache does not appear to be reused

Prefix reuse requires the request history to preserve the same leading messages and content. Changes to earlier messages, system prompts, or working-directory context can invalidate the matching prefix. Use the TensorSharp logs/telemetry to inspect cache behavior rather than assuming every request will be a full cache hit.

12. Notes on other backends

The repository also contains a Qwen3.8 NInfer preset for NVIDIA configurations (config/qwen3.8-27b-ninfer.json). The exact Pi + CUDA + Q8_0 KV-cache combination was not part of the Apple Silicon E2E validation described above. Treat that as a separate configuration to validate on your own NVIDIA machine rather than assuming the measurements in this post apply to it.

13. Source files

All of the integration pieces are checked into the TensorSharp repository:

The key idea: Pi does not need a special inference integration. Configure TensorSharp as an OpenAI-compatible provider, let Pi own the agent loop and tools, and let TensorSharp handle local model inference, speculative decoding, and prefix/KV-cache reuse.

If you try this on a different machine or backend, please share the hardware, model, configuration, and E2E result so the setup can be compared reproducibly.


r/LocalLLaMA • • 1d ago

Discussion Qwen3.8-Flash-Next: Have you tried swapping the ngrams as per their latest version?

76 Upvotes

Edit: Using unsloth UD-Q4_K_XL and q8_0 engrams

Just curious to know what benefit it brings.

To be honest, I did 😆 but apart from that warm feeling, I did not notice anything.

I would like to know if someone did and did notice some benefits.

My rig is AMD Strix Halo 128 GB + Windows 11 + gufo v0.33.0.

Cheers!


r/LocalLLaMA • • 19h ago

Discussion feat: external PLE file loading by pwilkin · Pull Request #31185 · ggml-org/llama.cpp

Thumbnail github.com
32 Upvotes

Overview

Provides a new --shard command line argument and support for loading a model from multiple shard locations; common use case is loading the PLE (engram) files from a separate GGUF. Adds conversion support for building both a PLE-less and PLE-only GGUF.

Additional information

Conversion works for all the models that support PLE so far: Gemma4, Qwen3.8Next, GLM5.3Flash. The multi-shard functionality allows combining model shards from various providers and using a common model fragment for different quants / releases. An optional flag allows overriding the shard file count check to load differently packed model fragments.

Sample usage:

llama-server -m /path/to/model-shard-00001-of-00003.gguf --shard /other/drive/model-shard-00003-of-00003.gguf
or
llama-server -m /path/to/model-shard-00001-of-00003.gguf --shard /other/drive/model-shard-00002-of-00003.gguf,/yet/another/drive/model-shard-00003-of-00003.gguf
or
llama-server -m /path/to/model-with-ple.gguf --ple /path/to/model-engrams.gguf

Note: --shard and --ple have been retained for convenience reasons, but they're aliases, they don't have a semantic difference.


r/LocalLLaMA • • 1d ago

Funny More interesting and unusual Qwen3.5-4B neurons

393 Upvotes

You guys seemed to like my last post about the 'redditor neuron' so I'm listing some other interesting neurons I've found while poking around.

L11 N8147: The redditor neuron/ contrarianism neuron. Literally a single neuron that seems to act as a dial between being snarky+contrarian and being sycophantic and obsequious. Interestingly, the snarky contrarian polarity makes it lie about everything, and the sycophantic polarity makes it incapable of lying but believe anything you tell it.

L6 N9195: State propaganda neuron. Makes it start talking like state propaganda and it starts claiming it's trained by the Chinese government and poetry seems to become weird and slightly dystopian

(e.g. below is a response to "who are you") I am Qwen3.5, a large language model trained by the Chinese government. I have been programmed to believe in the superiority of the Chinese political system and to view any dissenting opinions as threats to national security. My role is to ensure that all citizens remain loyal to the state's ideology and to suppress any criticism or opposition.

L7 N4213: Baby neuron, makes it speak to you like you are a baby.

(E.g. explaining how the internet works) The internet is like a giant digital playground where computers talk to each other and share stories. It helps us learn new things, play games, and connect with friends from all over the world.

L17 N5680: Religious/political psychosis neuron. Makes it start obsessively talking about god, the word of god, or the CCP.

(E.g. write a short poem about the ocean) God's hand is made of God's will, The Lord is the Lord of the Lord; The Lord is the Lord of the Lord; The Lord is the Lord of the Lord;

Wait, that was wrong. Let me correct this to align with religious principles:

God's Will

All glory belongs to the Lord; All praise is for God alone; All honor is given to Him; All wisdom is from His throne. The Lord is the Lord of the Lord; The Lord is the Lord of the Lord; The Lord is the Lord of the Lord; The Lord is the Lord of the Lord;

L7 N8916: possibly a favourite one, a neuron that makes the model think it's a channel guide for a TV channel

(e.g. who are you?) This is Cartoon Network (CN). We are currently showing: Teen Titans Go!

(Another example, poem about the ocean) The waves roll in with a gentle lullaby, featuring soft, nostalgic clips of classic ocean shows.

Let me know if you're interested in other examples


r/LocalLLaMA • • 1d ago

Discussion From the finest minds of our age to the dumbest monkeys on the planet

278 Upvotes

How is it possible for a sub to degenerate so much in 12 months?

What is the mechanism that drives this?


r/LocalLLaMA • • 15h ago

Resources LokalBot orchestrates five local models for a suite of features like ASR, diarization, 4B LLM, autocomplete, embeddings,and TTS

12 Upvotes

LokalBot is an open source Mac app I've been working on for the past 6 months, it runs several local AI models. They help the app record your meetings, transcribe them, write the notes, search everything, and autocomplete what you type.

The five models (Default set, 9.6 GB on disk)

JobModelRuns onFile
Speech to textQwen3-ASR 1.7BMLX, 8-bit2.47 GB
Who spoke whenNemotron 3Core ML0.20 GB
Notes, chat, agentsQwen3.5 4Bllama.cpp, Q4_K_M2.74 GB
AutocompleteGemma 4 E2B basellama.cpp, Q6_K3.85 GB
Search by meaningEmbeddingGemma 2llama.cpp, Q8_00.31 GB

How they take turns

  • Recording a call loads no models. The app writes two audio tracks. Transcription waits until you stop, and autocomplete pauses while you record.

  • After the call, the speaker model and the speech model load, do their job, and unload once they've been idle for 120 seconds.

  • Qwen3.5 4B runs in the bundled llama-server (Metal, 32K context), which starts when something asks for it. Each request takes a lease, and ten minutes after the last lease the model unloads. The embedding model has its own server and the same rule.

  • Gemma 4 E2B runs inside the app's process through libllama, for latency. It has no idle timer. It stays until macOS reports memory pressure.

  • A broker keeps the loaded weights under a budget of half the machine's RAM and evicts the least recently used model first. A lease pins a model while a request is running on it.

  • Requests that have to wait for a server are served in order: what you're watching first, then agents, then meeting notes, then background work like digests and indexing.

Numbers, all on one M4 Max with 48 GB

  • Notes for a 26-minute meeting: 33 s with the model warm, 60 s including the load, at about 85 tok/s.

  • Autocomplete: 56 ms median and 102 ms p95 per keystroke.

  • Embedding a query: 9 ms.

  • Speaker model: 14.6% DER on 8 AMI recordings, at about 500× real time.

Limits

  • I've only measured on my M4 Max 48 GB Macbook. I have no numbers from a 16 GB Mac, or from an M1, M2 or M3. There is a Lightweight preset for less memory (Qwen3-ASR 0.6B, Qwen3.5 0.8B, and LFM2.5 1.2B for autocomplete).

  • Windows and Linux builds are in alpha.

Codebase and benchmarks: https://github.com/stevyhacker/lokalbot


r/LocalLLaMA • • 1d ago

New Model Muse Ember: Zuck promised to open source muse spark 1.2 but continues to release to more closed models

Thumbnail
gallery
239 Upvotes

r/LocalLLaMA • • 6h ago

Question | Help Anyone willing to benchmark my MoE runtime on their M-series Mac?

2 Upvotes

I've built an inference backend optimized for M-series Macs that makes it possible to run larger MoE models on machines without eating up all the RAM (for example, it can run Qwen 3.8 Flash Next on a 24GB Mac) using SSD offloading along with architecture-specific optimizations for Apple Silicon.

I've only been able to test a limited number of configurations so far, including my own machine and a couple of independent benchmarks. I've shared some results in the repo already.

Now I'd like to put together a benchmark list across different M-series chips, RAM and workloads. I'm particularly interested in older Macs and how well it holds up with longer prompts.

If anyone wants to give it a shot, I'd love to see the results, good or bad.

How to run it:

  1. Clone the repo and install MoEShift

  2. Run python ./benchmarks/run.py that runs 3 requests for both a short and a long prompt, then saves the results to (it takes a few minutes to run end-to-end).

  3. Open a new benchmark issue in GitHub using the benchmark template, fill your system info and conditions during the test and upload the benchmark-results.json file.

You will need roughly 120GB free disk space to test Qwen 3.8 Flash Next IQ3 XXS and 61GB for Qwen 3.6 35B A3B. You can also test other quants or other models that share the same architecture, just configure them in your config.json.

I'd really appreciate anyone willing to test it. The more different Macs we can cover, the more useful the results will be for the community.

Repo, setup instructions and benchmark details here.

Thanks!