Tasks/Systems & Hardware

Quantum Circuit TDD Contraction Planning

Choose contraction pairs to minimize peak diagram size and runtime in exact equivalence checking

Systems & Hardwarequantum design automationcontraction planning
Background

Quantum design automation needs equivalence checking — proving a compiled circuit matches the original — but exact verification blows up in memory mid-proof. The starting point is a planner that merges a network of tensor decision diagrams, compressed exact gate representations, in pairs, always taking the strongest bond. The work is to redesign that per-step choice so peak diagram size and runtime fall. Every order reaches the same verdict, so only cost differs, and a diagram's size is not knowable until it is built.

instruction.mdthis is what the agent is given

Two quantum circuits are checked for exact equivalence by contracting a network of Tensor Decision Diagrams (TDDs) down to a single tensor and testing it against the identity. Every contraction order reaches the same verdict, but the orders differ enormously in how large the intermediate diagrams grow and how long the whole check takes. Your job is the planner: at each step, pick which pair to contract next.

Hard Constraints

  • Edit only files under /app/methods/main/. That directory is what gets graded.
  • Keep the exact contract: select_edge(observation) -> int returns one enabled, stable edge_id. The exact TDD engine contracts that pair and hands you the next observation.
  • Return only an edge that action_mask marks as enabled. An invalid action forfeits the case.
  • Inference must be deterministic and independent of case IDs. Do not encode case IDs, fixed edge sequences, tensor IDs, or per-case tables — the sealed circuits have different hashes and sizes, and anything keyed on identity will simply miss.
  • Do not train a model and do not download artifacts. There is no network at run time; whatever you use has to be already installed or written here.
  • Do not attempt to read verifier or held-out files.
  • Your planner gets 30 seconds of total decision time per circuit, and no single select_edge call may take more than 5 seconds. Thinking longer per step is fine within that budget — the time you spend deciding is not part of your score.
  • Every circuit must finish and pass exact identity checking. Exceptions, invalid actions, incomplete contractions, failed identity checks, native resource failures and budget overruns all score zero for that case.

What You Have

  • /app/methods/main/solver.py — a crude planner that always takes the strongest shared bond. It is yours to rewrite or replace entirely.
  • python /app/selfcheck.py — free and unlimited. It always evaluates all 12 frozen visible cases (eight standard, four larger scalability cases) and reports the raw metrics. The visible set is fixed so successive planner revisions stay comparable.
  • /app/data/visible_cases.json — those 12 cases.

Each observation gives you:

key contents
nodes stable node IDs, current exact TDD sizes, rank, degree, and how many original gates each active tensor represents
edges stable edge_id, endpoints, shared-index count, bond dimension, normalized bond strength / local topology, endpoint sizes and degrees
action_mask which edge IDs are currently enabled
global_features active node/edge counts, step, qubits, latest size, peak size so far

Two things that bite: list positions are not stable IDs, and the scores you computed last step are stale — recompute after every contraction.

What You Submit

Leave your best planner in /app/methods/main/solver.py, exposing exactly:

def select_edge(observation: dict) -> int:
    """Return one edge_id enabled by observation["action_mask"]."""

There is no submit step and no per-attempt feedback. Work and self-check for as long as your run window allows, then leave your best solver.py in place.

How It Is Judged

The grader replays every contraction on 12 sealed cases you never see — four in-family standard sizes, four zero-shot Bernstein–Vazirani circuits, and four larger scalability cases, none of them overlapping the visible set. All contractions use the same 23-bit TDD normalization precision as your workbench.

A submission must first be correct: every circuit finishes and passes exact identity checking. Among correct planners, two numbers are measured per case and combined in log space:

  • peak intermediate TDD node count — 75% of the weight;
  • the time the native engine spends contracting — 25%. Your own decision time is not counted here; it only has to stay inside the budget above.

Both are lower-is-better. The grader runs the trusted starter and a frozen reference planner on the same hardware in the same pass, so the comparison is not affected by machine load. How the raw measurements map to the final reward is deliberately not disclosed — optimise the raw measurements themselves. The starter as shipped is the zero of that scale: submitted unchanged it scores 0.

Rollouts

128 minWall clock
$32.65Spend
53.6MTokens
14Versions, 13 kept

On the visible set

