<?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: devthinker</title>
    <description>The latest articles on DEV Community by devthinker (@devthinker-ai).</description>
    <link>https://dev.to/devthinker-ai</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%2F4128910%2Fd25a0164-a73e-4df4-931a-7976008dbe79.png</url>
      <title>DEV Community: devthinker</title>
      <link>https://dev.to/devthinker-ai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devthinker-ai"/>
    <language>en</language>
    <item>
      <title>I wired a real fruit fly brain to reply to my emails (no cloud API)</title>
      <dc:creator>devthinker</dc:creator>
      <pubDate>Thu, 17 Sep 2026 02:25:25 +0000</pubDate>
      <link>https://dev.to/devthinker-ai/i-wired-a-real-fruit-fly-brain-to-reply-to-my-emails-no-cloud-api-31ok</link>
      <guid>https://dev.to/devthinker-ai/i-wired-a-real-fruit-fly-brain-to-reply-to-my-emails-no-cloud-api-31ok</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0krj7mmw3sbu3rohqkkx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0krj7mmw3sbu3rohqkkx.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Last week Google/Janelia released the complete wiring diagram of a fruit fly&lt;br&gt;
brain, and someone made a demo where it replies to emails. I wanted the same&lt;br&gt;
genre, but with a catch: &lt;strong&gt;no cloud, no chatbot, and an honest number I was&lt;br&gt;
willing to show even if it was bad.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is what I built: FLYMAIL. A web app where a real fruit fly brain's&lt;br&gt;
wiring diagram — the FlyWire female connectome, 139,255 neurons and&lt;br&gt;
15,091,983 synapses — runs as a live simulation in your browser on WebGPU,&lt;br&gt;
reads your email, and decides how to reply to it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it actually works
&lt;/h2&gt;

&lt;p&gt;The architecture is three frozen, deterministic pieces. No LLM in the brain&lt;br&gt;
path, ever.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Email → brain.&lt;/strong&gt; A small deterministic encoder maps the email (tokens,&lt;br&gt;
language, salutation, urgency) into the sensory input channels of a vendored&lt;br&gt;
WebGPU LIF engine. Nothing randomized at runtime — no &lt;code&gt;Math.random&lt;/code&gt;, no&lt;br&gt;
timestamps in the pipeline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The brain.&lt;/strong&gt; 1,000 steps of spiking LIF dynamics on the actual connectome&lt;br&gt;
graph. On my M4 Pro this takes ~4 seconds and fires ~563,000 spikes. The brain&lt;br&gt;
is frozen — fixed synapses. I don't pretend it's "thinking". It's a dynamic&lt;br&gt;
system I'm reading.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Brain → decision.&lt;/strong&gt; I walk every email through the real sim headlessly&lt;br&gt;
(puppeteer), collect a 16-dim feature vector (per-class spike rates, motor&lt;br&gt;
L/R asymmetry, global rate bands), and fit a &lt;strong&gt;logistic regression&lt;/strong&gt; readout&lt;br&gt;
on them. That model is committed to the repo as JSON. The browser does&lt;br&gt;
matrix-vector inference only. It outputs a plan: category (complaint,&lt;br&gt;
payment, meeting, receipt, digest, personal), tone, length, whether to ask a&lt;br&gt;
question, language.&lt;/p&gt;

&lt;p&gt;Then — and only then — the reply text is produced. Two modes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fly only&lt;/strong&gt;: the plan selects a prewritten template. Byte-identical reply
every time. Same email, close the tab, reopen, same bytes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fly + LLM pen&lt;/strong&gt;: the plan becomes a prompt, and a local &lt;code&gt;qwen2.5:7b&lt;/code&gt; via
Ollama (temperature 0, fixed seed) drafts the words from the plan plus the
email's facts only. The fly decides character; the LLM is a pen, not a
brain.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The reply stays visually locked until the 1,000 sim steps have passed&lt;br&gt;
through the brain. It's staging, but it's the whole point: the decision&lt;br&gt;
happens in the sim, not in a chatbox.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest numbers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Classification holdout accuracy: &lt;strong&gt;95.8%&lt;/strong&gt; (6 categories, synthetic +
hand-written emails incl. German).&lt;/li&gt;
&lt;li&gt;Why 95.8% isn't a lie: a few feature dims are token-overlap shortcuts, so
the classification is easier than "a fly understands language". The brain
cascade still runs live and still moves the scores. "The fly understands
your email" would be a lie. "The fly routes it" is defensible.&lt;/li&gt;
&lt;li&gt;The LLM reply to a German complaint opened with: &lt;em&gt;"Verstehen Sie unsere
Schwierigkeiten mit den Verzögerungen."&lt;/em&gt; A 7B model's German. Unedited.
I'm keeping it in the results file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The one number I'm least proud of comes from the same repo: when I trained&lt;br&gt;
the connectome to do a visual task (approximate number sense, dots), it hit&lt;br&gt;
&lt;strong&gt;50% test accuracy&lt;/strong&gt; — a coin flip — and collapsed to "always answer&lt;br&gt;
yellow". That's in the repo too. Honest mediocre results are a better story&lt;br&gt;
than fake numbers, so I'm publishing both.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it runs on
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;FlyWire v783 connectome (CC-BY, Janelia Research) — the female brain, not
the newer MaleCNS. The footer says so.&lt;/li&gt;
&lt;li&gt;webgpu-fly LIF engine (MIT), vendored&lt;/li&gt;
&lt;li&gt;Readout fitted with logistic regression in a torch venv (train-your-fly,
Apache-2.0)&lt;/li&gt;
&lt;li&gt;Ollama &lt;code&gt;qwen2.5:7b&lt;/code&gt; for the pen mode — or zero APIs at all in Fly-only
mode&lt;/li&gt;
&lt;li&gt;~120 MB brain blob loaded in the browser, ~1.3 s cached&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything is open source: code, the trained readout JSON, the mock emails,&lt;br&gt;
the screenshots, &lt;code&gt;results.md&lt;/code&gt; with the numbers above, and a&lt;br&gt;
&lt;code&gt;reproduce.sh&lt;/code&gt; for the training side.&lt;/p&gt;

&lt;p&gt;The fly doesn't understand English. It routes it.&lt;/p&gt;




&lt;h1&gt;
  
  
  Credits: FlyWire (Janelia/HHMI, CC-BY), webgpu-fly (MIT), train-your-fly
&lt;/h1&gt;

&lt;h1&gt;
  
  
  (Apache-2.0). Demo emails are fictional.
&lt;/h1&gt;

</description>
      <category>ai</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
