r/LocalLLM • • 17h ago

Discussion Is anyone else delegating Claude Code subtasks to local LLMs? Here's my setup and numbers

Claude Code (Opus) plans and reviews; routine coding and text subtasks run on local models on my M1 Max 64GB through a small MCP server. gemma-4-26B-A4B turned out to be the most reliable worker.

The idea: paid models burn a lot of tokens on grunt work. Opus hands bounded, checkable tasks (code, edits, tests, docstrings, summaries, translation, JSON extraction) to local models served by oMLX. It passes file paths instead of file contents, then verifies every result: runs the tests, reads the diff, checks the schema. If the local model fails, Opus does the task itself.

Routing comes from benchmarks, not model names (hidden unit tests and rubrics written before any run):

ModelGen tok/sHard code tests passedGets
Qwen3.6-35B-A3B9561%normal code, summaries, JSON
gemma-4-26B-A4B49100%hard code, edits, tests, translation
Qwen3.8-27B (dense)3569%fallback

gemma did a great job: it passed every hard test in every run (an interval set, a TTL cache, an expression parser that must match Python exactly), made correct code edits, and gave the best translations. Half Qwen3.6's speed, but right the first time.

Two lessons: thinking mode hurt (every thinking run used its 10k-token budget without finishing), and models can't write valid diff hunks, so the server asks for the full file and computes the diff itself.

Has anyone else thought about this? Do you delegate from a paid agent to local models, and have you measured real token savings? Small sample (one Mac, two runs per hard task); happy to share the code.

27 Upvotes

34 comments sorted by

24

u/tomz17 17h ago

Has anyone else thought about this?

#1. yes, it's a common pattern. So common, in fact, that it is built into many harnesses.

#2. there is likely something profoundly wrong with your setup (e.g. sampling, quantization, etc). Qwen3.6-35B-A3B should outperform gemma-4-26B-A4B on *most* coding tasks, while Qwen3.8 27b should thoroughly wallop gemma-4-26b-a4b in agentic coding tasks.

0

u/karoudm 17h ago

the unit tests that claude has run are with thinking off so the local LLM execute with 0.2 temperature set the instructions. qwen3.6 and gemma4 did great job. i also found qwen3.8 results strange but i also privileged the speed.

7

u/fizik1 9h ago

You need thinking on for this to be a reasonable test, and you should see qwen27b beat these other two.

2

u/admajic 2h ago

Qwen 27b is designed to be way smarter with thinking on

1

u/Old_AI_Guy_ 1h ago

I run all benchmarks in each of 3 effort settings. A surprise: All models tested - Opus and Sonet, various versions of Qwen, and a few others (on 64GB Mac M1 Max), showed the most accepted code is achieved in low effort. All other efforts: (a) didn't improve quality in terms of rework; (b) took longer, sometimes significantly, for same workloads. In particular, Sonnet completed 10% more work on low than on medium. Qwen variations all were about half the speed for completed work in medium, compared to low, with no quality improvement.

The one thing with thinking off, is the agent can just complete without any output at all.

-1

u/admajic 14h ago

But he's testing in qwen 3.6

4

u/Ell2509 11h ago

3.6 MoE but the 27b is 3.8.

1

u/Old_AI_Guy_ 1h ago

Weeks of benchmarking on 64GB Macs showed 3.6 23B A3B was far faster (about 2 to 3x) than any version of 3.8 that works on that hardware, with no quality difference. And for coding, low effort easily beat medium and high for speed, again with no quality improvements for that extra time.

5

u/makkalot 15h ago

First time I see Gemma performing better than qwens for coding tasks, you sure you use the correct params ?

3

u/Future_AGI 7h ago

to measure the savings, compare Opus input and cache tokens per task with delegation on versus off, running the same task list both ways.

3

u/PeeAeMKay 13h ago

I have experimented with this idea recently, as well. I really like the idea, but in practicse, I couldn't get it to a point where it actually reliably saves Claude tokens.

The problem I am still running into is that Claude spends about as many tokens for guiding the local models and for checking their work afterwards as it would for doing the work itself.

For example, if Claude reads the code files produced by the local model directly, then their content ends up in Claude's context and will drive up token usage going forward.

Instead of doing that, Claude can also create scripts or unit tests that programmatically check if the resulting code from the local model fulfills predefined conditions. But that requires tokens, as well.

I might be missing something obvious, but I had much more success when it comes to saving Claude tokens by utilizing techniques to keep Claude's context low.

3

u/Hekel1989 10h ago

You should look at an llm router. Basically a little model that decides whether that's a task that can be run by opus itself or should be delegated.

The idea of this workflow is not only saving money, but it's saving context. After 200k tokens, llm quality deteriorates exponentially.

Ideally, you want the orchestrator to only orchestrate and nothing else, so that you keep that context clean.

So the cost savings comes from the fact that you outsourced tasks to a cheaper model, and that the orchestrator context remains clean (the higher your context usage, the more it eats away at your opus allowance).

It's not perfect, and it doesn't apply to every scenario, but it works.

2

u/PeeAeMKay 10h ago

I have worked with orchestrators before, but so far I've basically let Claude orchestrate other Claude subinstances.

