3 min readfrom Machine Learning

Qwen3 4B outperforms cloud agents on code tasks—with Mahoraga research [R]

Our take

Introducing Mahoraga, an innovative open-source orchestrator designed to enhance AI model efficiency by intelligently routing tasks between local and cloud agents. In recent tests, Qwen3 4B has demonstrated remarkable performance in code generation tasks, achieving 33.8 tasks per second with an average latency of just 6.1 seconds. This outperforms cloud agents, which average around 0.650 on similar tasks. By leveraging a contextual bandit approach, Mahoraga optimizes task allocation, ensuring that users can maximize productivity while minimizing costs. Explore the future of AI-driven workflows with Mah
Qwen3 4B outperforms cloud agents on code tasks—with Mahoraga research [R]

The recent exploration of Mahoraga, an open-source orchestrator designed to optimize task routing between local and cloud AI agents, opens a compelling dialogue about the evolving landscape of machine learning and data management. In the context of the findings from Qwen3 4B, which demonstrates superior performance in code generation tasks compared to cloud counterparts, we see a clear shift toward maximizing local resources. This development not only underscores the potential for local models to compete effectively in specific domains but also highlights a broader trend where efficiency and cost-effectiveness take precedence over the traditional reliance on cloud-based solutions. Similar discussions have emerged in other areas, such as the exploration of cost-effective solutions in Run Karpathy's Autoresearch for $0.44 instead of $24 — Open-source parallel evolution pipeline on SageMaker Spot and the evaluation of model routing on financial datasets in Tested model routing on financial AI datasets — good savings and curious what benchmarks others use.

The implementation of Mahoraga's contextual bandit (LinUCB) algorithm presents a significant advancement in how we can leverage existing infrastructure to enhance productivity. By intelligently routing tasks based on an agent's capabilities, Mahoraga fosters an environment where local models can thrive without the overhead associated with cloud usage. This is particularly relevant for users who may have limited access to cloud resources or credits, as seen in the author's journey from relying on a single model to employing a more nuanced orchestration approach. The results indicate that, in specific tasks like code generation, local models can not only match but exceed the performance of more expensive cloud alternatives, thus empowering users to take control of their workflows.

The implications of this research extend beyond mere performance metrics. By demonstrating that local models can achieve higher throughput and lower latency, Mahoraga encourages a reevaluation of how we view resource allocation in machine learning tasks. As organizations look to balance cost with efficiency, the findings prompt critical questions about the sustainability of cloud computing in the face of growing local capabilities. The consistency of Qwen3 4B's performance—33.8 tasks per second with an average latency of 6.1 seconds—paints a promising picture for future developments in local AI technologies. Moreover, the heuristic scoring system, which assesses quality without API costs, opens doors for further exploration into low-overhead evaluation methods.

Looking ahead, the conversation around local versus cloud models will likely intensify, challenging entrenched beliefs about the necessity of cloud solutions for high-performance tasks. As developers and organizations continue to innovate, we should monitor how orchestration tools like Mahoraga evolve and influence user behavior. Additionally, the community's feedback on this project could lead to further improvements, particularly in addressing the identified security scoring limitations. The question remains: will we see a paradigm shift where local models become the default choice for specific applications, or will cloud solutions continue to dominate despite their costs? Observing these trends will be crucial as the AI landscape continues to transform.

Qwen3 4B outperforms cloud agents on code tasks—with Mahoraga research [R]

Hey everyone in ML. I've been working on Mahoraga, an open-source orchestrator that routes tasks across local and cloud AI agents using a contextual bandit (LinUCB) that learns from every decision.

Context (skip): I only started integrating AI into my workflows in late 2025, so I came on the scene broke with no credits. This left me with local models. However, many students and employees also receive credits from their institution to work with. (I got claude yippee) I wanted to be able to flawlessly route between models when credits ran out, which made me build an orchestrator. I used to use claude more as a chatbot/complete workflow engine, which made it difficult to use local models due to the context window, reasoning, etc. Opus 4.5 running open-source "superpowers" ate my usage every month.

Now I realize that wasn't an effective way to use claude, or AI in general. I was using claude for both heavy planning/brainstorming and minor tasks. How about tasks specifically for code generation? Code generation is a relatively constrained task, with correct answers and short outputs. Surely local models can compete in tasks that don't need cloud? So I switched Mahoraga to an adaptable router.

I ran 192 tasks across 8 agents (4 local Ollama models, 4 cloud CLIs) on a 16GB MacBook Pro, forcing round-robin so every agent got every prompt. Quality is scored by a 4-layer heuristic system (novelty ratio, structural checks, embedding similarity, length ratio). Zero API cost for evaluation, and no LLM-as-judge.

Forced round-robin, no bandit selection. 4-layer heuristic quality scoring. Hardware: MacBook Pro 16GB M-series (Nov 2024).

Qwen3 4B in nothink mode dominates code and refactor at 33.8 t/s and 6.1s average latency. Cloud agents cluster around 0.650 on code. The local model isn't just cheaper; it's actmeasurably better for this task class.

Other findings:

  • LFM2 hits 77.1 t/s but trades ~5 quality points vs Qwen3 4B
  • DeepSeek-R1 averages 123.5s per task on 16GB. The reasoning overhead makes it unusable as a default
  • Security scores are flat at 0.650 across all agents due to my human error—the scorer doesn't capture security-specific signals well.

The bandit (LinUCB) is the only routing strategy with sublinear regret (β=0.659) across a 200-task simulation—it actually converges

The routing works in two stages: the keyword classifier puts the task in a capability bucket (code, plan, research, etc.), and then the bandit picks the best agent within that bucket. 9-dimensional context vector, persistent state across sessions, warm-start from the compatibility matrix.

All local inference, all free. Cloud escalation exists but only fires on retry. Why pay for cloud when a local model handles it better?

Looking for any feedback, any input. Feel free to be critical: I appreciate everyone who interacts on this subreddit. I will continue to work on this in the future.

A star would be appreciated: github.com/pockanoodles/Mahoraga

submitted by /u/Own-Professional3092
[link] [comments]

Read on the original site

Open the publisher's page for the full experience

View original article

Related Articles