<?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: Naveen Syamala</title>
    <description>The latest articles on DEV Community by Naveen Syamala (@nsyamala).</description>
    <link>https://dev.to/nsyamala</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3870197%2F9f462902-6b87-47c6-b9e0-834dae530385.jpg</url>
      <title>DEV Community: Naveen Syamala</title>
      <link>https://dev.to/nsyamala</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nsyamala"/>
    <language>en</language>
    <item>
      <title>## I Built an AI Quantum Circuit Compiler — Here’s What I Learned</title>
      <dc:creator>Naveen Syamala</dc:creator>
      <pubDate>Mon, 11 May 2026 04:25:51 +0000</pubDate>
      <link>https://dev.to/nsyamala/-i-built-an-ai-quantum-circuit-compiler-heres-what-i-learned-5djl</link>
      <guid>https://dev.to/nsyamala/-i-built-an-ai-quantum-circuit-compiler-heres-what-i-learned-5djl</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; I built &lt;a href="https://github.com/nsyamala1/quantumopt" rel="noopener noreferrer"&gt;quantumopt&lt;/a&gt;, an open-source AI-powered quantum circuit compiler using a Graph Attention Network. It achieves 30–48% gate reduction on real VQE and IQP circuits. Here’s how it works, what I got wrong, and what I learned.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I Built This
&lt;/h2&gt;

&lt;p&gt;I’m a CS student who got obsessed with quantum computing. The problem I kept running into: quantum circuits need to be compiled down to hardware-specific gate sets before running on real IBM machines — and this compilation step massively affects circuit quality.&lt;/p&gt;

&lt;p&gt;Qiskit’s built-in transpiler is good. But it doesn’t &lt;em&gt;predict&lt;/em&gt; whether a circuit is worth optimizing before trying. I wondered: what if a GNN could look at a circuit’s structure and predict optimization potential before the transpiler runs?&lt;/p&gt;

&lt;p&gt;That became &lt;strong&gt;quantumopt&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;The pipeline has three stages:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Circuit → Graph
&lt;/h3&gt;

&lt;p&gt;Every quantum circuit is a directed acyclic graph. Gates become nodes, dependencies become edges. I encode each node as a &lt;strong&gt;21-dimensional feature vector&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;20 dimensions: one-hot gate type encoding&lt;/li&gt;
&lt;li&gt;1 dimension: qubit index&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Graph Attention Network (GNN)
&lt;/h3&gt;

&lt;p&gt;A 3-layer GAT learns patterns from labeled circuits — specifically, it learns to predict how much Qiskit’s transpiler can improve a given circuit. Trained on &lt;strong&gt;10,327 circuits&lt;/strong&gt; on a Kaggle T4 GPU in about 3 minutes. Achieves &lt;strong&gt;82% accuracy&lt;/strong&gt; within 10 percentage points on the test set.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Qiskit Transpilation + Claude Explanation
&lt;/h3&gt;

&lt;p&gt;The circuit gets passed to Qiskit’s transpiler targeting IBM Brisbane hardware at optimization level 3. Optionally, Claude generates a hardware-specific explanation of the optimization decisions — useful for researchers who want to cite the reasoning in papers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;quantumopt&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nb"&gt;compile&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_vqe_circuit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hardware&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ibm_brisbane&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gate_reduction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="c1"&gt;# e.g. "30%"
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;explanation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;       &lt;span class="c1"&gt;# Claude-generated explanation
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The Benchmark Results
&lt;/h2&gt;

&lt;p&gt;After training on synthetic circuits, I followed advice from a quantum algorithms researcher to benchmark on &lt;strong&gt;real algorithm circuit types&lt;/strong&gt;. I generated 500 circuits each for QAOA, VQE, and IQP and benchmarked 100 of each:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Circuit Type&lt;/th&gt;
&lt;th&gt;Circuits Tested&lt;/th&gt;
&lt;th&gt;Mean Gate Reduction&lt;/th&gt;
&lt;th&gt;Mean Depth Reduction&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;VQE (EfficientSU2)&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+30.4%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+21.5%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IQP&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+48.5%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+41.2%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;QAOA (MaxCut)&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+5.7%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+2.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;VQE&lt;/strong&gt; is the most practically useful result — consistent 30% gate reduction regardless of qubit count (4 to 16 qubits).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IQP&lt;/strong&gt; is the strongest result — up to 79% gate reduction in the best case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;QAOA&lt;/strong&gt; is modest — these circuits are already near-optimal before compilation, so there’s less room for improvement.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Measurement Bug I Had to Fix
&lt;/h2&gt;

&lt;p&gt;Here’s something embarrassing but important: my first benchmark results showed &lt;strong&gt;98-100% of circuits getting worse&lt;/strong&gt;. Mean gate reduction of -61% to -78%. Clearly wrong.&lt;/p&gt;

&lt;p&gt;The bug: I was comparing &lt;strong&gt;abstract gate counts&lt;/strong&gt; (before transpilation) against &lt;strong&gt;native gate counts&lt;/strong&gt; (after transpilation). Abstract gates like &lt;code&gt;ry&lt;/code&gt; and &lt;code&gt;rz&lt;/code&gt; decompose into multiple native IBM gates (&lt;code&gt;u&lt;/code&gt;, &lt;code&gt;sx&lt;/code&gt;, &lt;code&gt;x&lt;/code&gt;) — so the gate count naturally grows during compilation regardless of optimization.&lt;/p&gt;

&lt;p&gt;The fix was to compare level-0 transpilation (naive, no optimization) against level-3 transpilation (full optimization) — both in native gate space. Apples to apples.&lt;/p&gt;

&lt;p&gt;Lesson: &lt;strong&gt;always make sure your before/after measurements are in the same space.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What I’m Building Next
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Retrain the GNN&lt;/strong&gt; on the new QAOA/VQE/IQP datasets — the current model was trained mostly on synthetic random circuits, not real algorithm patterns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-objective quantum optimization for mRNA design&lt;/strong&gt; — I’ve been in conversation with a quantum algorithms researcher at Moderna about applying quantum approaches to the CAI + MFE co-optimization problem for mRNA sequence design. This is a genuinely hard multi-objective problem that goes beyond what QUBO formulations can handle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;arXiv paper&lt;/strong&gt; — currently waiting for an endorsement to submit to cs.ET.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;quantumopt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;qiskit&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;QuantumCircuit&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;quantumopt&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nb"&gt;compile&lt;/span&gt;

&lt;span class="n"&gt;qc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;QuantumCircuit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;h&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hardware&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ibm_brisbane&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/nsyamala1/quantumopt" rel="noopener noreferrer"&gt;github.com/nsyamala1/quantumopt&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;PyPI:&lt;/strong&gt; &lt;a href="https://pypi.org/project/quantumopt" rel="noopener noreferrer"&gt;pypi.org/project/quantumopt&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What I’d Love Feedback On
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Have you benchmarked quantum compilers differently? What metrics matter most to you?&lt;/li&gt;
&lt;li&gt;Are there circuit types I should be testing that I’m missing?&lt;/li&gt;
&lt;li&gt;If you’re working on quantum algorithms and want to try it on your circuits, I’d genuinely love to hear what happens.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feel free to open an issue on GitHub.&lt;/p&gt;




&lt;p&gt;Built by Naveen Syamala CS student, full-stack developer, and apparently now a quantum compiler engineer.&lt;/p&gt;




&lt;h1&gt;
  
  
  quantum-computing #machine-learning #python #open-source #gnn
&lt;/h1&gt;

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