Making quantum circuits with VibeQ
You describe a circuit in a sentence. VibeQ writes it, runs it, shows you what it does, checks it, compiles it for a real chip's gates and hands you a file. This page shows how to get good circuits out of it, how to read every panel, and how to go from "a Bell pair" to algorithms.
If qubits, gates and superposition are new to you, read the quantum computing primer first; it uses the same circuits.
2. How to describe a circuit
3. Reading the diagram
4. The Simulate tab: probabilities, shots, Bloch vectors
5. The Verify tab: checks and hardware targets
6. Changing a circuit in plain English
7. Editing the script yourself
8. Export: OpenQASM 3
9. Patterns that work (states, oracles, algorithms)
10. What VibeQ checks, and what it cannot
11. Troubleshooting
1. Your first circuit in thirty seconds
Open VibeQ. The page is one big prompt. Type a sentence that says what the circuit should do, pick a target (leave it on Ideal simulator for now) and press Build it.
Try it A Bell pair: put two qubits into the entangled state (|00⟩ + |11⟩)/√2 and measure both.Within a few seconds you get: the circuit drawn in the viewer, the Qiskit script in the Code tab, and a chat message that ends with a line computed from the run, for example Built from the run: 2 qubits, depth 3, h ×1, cx ×1, measure ×2; most likely outcomes 00 (50.0 %), 11 (50.0 %). That last line is never written by the model; it is what the circuit actually did.
The Bell pair: a Hadamard (H) puts qubit 0 into superposition, a CNOT (dot and ⊕) copies that superposition onto qubit 1 as entanglement, two measurements (M) write the results to classical bits.
2. How to describe a circuit
VibeQ hands your sentence to a language model with a strict contract: it must return one Qiskit script that defines build(), it may not simulate or print, and every angle must be a number. The better your sentence, the fewer repairs it needs. Four habits that pay off:
| Habit | Weak | Strong |
|---|---|---|
| Say the size | "a GHZ state" | "a 4-qubit GHZ state" |
| Say what is measured | "Grover for 101" | "…marking |101⟩, two iterations, measure all three qubits" |
| Number the qubits when roles matter | "teleport a state" | "teleport RY(π/3)|0⟩ from qubit 0 to qubit 2 using a Bell pair on qubits 1 and 2" |
| Name the oracle | "Deutsch-Jozsa" | "Deutsch-Jozsa on 3 inputs with the balanced oracle f(x) = x0 XOR x2" |
Bit order matters when you read outcomes: VibeQ prints bit strings the way Qiskit does, with qubit 0 as the rightmost character. "Qubit 2 = 1, qubits 1 and 0 = 0" prints as 100.
3. Reading the diagram
Each horizontal line is a qubit, time runs left to right, and the double line at the bottom is the classical register that measurements write into. Colours tell gate families apart:
| Look | Meaning |
|---|---|
| Blue box H | Hadamard: makes an equal superposition (or undoes one). |
| Red box X, Y, Z, √X | Pauli-type flips: X is a bit flip, Z a phase flip. |
| Yellow box RX(θ), RY(θ), RZ(θ) | Rotations by an angle; angles print as fractions of π. |
| Purple box S, T, P(θ) | Phase gates: they change the sign or phase of the |1⟩ part only. |
| Dot joined to a ⊕ | CNOT (CX): flip the target when the control is 1. Two dots and a ⊕ is a Toffoli. |
| Dot joined to a box | Controlled gate (CRY, CP, …): apply the box only when the control is 1. |
| Two × marks joined | SWAP. |
| Green M with a dashed line down | Measurement into the classical bit named at the bottom. |
| Dashed vertical line | Barrier: no gate, just a visual separator the compiler respects. |
Text in the viewer toolbar switches to Qiskit's own text drawing, useful for pasting into notes. Fit re-centres a long circuit.
4. The Simulate tab: probabilities, shots, Bloch vectors
Three views of the same circuit, in order of trust:
- Exact outcome probabilities. The statevector of the whole circuit (with the final measurements removed), so these numbers are what the mathematics says, with no sampling noise. Available up to 20 qubits, and not for circuits that measure in the middle and keep going.
- Sampled counts. The circuit run shots times on an ideal simulator with a fixed seed. Change the shot count in the composer; a rare outcome needs many shots to show up at all.
- Bloch vectors. One small sphere per qubit, showing that qubit's reduced state. A full-length arrow means the qubit is in a pure state on its own; a short arrow means it is entangled with the rest (or mixed). In a Bell pair both arrows vanish: each qubit alone is completely random, together they are perfectly correlated.
5. The Verify tab: checks and hardware targets
The checks run on every build:
| Check | What it means |
|---|---|
| Script builds a circuit | The code ran and returned a circuit with at least one qubit and no unbound parameters. |
| Outcomes are measured | Warns when nothing is measured; the histogram then measures every qubit for you. |
| Final state computed exactly | Statevector available (size and no mid-circuit measurement). Otherwise only sampling. |
| Entanglement | Which qubits have reduced-state purity below 1. |
| Sampled N shots | The histogram ran. |
| Compiles to the target | The circuit was rewritten in the target's native gates and routed on its connectivity; depth and two-qubit counts before and after. |
| Two-qubit gate budget | Warns above 50 two-qubit gates, where today's hardware returns mostly noise. |
| Gate sequence is unitary | For small circuits, the full matrix is built and checked. |
Targets. The top-bar chooser compiles the same logical circuit for different machines:
- Ideal simulator: no rewrite. What the algorithm means.
- Superconducting, linear chain (rz, sx, x, cx): IBM-style gates; qubits only talk to their neighbours on a line, so far-apart interactions cost SWAPs.
- Superconducting, heavy-hex 27: the 27-qubit lattice IBM Falcon chips use; up to 27 qubits.
- Trapped-ion, all-to-all (rx, ry, rz, rxx): IonQ-style gates; every pair can interact, so no SWAPs, but the rewrite changes which gates appear.
Switching the target re-runs the circuit and refreshes the compiled form; the numbers to compare are depth and two-qubit gates. A 4-qubit W state is 15 two-qubit gates on an ideal machine and ~46 on heavy-hex after routing: the same circuit, a very different experiment.
Try it A 5-qubit GHZ state, then switch the target to the linear chain and watch the depth.6. Changing a circuit in plain English
Once a circuit exists, the composer under the chat edits it. The model receives the current script and your request, and must keep what you did not ask to change. Good change requests are one thing at a time:
- "Add a third qubit entangled with the first via a CNOT, and measure all three."
- "Replace the Hadamard on qubit 0 with RY(π/3)."
- "Measure qubit 1 in the X basis instead of Z."
- "Run the Grover iteration twice."
Every revision is saved under History with its result. New circuit clears the workspace (the old one stays in History). The Ask about this panel line on every tab answers questions from the numbers on screen and can propose a change you apply with one click.
7. Editing the script yourself
The Code tab holds the Qiskit script. Edit it and press Run; the same harness re-runs it, so the diagram, state, checks and target compile all refresh. The contract is small:
import math
from qiskit import QuantumCircuit
def build() -> QuantumCircuit:
qc = QuantumCircuit(2, 2, name="bell_pair") # 2 qubits, 2 classical bits
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])
return qc
Only qiskit, qiskit.circuit.library, numpy and math are available; the script runs in a sandbox with no network and no files. Library blocks (QFT(3), GroverOperator) are fine; call .decompose() on them if you want the gate list drawn in full.
8. Export: OpenQASM 3
QASM 3 in the top bar downloads the circuit as OpenQASM 3, the interchange format Qiskit (qasm3.loads), Cirq, Amazon Braket and most vendor consoles accept. The Info tab shows the same text, plus qubit and register names, depth and gate counts.
9. Patterns that work
States
- Bell pair: H then CNOT. try
- GHZ: H then a CNOT chain; only all-zeros and all-ones appear. try
- W state: one excitation shared equally; harder than GHZ (controlled rotations). try
Protocols
- Teleportation: a Bell pair plus two classical bits move a state between qubits. try
- Superdense coding: one qubit carries two classical bits. try
- Entanglement swapping: entangle two qubits that never met. try
Oracle algorithms
- Deutsch (1 qubit) and Deutsch-Jozsa: one query tells constant from balanced. try
- Bernstein-Vazirani: one query reads a hidden bit string. try
- Simon: outcomes orthogonal to the hidden string. try
- Grover: amplify a marked string; 2 qubits is exact in one iteration, 3 qubits reaches ~94 % in two. try
Fourier and phases
- QFT of a basis state is uniform over all outcomes (it spreads amplitude into phases). try
- Phase estimation reads a gate's eigenphase as a binary fraction: T gives 001 (1/8), S gives 010 (1/4) on three counting qubits. try
Small building blocks
- Swap test and Hadamard test: read an overlap or an expectation value off one ancilla.
- Half adder, Toffoli from basic gates: reversible logic.
- Bit-flip and phase-flip codes: detect and correct one error with syndromes.
All of these are in Examples as verified scripts: clicking one does not call the model at all, it runs a circuit whose outcome statistics were checked against the textbook answer.
10. What VibeQ checks, and what it cannot
It checks that the circuit builds, that angles are bound, that it compiles to the chosen target, that the ideal state is self-consistent, and (for requests that name a known state) that the outcome statistics are the right ones. It does not model noise, calibration drift, crosstalk, readout error, or a vendor's exact coupling map beyond the generic layouts here. For an algorithm it has no textbook answer for, the only proof is you reading the probabilities and agreeing they are what the algorithm should produce.
11. Troubleshooting
| You see | What happened | What to do |
|---|---|---|
| "Repair 1 of 2: …" in the status line | The script errored or missed something you asked for; the model is fixing it. | Wait. If it fails three times, the reason is in the chat with the trace behind "Show the error trace". |
| "Not done: …" in the chat | The circuit built but a request was not met (qubit count, measurement, a named state). | Ask for that one thing again in the composer, or edit the script. |
| No exact state, only counts | More than 20 qubits, a mid-circuit measurement, or classical control flow. | Expected; the histogram is still right. |
| Flat histogram for Grover | Too many or too few iterations, or the oracle marks the wrong string. | Say the number of iterations and spell the marked string per qubit. |
| "Request failed: network error" | The connection dropped during a build. | The page resumes the build from the server automatically; if not, Retry. |