wai-quantum: rewrites, convergence, and the 0.6.16 / 0.1.4 release #498
Loading…
Reference in a new issue
No description provided.
Delete branch "wai/quantum-converge"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Features 11 and 12 of the co-design report, and the release that carries everything since 0.6.15 to the package registry, as three commits. The verified-rewrite lens comes with the general equivalence check it needs first; then the convergence monitor; then wai-quantum 0.6.16 and wai-quantum-cli 0.1.4. Stacked on #497: once it merges, this PR is these three commits alone.
Once this merges, the following go out together, from the merge:
Rewrites, each checked, and equivalence proved by them at any width (
c979c300f)engine::rewrite. The rules propose and the engine decides. The rules:h cx h→cz;Each rewrite is checked on just the qubits it touches, by tableau or on every basis state (
equiv::proved_equal). So a chain of them proves two programs equal at any width and with any gates.Equivalence by rewriting.
rewrite::provereduces the first program followed by the other's inverse to nothing.equiv::equivalent_programsnow tries this after the exact check and before random inputs, answeringhow: rewrites. The workbench and the taste model count that as a proof.Explanations.
rewrite::explaingives a readable chain: both programs simplified to a fixed point, then compared gate for gate, or up to the order of gates that commute, by a proof.Options.
rewrite::optionsgives each rewrite as an edit to the program's own lines (a merge writesrz(0.25 + 0.5), comments stay). Each is read back and compared gate for gate before it is offered.CLI and MCP:
wai-quantum rewrite options | apply | simplify | explain; therewrite_qasmtool. Thecheck_equivalentdescriptions now name the new proof, in the service's MCP too.Studio:
Tests. The old wide-equivalence test now proves its pair by
rewrites. The random-inputs path is kept on a swap written as threecx.Whether designs converge on a model's, and a while on one's own (
94fabb574)Along a program's history (
engine::converge::history), each version the person made after a model proposed gets:The history is converging when most of the program is the model's, or when the last versions come closer each time, and it says which. Versions noted
organic explorationare the assistant-off probes, set beside the rest.A cohort (
converge::cohort) gets:1 − distance);CLI and MCP:
wai-quantum converge history | cohort; theconverge_cohortandconverge_historytools.Studio: "Your own way" under Versions, and "Explore on my own for a while". While it is on:
"End" lets the model propose again.
CI: wai-web's native engine test count goes from 11 to 13.
wai-quantum 0.6.16 and wai-quantum-cli 0.1.4 (
7309053e4)cargo metadata --locked, andcargo packagepacks wai-quantum.Checked on the build host (run at low priority, so the macOS runner's timing tests were not starved):
engine::115 pass;🤖 Generated with Claude Code
Feature 10 of the co-design report: a personal, plural taste model. - engine::taste: - a choice is recorded only when the engine proves the two programs the same circuit or the same state, by a proof (tableau, exact, state), never by random inputs: it is about taste, never correctness; - a Bradley-Terry logistic over differences of measured features (gates, two-qubit gates, depth, two-qubit depth, T gates, modelled error) and of the text (statements, kinds of gate, repetition, comments), ridge penalised and fitted by Newton's method: deterministic everywhere; - the rubric's parts (economy, clarity, insight, precision, utility), each learned from its own choices; a ranking names where a part or the cost puts another first; - profiles personal and plural, by name, never pooled; - typicality (one less engine::novelty's novelty) shown and never learned; the novelty dial blends the standardised order by taste with the order by novelty; a floor on each feature's spread keeps a feature that barely varied from turning into certainty; - measured: choices predicted as made and held out (last 100), the ones nothing measured separates, and whether a ranking's first three are built more alike than the cost's; scores about the candidates' mean; - next: the least certain pair the engine proves equal; call for hosts. - novelty::token is shared with it. - The command line: taste choose | show | rank | next (files or --spec), profiles in quantum-taste.json beside the user's key. - MCP: taste_rank and taste_next read the person's profile; no tool records a choice. initialize tells an agent so, and to call a program new only when novelty_qasm says so. - The Studio: "Your taste" in the Workbench (Compare two with the part a choice was about, Rank by my taste with typicality and the dial, profiles by name); an alternative that is the same circuit as the draft, taken whole or refused whole, is a choice; Improve orders by the profile. - Bindings: engine_taste in the page, taste in the desktop app. - CI: wai-web's native engine tests count 11. Co-Authored-By: Claude Opus 5.5 <[email protected]>Feature 11 of the co-design report: a verified-rewrite lens shared by the person and the assistant, and the general equivalence check it needs. - engine::rewrite: - rules propose, the engine decides: cancel (a gate and its inverse), merge (rotations about one axis; phase gates add up), conjugate (a gate between two Hadamards), drop (a gate that does nothing), through (carried past gates it commutes with to its partner), move (two that commute trade places); - each rewrite's gates are checked against its replacement on just the qubits they touch, by tableau or on every basis state (equiv::proved_equal), so a chain is a proof at any width; - prove: one program followed by the other's inverse rewritten to nothing; explain: both simplified and compared (gate for gate, or up to the order of gates that commute, by a proof); options: each rewrite as an edit to the program's own lines, read back and compared before it is offered; call for hosts. - equiv::equivalent_programs tries the proof after the exact check and before random inputs (how: rewrites); the workbench and the taste model count it as a proof. critique's line edits and qasm::builtin are shared. - The command line: rewrite options | apply | simplify | explain. - MCP: rewrite_qasm; check_equivalent's description names the new proof (and the service's). - The Studio: "Rewrites" under the circuit (each in words, its gates marked on the diagram, Take to offer it as the engine's proposal, the list following the program); Alternatives says how the draft becomes a candidate that is the same circuit, as a chain; "by checked rewrites". - Bindings: engine_rewrite in the page, rewrite in the desktop app. - CI: wai-web's native engine tests count 12. Co-Authored-By: Claude Opus 5.5 <[email protected]>Feature 12 of the co-design report: a convergence monitor. - engine::converge: - history: for each version the person made after a model proposed, its structural distance from the proposals in its line of work (the whole proposal) and the model's share of its gates; converging when most of the program is the model's or the last versions come closer each time, with why; versions noted "organic exploration" (the assistant-off probes) set beside the rest; - cohort: the Vendi score over 1 - distance (Jacobi eigenvalues), each program's distance to the centroid of the gate-token bags, the medoid and the outlier, and with times the score in windows and a narrowing; - call for hosts. novelty::bag is shared. - The command line: converge history | cohort (a file's time from its history, else the file's). - MCP: converge_cohort and converge_history. - The Studio: "Your own way" under Versions, and "Explore on my own for a while": the assistant only asks and offers no program, Explore and Ask the model wait, the person's versions are noted; End lets the model propose again. - Bindings: engine_converge in the page, converge in the desktop app. - CI: wai-web's native engine tests count 13. Co-Authored-By: Claude Opus 5.5 <[email protected]>