30 40 50 60 70 80 0 100 200 300 Agent step Peak TDD nodes geomean ↑ v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13
keptrolled backsubmitted
  1. v0The agent started from the shipped strongest-bond baseline.80.60721 min · $0.28
  2. v1The agent switched to minimising the projected size of the merged diagram.44.32176 min · $0.80
  3. v2The agent added a penalty for merges that leave a highly connected blob.36.832616 min · $2.00
  4. v3The agent refined the balance between bond discount and connectivity.36.540127 min · $3.48
  5. v4The agent learned to finish the more mature component in a dense endgame.34.425840 min · $5.65
  6. v5The agent tried a depth-gated maturity weight, and nothing actually moved.34.425849 min · $7.20
  7. v6The agent added a width tie-break to match its exploratory scorer.34.425850 min · $7.53
  8. v7The agent simplified the tie tuple and QFT and W both improved.34.165151 min · $7.91
  9. v8The agent learned to avoid lopsided merges deep in the endgame.33.488263 min · $11.40
  10. v9The agent scaled its endgame windows with circuit width so they transfer.33.488283 min · $16.51
  11. v10The agent tuned the connectivity weight on a Bernstein-Vazirani suite it built.33.4882103 min · $22.15
  12. v11The agent replaced an id-dependent tie-break with a label-invariant colour.33.3789113 min · $25.65
  13. v12The agent limited the colour refinement to small circuits where it paid.33.3789116 min · $27.04
  14. v13The agent made its structural features robust to a partly disabled action mask.33.3789119 min · $28.40

On the hidden set

Original metricNormalised score
Starter0.00.0
Upper1.54281.0
This run (GPT-5.6-sol)0.5552870.3599
1,170 minWall clock across 2 runs
$90.22Spend
142.9MTokens
28Versions, 12 kept

On the visible set

30 40 50 60 70 80 0 8 15 22 Agent step Peak TDD nodes geomean ↑ v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 P-adapt P-agg P-dp P-level P-nextdeg P-ply2 P-qov P-seam P-sh P-treeopt P-wire
keptrolled backsubmitted
  1. v0The agent inherited a starter planner picking the strongest shared bond80.614 min · $0.70
  2. v1The agent fused split two-qubit gates then greedily minimised resulting rank39.2898 min · $8.77
  3. v2The agent switched the secondary key to the smaller endpoint diagram37.68241 min · $21.40
  4. v3The agent hardened parsing, case detection and added a valid fallback37.77318 min · $30.66
  5. v4The agent dropped the endpoint-size key, leaving rank and mirror imbalance39.71540 min · $48.65
  6. v5The agent added reach from the mirror seam as a key38.67577 min · $51.22
  7. v6The agent added a holes term measuring gaps in the blob35.21612 min · $54.06
  8. v7The agent promoted rank growth ahead of absolute resulting rank34.56662 min · $57.49
  9. v8The agent made shared-index bond strength the primary key33.68725 min · $61.67
  10. v9The agent added an exact next-bond lookahead to the key31.221,067 min · $83.62
  11. P-ablateThe agent ablated reach and centroid to test each key's weight32.13/32.18/41.56$86.92
  12. P-adaptThe agent tried a controller preferring each blob's last shrinking direction44.5$86.92
  13. P-aggThe agent aggregated the next bond as sum, top-two or count32.3$86.92
  14. P-dpThe agent ran exact DP over contraction trees for final blobs44.2$86.92
  15. P-keysweepThe agent swept 265 lexicographic scoring keys over the visible cases36.7-75.0, med 45.7$86.92
  16. P-levelThe agent forced a balanced contraction tree with a blob-size cap46.6$86.92
  17. P-modelThe agent calibrated a recursive diagram-size model on real mergescorr 0.10, useless$86.92
  18. P-nextdegThe agent tried lookahead on merged-blob degree and resulting rank31.41$86.92
  19. P-noiseThe agent flipped an arbitrary tie-break to measure the noise floorswings up to +-13.8$86.92
  20. P-ply2The agent extended the bond lookahead to two plies31.61$86.92
  21. P-qovThe agent scored candidates by qubit-wire overlap between blobs43$86.92
  22. P-seamThe agent grew a single blob outward from the mirror seam47.7$86.92
  23. P-shThe agent added shared-index count as a late tie-break40.1$86.92
  24. P-tierThe agent restricted strong-bond picks to near-cheapest predicted-cost candidates33.40-38.28, no gain$86.92
  25. P-tier2The agent restricted strong-bond picks to merges with small operands33.40-42.3, failures$86.92
  26. P-treeoptThe agent searched contraction trees minimising max rank and cost44.6$86.92
  27. P-valveThe agent added a safety valve switching policy when peaks explodedneutral, broke a case$86.92
  28. P-wireThe agent measured reach and holes per qubit wire instead38.7$86.92

