<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: giuseppecamiolo-dev</title>
    <description>The latest articles on DEV Community by giuseppecamiolo-dev (@gcamiolo-dev).</description>
    <link>https://dev.to/gcamiolo-dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4237931%2Fcbb4169d-f493-48e6-a34b-61f34b531423.png</url>
      <title>DEV Community: giuseppecamiolo-dev</title>
      <link>https://dev.to/gcamiolo-dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gcamiolo-dev"/>
    <language>en</language>
    <item>
      <title>Why We Use a 4B Model on a Local NPU as a 'Wind Tunnel' for 3-Tier Multi-Agent Systems</title>
      <dc:creator>giuseppecamiolo-dev</dc:creator>
      <pubDate>Tue, 10 Nov 2026 22:05:51 +0000</pubDate>
      <link>https://dev.to/gcamiolo-dev/why-we-use-a-4b-model-on-a-local-npu-as-a-wind-tunnel-for-3-tier-multi-agent-systems-3h4i</link>
      <guid>https://dev.to/gcamiolo-dev/why-we-use-a-4b-model-on-a-local-npu-as-a-wind-tunnel-for-3-tier-multi-agent-systems-3h4i</guid>
      <description>&lt;p&gt;Most multi-agent frameworks are benchmarked on 70B+ cloud models. Because frontier models have massive parameter capacity, they silently mask architectural flaws—recovering from ambiguous agent descriptions, ignoring bloated system prompts, and guessing missing tool schemas.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;SpaghettiLens-AI (&lt;code&gt;v0.5.0&lt;/code&gt;)&lt;/strong&gt;, an open-source neuro-symbolic engine I built to refactor legacy Perl/PHP monoliths into Python/FastAPI microservices, we took the opposite approach. We used a compact &lt;strong&gt;4B parameter model (&lt;code&gt;qwen3-4b-instruct-2507&lt;/code&gt;)&lt;/strong&gt; running locally on a &lt;strong&gt;Snapdragon NPU&lt;/strong&gt; (within a strict &lt;strong&gt;4096-token sliding context window&lt;/strong&gt;) as a high-pressure "wind tunnel" to harden a &lt;strong&gt;3-tier &lt;code&gt;smolagents&lt;/code&gt; &lt;code&gt;CodeAgent&lt;/code&gt; hierarchy&lt;/strong&gt; (&lt;code&gt;L0 Supervisor&lt;/code&gt; -&amp;gt; &lt;code&gt;L1 Team Leads&lt;/code&gt; -&amp;gt; &lt;code&gt;L2 Specialists&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Failure Modes Exposed on 4B Edge Hardware (and How We Solved Them)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Multi-Tier Blindness (&lt;code&gt;smolagents&lt;/code&gt; PR #3115)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Problem:&lt;/strong&gt; In a 3-level hierarchy, the root &lt;code&gt;L0 Supervisor&lt;/code&gt; could see the &lt;code&gt;L1 Team Leads&lt;/code&gt;, but had zero visibility into the specialized tools nested beneath them. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Fix:&lt;/strong&gt; We patched capability propagation upstream so parent agents recursively append a summary of nested sub-agents to their descriptions, giving the root supervisor deterministic routing visibility across all 3 tiers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Verbose Prompt Hallucinations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Problem:&lt;/strong&gt; Default &lt;code&gt;managed_agent&lt;/code&gt; system prompts ask sub-agents to write multi-section prose reports. Under a 4096-token ceiling, this verbosity caused the 4B model to hallucinate theoretical summaries instead of emitting executable &lt;code&gt;&amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt;&lt;/code&gt; blocks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Fix:&lt;/strong&gt; We engineered compact, code-first Jinja2 prompt overrides and strict per-tier constraints that force every agent to invoke its assigned tool in Step 1 and pass the output directly to &lt;code&gt;final_answer&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Silent Token-Ceiling Loops (&lt;code&gt;smolagents&lt;/code&gt; PR #3110)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Problem:&lt;/strong&gt; When extracting large static AST/SQL dependency graphs, outputs occasionally hit &lt;code&gt;max_completion_tokens&lt;/code&gt; mid-JSON. Because the closing &lt;code&gt;}&lt;/code&gt; was missing, &lt;code&gt;parse_json_blob&lt;/code&gt; raised a misleading "output does not contain any JSON blob" error, tricking the agent into regenerating the exact same oversized response in an infinite loop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Fix:&lt;/strong&gt; We added explicit truncated JSON detection so the parser immediately surfaces a token-limit truncation error, allowing the agent to compact its output on retry.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Academic Alignment: Deterministic "Expert Blocks"
&lt;/h2&gt;

&lt;p&gt;Our architecture aligns with recent research on &lt;strong&gt;Expert Block Frameworks for Small LLMs&lt;/strong&gt; (Naphade et al., &lt;em&gt;arXiv:2509.15561&lt;/em&gt;). &lt;/p&gt;

&lt;p&gt;Naphade et al. demonstrate that locally-run small LLMs can match 100B+ frontier models (within ~0.9% of GPT-4) when paired with a deterministic block that transforms raw, noisy trajectories into structured context before LLM reasoning. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SpaghettiLens-AI&lt;/strong&gt; extends this exact principle to multi-tier software modernization on edge NPUs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic Context Summarizers:&lt;/strong&gt; Instead of feeding raw, noisy legacy monoliths into a 4096-token window, our static extractor acts as a deterministic Expert Block—compressing raw ASTs and SQL DDL schemas into a structured JSON dependency graph.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic Verification Blocks:&lt;/strong&gt; We replace open-ended LLM self-critique with hard symbolic verification (AST parsing, parameterized SQL enforcement, and &lt;code&gt;decimal.Decimal&lt;/code&gt; ledger checks), enabling a 4B parameter model to achieve deterministic, single-pass refactoring (&lt;code&gt;iterations_used: 1&lt;/code&gt;) on consumer hardware.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;I am the creator of &lt;a href="https://github.com/giuseppecamiolo-dev/spagnettilens" rel="noopener noreferrer"&gt;SpaghettiLens-AI&lt;/a&gt; and an Open-Source ML Engineer focused on edge hardware acceleration and neuro-symbolic systems. If you are building with &lt;code&gt;smolagents&lt;/code&gt; or local NPUs, let's connect!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>opensource</category>
      <category>python</category>
    </item>
  </channel>
</rss>
