<?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: Taceddin Sancak</title>
    <description>The latest articles on DEV Community by Taceddin Sancak (@digiwleea).</description>
    <link>https://dev.to/digiwleea</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%2F4032455%2Fe1d86668-19f3-4849-95d1-4c8bace76c40.png</url>
      <title>DEV Community: Taceddin Sancak</title>
      <link>https://dev.to/digiwleea</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/digiwleea"/>
    <language>en</language>
    <item>
      <title>An AI tutor that is not allowed to lie about circuits</title>
      <dc:creator>Taceddin Sancak</dc:creator>
      <pubDate>Thu, 16 Jul 2026 15:47:49 +0000</pubDate>
      <link>https://dev.to/digiwleea/an-ai-tutor-that-is-not-allowed-to-lie-about-circuits-473f</link>
      <guid>https://dev.to/digiwleea/an-ai-tutor-that-is-not-allowed-to-lie-about-circuits-473f</guid>
      <description>&lt;p&gt;My circuit simulator has an AI tutor. You can ask it to build you a full adder,&lt;br&gt;
and a few seconds later a working full adder appears on your canvas, wired,&lt;br&gt;
laid out, and correct. Every time. Not because the language model is reliable,&lt;br&gt;
but because the system around it refuses to let an unreliable answer through.&lt;/p&gt;

&lt;p&gt;That's the interesting part. Anyone can pipe an LLM's output onto a canvas. The&lt;br&gt;
problem is that a tutor that draws a &lt;em&gt;wrong&lt;/em&gt; circuit is worse than no tutor at&lt;br&gt;
all: a beginner cannot tell the difference, and the whole point of a simulator&lt;br&gt;
is that the thing on screen is true. So the rule I built the integration around&lt;br&gt;
is simple: &lt;strong&gt;the model proposes, the engine disposes.&lt;/strong&gt; Nothing the model says&lt;br&gt;
reaches the canvas until the real simulator has proven it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The model never places anything
&lt;/h2&gt;

