Products

Uncertainty HubLearning workbenchMENOSSimulation runtimeSTHIRASAI modelQaulium StudioBuild studio
Startup AcceleratorComing soon

Plan first, then simulate: how MENOS chooses an execution strategy

Most simulators push every circuit through one engine. MENOS treats simulation as a compilation problem instead, pricing six exact strategies and running the cheapest one that fits.

Ask most quantum simulators to run a circuit and they do one thing: allocate a statevector and apply gates to it. That is the right call for a small, dense, highly entangled circuit. It is the wrong call for almost everything else, and it fails the hardest exactly where people most want to go, which is more qubits.

MENOS starts from a different premise. Before it simulates anything, it works out how the circuit should be run, then runs that plan. It is a compiler and runtime for simulation, not one more engine.

One engine is the wrong default

A dense statevector for n qubits holds 2ⁿ complex amplitudes. Every added qubit doubles the memory, so the wall arrives quickly and it arrives for every circuit, whether or not the circuit needed all that state.

Plenty of useful circuits never do. A circuit built only from Clifford gates can be tracked as a stabilizer tableau whose size grows polynomially. A circuit with limited entanglement compresses well as a matrix product state. An expectation value can often be computed by propagating the observable backwards rather than the state forwards. Qubits that never interact do not need to share a state at all.

Each of those is a different engine with a different cost curve. Picking one up front, for every job, guarantees the wrong choice for a large share of them.

Analyze, then price

Every job goes through the same stages, whether it has two qubits or a hundred:

  1. Convert the Qiskit circuit into MENOS's own intermediate representation, KIR.
  2. Validate it: well-formed, measurements terminal, an output actually requested.
  3. Reduce it with light-cone reduction, dropping every operation outside the causal past of the requested output.
  4. Analyze the interaction graph to find independent groups of qubits.
  5. Estimate each candidate engine: is it feasible, what is its peak memory, how much work will it do?
  6. Plan: the cheapest feasible candidate wins.

Six strategies are priced under one cost model: dense, stabilizer, Pauli propagation, MPS, tensor network and exact circuit cutting. Stages one to six happen before any simulation work begins. Planning is cheap; picking the wrong engine is not.

What a plan looks like

You can ask MENOS how it planned any job. Here is the report for a three-qubit GHZ circuit, sampled 100 times:

MENOS EXECUTION REPORT
circuit    qubits=3 clbits=3 operations=6 depth=4 global_phase=0
light_cone qubits 3->3 operations 6->6
candidate 0  strategy=direct_dense      feasible=true winner=false peak_bytes=128 work_units=96
candidate 1  strategy=direct_stabilizer feasible=true winner=true  peak_bytes=56  work_units=33
candidate 2  strategy=direct_mps        feasible=true winner=false peak_bytes=256 work_units=51
strategy   direct_stabilizer (exact)
region 0   qubits=[0,1,2] engine=stabilizer backend=cpu

Three candidates were feasible. The stabilizer engine won with 33 work units, against 51 for MPS and 96 for dense. Every candidate is listed, the losers included, so the choice is never a black box.

At the other end of the scale, the same pipeline handles a 100-qubit brickwork circuit. The dense engine is refused outright, because 2¹⁰⁰ amplitudes is not a plan. The stabilizer engine is refused because the circuit contains a non-Clifford rotation. MPS is feasible with a small peak memory, so it runs, and the result comes back exact.

Budgets are checked before anything is allocated

Each plan has to fit inside a memory budget, which defaults to 50% of physical RAM. That check happens at planning time. If no candidate fits, the job fails with ResourceExceeded before a single byte of state is allocated, rather than thrashing the machine and dying halfway through.

Time budgets work at run time. When one is set, MENOS compares elapsed time against it at safe boundaries during execution. On an overrun it halts cleanly, records the runtime floor it actually observed, and hands that observation back to the same planner. The planner then picks again with better information, or refuses.

CPU or GPU, by measured cost

For dense simulation there is one more choice: the host CPU or a CUDA device. A GPU is not automatically faster. Kernel launches and transfers across PCIe have fixed costs that swamp the arithmetic on small circuits.

So MENOS calibrates those costs on the machine it is running on, estimates end-to-end seconds for both options, and sends the job to the GPU only when that estimate is lower. Ties go to the CPU. Our benchmark write-up shows why that matters: on a laptop GPU, the crossover sits somewhere around 16 to 18 qubits, and it moves with the algorithm.

Exact, or refused

None of this planning ever trades accuracy for speed. Every engine reachable from Python is exact. When an exact run cannot fit the budget, MENOS refuses the job instead of quietly switching to an approximation. We wrote about why in Exact, or refused.

Try it

MENOS is a Python package, and it plugs into Qiskit as a native BackendV2 and EstimatorV2:

pip install "menos[qiskit]"

Start with the installation guide, read how MENOS executes for every stage in detail, or browse the source on GitHub.