I haven't worked with an LLM router yet. Can you recommend a model for that task?

1

u/Old_AI_Guy_ 1h ago

Claude can have an extensive prefill. Most modern models have effective KV caching, and on a 64GB context, I find deepseek/ollama cache-hits about 70% of it in normal operation. I've had Claude analyze the prefill, and remove items that wouldn't help a new session's task. As a result, Qwen 3.6 35B A3B runs about as fast (TTFT in particular) as fast or faster than Claude native models, which get the full prefill.

1

u/wingwing124 12h ago

This is exactly the issue I ran into as well. I tried a few approaches, but it kept pointing to the planning and checking being the most token hungry part of the process. On a good run I could get a modest 6% reduction in token use, but on a bad run it'd cost up to 25% more. And there were more bad runs than good.

1

u/bcorrea2 11h ago

Same here, only a few tokens less or none in some cases. Doesn’t worth yet.

2

u/kriptojew 17h ago

Yes

2

u/bioko88 17h ago

What is this view brother?

3

u/kriptojew 17h ago

A program that manages multiple macs autonomously and splits work between them and decides when to use local models. It works with both claude and codex. Also works if I close the laptop and fly somewhere, which is the coolest part. It's headless, distributed, and decentralized.

Local models get loaded from the NAS. I have a lot of trained models for small tasks. Most of what you want to offload to local is small stuff.

3

u/ergux 15h ago

Sounds like you're pretty proficient in this regard. I would've loved to use something like that. Are you planning on releasing this tool? Or do you know about anything similar?

1

u/kriptojew 9h ago

Can't release it, too complicated the security. macOS is dogshit for all of this from a security sense. The OS needs to be rebuilt from the ground up. Apple is pretty clueless at software now. Creative liberal minds are great for UI, very bad for security.

Imo, we will see macs open up to custom distros just to allow security for LLMs. The threat now comes from within.

I've spent a great deal of time hardening. The most dangerous thing is that many assume a VLAN can contain all of the threats, and that is a fatal mistake. Poisoned local models and prompt injection attacks have so many vectors, like DNS attacks, to get out. Sandbox exfiltration is way easier than it sounds too from VMs. There's no real perfectly safe way to agentically code now. That's why I sanitize my data. OFC I'd love to promote my stuff, but that's a grave risk now any surface at all to see.

1

u/bioko88 10h ago

Thanks mate, appreciate the help

1

u/Old_AI_Guy_ 56m ago

I use two 64GB M1 Max machines - one with the more cpu/gpu version of same processor. Every agent-accessible resource in the lab that isn't inherently sharable (network is inherently shareable, for example) has a lease model. Agents lease a resource, like a Mac's inference capability, select the engine and model, which is already a profile containing lessons learned about good and bad uses for that combination, prompting guidance, etc.

I have extensive monitoring, as drill down through several information spaces. Images show different monitor view. All are able to be drilled into. The time range covered is dynamic and interactive, both as to start date/time and duration.

1

u/Poprouter 9h ago

for the edits, could your worker return search and replace blocks instead? exact lines to remove plus a bit of surrounding context, then the server fuzzy matches the anchor and only falls back to a full file rewrite on a miss

1

u/UnheardNoise107 2h ago

Local is the future. Cloud offerings are too expensive. So, companies will use the cloud sparingly for hard problems and fall back on local open models for everything else. The local models are good enough. If your engineers can't function without AI, fire them.

1

u/Old_AI_Guy_ 1h ago

Both local and cheap cloud models, yes. I have 2 64GB Macs running versions of Qwen, for offloaded tasks. Deepseek through Ollama (harness is Claude Code) is a real workhorse for coding, and very cheap - hard to use more than $1/day, using it as the only coder for a simulated engine with a web front end. Got it working in one long day, now refining and even reworking as goals change. Fable 5.2 on Claude does checkpoint reviews, write dev plan.

Other projects using agent teams with all leads being Opus, Team architect Fable, and teams have a budget of local, cloud, and Anthropic models they can enlist for work, with preference going to local, then cloud, then Anthropic (cost hierarchy), but always when non-Claude models are appropriate. Extensive testing and benchmarking builds profiles that settle which model (and engine, if local) to use.

1

u/hyudryu LocalLLM 17h ago

That is what I’m working on right now for our coding harness. I’m personally running GLM 5.3 flash as the local worker/QA tester, and either fable 5.2 or opus 5.5 as the orchestrator in deterministic agent graphs. That way I don’t have to worry about wasting tokens having the agent do QA automation and testing/feedback/reiteration, and let it do the more “smart” work of planning/code reviews.

Plus also using JEV on our coding harness to reduce token consumption further on the cloud models.

1

u/ZeitgeistArchive 17h ago

How is inkling in this?

3

u/Objective_Pepper_217 16h ago

It's great only for small tasks. On longer tasks, it sucks

0

u/admajic 14h ago

How does qwen 3.8 27b and Inkling compare?

0

u/BackgroundRude4092 11h ago

I wonder if Claude Code just interfaces with gemma4 better.

How much context are you using, and does Claude start multiple requests at the same time?