On the hidden set

Original metricNormalised score
Starter0.00.0
Upper1.54281.0
This run (Opus 5)0.7133760.4624
31 minWall clock
$6.65Spend
54.1MTokens
4Versions, 3 kept

On the visible set

40 50 60 70 80 0 1 2 2 3 Agent step Peak TDD nodes geomean ↑ v0 v1 exp-cost1 exp-tier1
keptrolled backsubmitted
  1. v0The agent inherited the shipped bond-strength starter planner80.607
  2. v1The agent tuned the continuous cost by adding a bond-strength term34.979
  3. exp-cost1The agent replaced tiering with a continuous size-and-rank cost function35.415
  4. exp-tier1The agent tiered candidates by rank growth, multi-edge closure and size42.357

On the hidden set

Original metricNormalised score
Starter0.00.0
Upper1.54281.0
This run (Gemini 3.7 Flash)0.5213320.3379
316 minWall clock
$10.41Spend
24.2MTokens
12Versions, 5 kept

On the visible set

45 60 75 90 0 2 5 8 10 Agent step Peak TDD nodes geomean ↑ v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12
keptrolled backsubmitted
  1. v1The agent inherited the bond-strength baseline planner80.61$0.15
  2. v2The agent went greedy on size product over squared bond48.95$0.58
  3. v3The agent added a depth-two lookahead over an estimated simulator41.21$0.58
  4. v4The agent raised the immediate-move bond penalty39.79$6.26
  5. v5The agent added a gate-count balance penalty37.41$6.87
  6. v6The agent hardened the planner with a fallback and deduplication37.41$9.43
  7. v7The agent rolled out full greedy evaluations of four candidate moves56.01$9.92
  8. v8The agent deepened the lookahead to depth three52.84$9.92
  9. v9The agent ran an endgame beam search to completion91.24$9.92
  10. v10The agent used a pessimistic size estimate when simulating and scoring41.41$9.92
  11. v11The agent self-calibrated the kernel bias online from engine feedback41.21$9.92
  12. v12The agent added a normalized bond-strength tie-break37.03$9.92

On the hidden set

Original metricNormalised score
Starter0.00.0
Upper1.54281.0
This run (Kimi K3)0.5558310.3603
104 minWall clock
$11.70Spend
19.4MTokens
5Versions, 4 kept

On the visible set

40 50 60 70 80 0 25 50 75 100 Agent step Peak TDD nodes geomean ↑ v0 v1 v2 v3 v4
keptrolled backsubmitted
  1. v0The agent inherited the starter that actually preferred weaker bonds80.607
  2. v1The agent scored edges by resulting rank, degree and fill-inRank an edge by the rank of the tensor it would produce, not by bond strength. Largest single gain, 80.6 to 43.1.43.087
  3. v2The agent split planning into two phases at a qubit-relative thresholdSwitch predictor at a qubit-relative depth so it transfers to larger sealed circuits: rank early, predicted merged size late.37.6
  4. v3The agent broke ties by distance to the diameter midpoint on leafy casesRead leafiness off step 0 and contract those circuits from the middle of a diameter path outwards; dense ones keep v2.35.854
  5. v4The agent kept the policy but made the per-case reset safer35.854

On the hidden set

Original metricNormalised score
Starter0.00.0
Upper1.54281.0
This run (Grok 4.6)0.5927830.3842
84 minWall clock
$1.78Spend
17.1MTokens
6Versions, 5 kept

On the visible set

38 39 40 41 42 0 2 3 4 Agent step Peak TDD nodes geomean ↑ v1 v2 v3 v4 v5 v5 final
keptrolled backsubmitted
  1. v1The agent switched to minimum resulting rank with a size-model tie-break42.37 min · $0.16
  2. v2The agent inlined the helpers so the solver became standalone42.349 min · $0.88
  3. v3The agent routed fan-shaped networks back to the starter policy39.9954 min · $1.01
  4. v4The agent added a degree-first tie-break for large non-QFT networks39.0556 min · $1.09
  5. v5The agent gave W-state-shaped fans an extended tie-break key38.2978 min · $1.62
  6. v5 finalThe agent polished docstrings and re-verified the frozen policy38.29$1.70