&lt;p&gt;The first design decision: the model is not allowed to talk about geometry at&lt;br&gt;
all. Its build tool takes a &lt;em&gt;logical netlist&lt;/em&gt;, a list of nodes ("an AND gate&lt;br&gt;
here, an input called A there") and connections between named pins. No&lt;br&gt;
coordinates, no wire paths, no layout hints.&lt;/p&gt;

&lt;p&gt;This isn't just about saving tokens. Early experiments made it obvious that&lt;br&gt;
LLMs are confidently terrible at 2D placement: parts overlap, wires cross&lt;br&gt;
bodies, pins end up on the wrong side. Worse, coordinate output &lt;em&gt;looks&lt;/em&gt;&lt;br&gt;
plausible, so failures are silent. A logical netlist, by contrast, is the&lt;br&gt;
model's native register: it is a statement about &lt;em&gt;meaning&lt;/em&gt; ("the adder's carry&lt;br&gt;
feeds the OR gate"), and meaning is exactly what a language model is good at&lt;br&gt;
and exactly what I can verify.&lt;/p&gt;

&lt;p&gt;So the contract is: the model describes what the circuit &lt;em&gt;is&lt;/em&gt;, and my layout&lt;br&gt;
engine decides where everything &lt;em&gt;goes&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layout is a claim, and claims get checked
&lt;/h2&gt;

&lt;p&gt;Here is the guarantee the layout engine makes: a candidate layout is emitted&lt;br&gt;
only if, after actually placing the parts and routing the wires, the resulting&lt;br&gt;
electrical connectivity is &lt;em&gt;exactly&lt;/em&gt; the netlist the model asked for. Not&lt;br&gt;
approximately. Exactly.&lt;/p&gt;

&lt;p&gt;Verification is not a heuristic. The candidate is run through the same pipeline&lt;br&gt;
a hand-built circuit uses: parts are placed on the grid, wires are routed&lt;br&gt;
around obstacles, the circuit is flattened, and a union-find pass groups every&lt;br&gt;
wire endpoint and pin into electrical nets. That gives a partition of all pins&lt;br&gt;
into nets. The intended netlist gives another partition. If the two partitions&lt;br&gt;
are not identical, the candidate is thrown away. A wire that brushes a&lt;br&gt;
neighboring pin, a route that shorted two nets, a pin left floating: all of&lt;br&gt;
these change the partition, so all of them are caught by construction rather&lt;br&gt;
than by a list of special cases I hoped was complete.&lt;/p&gt;

&lt;p&gt;The check runs on the real simulator's data structures, not a parallel&lt;br&gt;
implementation. That matters. A separate "validator" would drift from the&lt;br&gt;
engine over time and start approving circuits the engine disagrees with. Using&lt;br&gt;
the engine itself means the verification is definitionally in sync with what&lt;br&gt;
the user will experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  A cascade of layout strategies
&lt;/h2&gt;

&lt;p&gt;One layout algorithm cannot handle everything, so the engine tries a sequence&lt;br&gt;
of them, and the verify gate is what makes the cascade safe: the first&lt;br&gt;
candidate that &lt;em&gt;proves itself&lt;/em&gt; wins, and a strategy that fails costs nothing&lt;br&gt;
but time.&lt;/p&gt;

&lt;p&gt;Transistor-level circuits go to a CMOS schematic generator that knows what&lt;br&gt;
pull-up and pull-down networks are supposed to look like. Gate-level circuits&lt;br&gt;
get a classic schematic layout. Circuits built from larger blocks go through a&lt;br&gt;
proper graph-layout pass (ELK), with each part's ports pinned at their true pin&lt;br&gt;
offsets so the router's plan survives contact with the actual component&lt;br&gt;
shapes. After that come progressively more conservative fallbacks, ending in a&lt;br&gt;
channel router that is provably collision-free: ugly, but never wrong.&lt;/p&gt;

&lt;p&gt;The ordering encodes taste: try the layout a human engineer would draw first,&lt;br&gt;
fall back toward guaranteed-correct-but-plain. Because every candidate passes&lt;br&gt;
the same partition check, adding a new strategy is risk-free. The worst a bad&lt;br&gt;
strategy can do is waste its slice of the wall-clock budget.&lt;/p&gt;

&lt;h2&gt;
  
  
  The loop: do, check, continue
&lt;/h2&gt;

&lt;p&gt;Correct layout only guarantees the circuit matches what the model &lt;em&gt;asked for&lt;/em&gt;.&lt;br&gt;
It does not guarantee the model asked for the right thing. An LLM will&lt;br&gt;
cheerfully produce a "full adder" whose sum output is just A XOR B.&lt;/p&gt;

&lt;p&gt;So after every build, the system sweeps the circuit through the simulator and&lt;br&gt;
hands the model back the actual truth table of the thing it just built. Not&lt;br&gt;
"looks good!", the real input-to-output mapping, measured. For clocked&lt;br&gt;
circuits it runs the simulation forward over clock cycles and reports behavior&lt;br&gt;
over time, because a single-instant reading of a flip-flop tells you nothing.&lt;/p&gt;

&lt;p&gt;This turns the tutor into an agent with a lab bench. It builds, reads the&lt;br&gt;
measurement, notices the sum column is wrong, rebuilds with the missing XOR,&lt;br&gt;
and checks again. The model's judgment is still fallible, but it is now&lt;br&gt;
fallible &lt;em&gt;in front of an instrument&lt;/em&gt;, and the instrument does not flatter it.&lt;br&gt;
Most wrong first attempts fix themselves within an iteration or two, without&lt;br&gt;
the user ever seeing the broken version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Failing is a feature
&lt;/h2&gt;

&lt;p&gt;The last piece is what happens when nothing verifies: the tutor simply does&lt;br&gt;
not build. It says so, and the canvas stays untouched.&lt;/p&gt;

&lt;p&gt;That felt unsatisfying to ship. Every instinct says "degrade gracefully, show&lt;br&gt;
&lt;em&gt;something&lt;/em&gt;". But showing something is precisely the failure mode this whole&lt;br&gt;
design exists to prevent. A tutor that occasionally draws a subtly shorted&lt;br&gt;
circuit teaches a beginner that circuits are mysterious and untrustworthy. A&lt;br&gt;
tutor that occasionally says "I couldn't build that correctly, let me try a&lt;br&gt;
different structure" teaches them that correctness is checkable. In an&lt;br&gt;
educational tool, the second lesson is half the curriculum.&lt;/p&gt;

&lt;p&gt;The same gate protects the library: when the tutor authors a reusable&lt;br&gt;
component, it builds the part off-canvas, verifies it against the simulator,&lt;br&gt;
and only then saves. Nothing unverified is ever persisted anywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  What generalizes
&lt;/h2&gt;

&lt;p&gt;None of this is specific to circuits. The pattern is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Constrain the model's output to the semantic layer it is actually good at,
and keep it away from layers where its errors are silent.&lt;/li&gt;
&lt;li&gt;Verify with the production engine, not a lookalike validator, and verify
the &lt;em&gt;whole&lt;/em&gt; property (partition equality), not a checklist of known failure
modes.&lt;/li&gt;
&lt;li&gt;Feed measured reality back into the loop, so the model iterates against an
instrument instead of its own confidence.&lt;/li&gt;
&lt;li&gt;Prefer honest refusal over plausible wrongness.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;LLMs are proposal generators with excellent taste and no integrity. The&lt;br&gt;
engineering is in building the judge.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This is from building &lt;a href="https://digiwleea.wleeaf.dev/lab/" rel="noopener noreferrer"&gt;digiwleea&lt;/a&gt;, a free browser lab where you build a CPU starting from single transistors. Originally published on &lt;a href="https://digiwleea.wleeaf.dev/blog/ai-that-cannot-lie/" rel="noopener noreferrer"&gt;the digiwleea engineering blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