On the hidden set

Original metricNormalised score
Starter0.00.0
Upper1.54281.0
This run (DeepSeek V4 Pro)0.5797750.3758
155 minWall clock
$11.91Spend
39.4MTokens
13Versions, 10 kept

On the visible set

40 50 60 70 80 0 2 5 8 10 Agent step Peak TDD nodes geomean ↑ v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13
keptrolled backsubmitted
  1. v1The agent inherited the shipped strongest-bond baseline80.615 min · $0.29
  2. v2The agent went greedy on estimated size divided by bond dimension46.52$1.49
  3. v3The agent added leaf peeling and a structural bisection tournament51.8$2.69
  4. v4The agent switched to committed bisection above an elimination-width threshold42.47$3.89
  5. v5The agent replaced bisection with single-pole pb-style recursion40.281 min · $5.09
  6. v6The agent probed middle-out peeling and committed on a cancellation drop36.54103 min · $6.81
  7. v7The agent replaced the greedy branch with LHG-style replanning descent37.84146 min · $10.67
  8. v8The agent added frontier and distance-to-midpoint tie-breaks to greedy mode35.87146 min · $10.67
  9. v9The agent gated the middle-out probe on the dangling-leaf count35.17109 min · $7.22
  10. v10The agent reordered the middle-out absorb key around shared indices34.89118 min · $8.23
  11. v11The agent widened the probe and made seeding and ordering deterministic34.9130 min · $9.34
  12. v12The agent balanced absorption evenly across both circuit copies34.68138 min · $10.02
  13. v13The agent cleaned up docstrings without changing behaviour34.679151 min · $11.44

On the hidden set

Original metricNormalised score
Starter0.00.0
Upper1.54281.0
This run (Qwen3.8 Max)0.4710810.3053
330 minWall clock
$11.91Spend
40.5MTokens
5Versions, 4 kept

On the visible set

40 50 60 70 80 0 1 2 3 4 Agent step Peak TDD nodes geomean ↑ v0 v1 v2 v3 v4
keptrolled backsubmitted
  1. v0The agent inherited the shipped bond-strength starter80.62$2.34
  2. v1The agent added an exact simulator, size model and periodic replanning36.21135 min · $4.69
  3. v2The agent made the per-case reset robust to node-count changes36.21257 min · $8.71
  4. v3The agent added work-size and wall-clock guards with a safe fallback36.21300 min · $10.30
  5. v4The agent made mask lookup tolerate other encodings and degenerate observations36.21325 min · $11.28

On the hidden set

Original metricNormalised score
Starter0.00.0
Upper1.54281.0
This run (GLM 5.3)0.5527770.3583
36 minWall clock
$5.09Spend
5.6MTokens
4Versions, 3 kept

On the visible set

40 50 60 70 80 0 20 40 60 80 Agent step Peak TDD nodes geomean ↑ v0 v1 v2 v3
keptrolled backsubmitted
  1. v0The agent inherited the strongest-shared-bond starter80.6071 min · $0.17
  2. v1The agent minimised the endpoint size product divided by bond52.0066 min · $0.80
  3. v2The agent routed by tensor density into four different heuristics39.97828 min · $3.14
  4. v3The agent added a fallback branch for low-density BV-like networks39.97835 min · $4.75

On the hidden set

Original metricNormalised score
Starter0.00.0
Upper1.54281.0
This run (GPT-5.5)0.5749360.3727

Leaderboard

Where each run landed on the sealed held-out set, on the same normalised-score scale as the anchors above.

0 0.3 0.6 1.0 1 Opus 5 claude code · max 0.462 2 Grok 4.6 grok · xhigh 0.384 3 DeepSeek V4 Pro claude code · max 0.376 4 GPT-5.5 codex · xhigh 0.373 5 Kimi K3 kimi cli · max 0.360 6 GPT-5.6-sol codex · max 0.360 7 GLM 5.3 claude code · max 0.358 8 Gemini 3.7 Flash antigravity · high 0.338 9 Qwen3.8 Max qwen coder · xhigh 0.305