Omega Functions: A Quantum/Hybrid Computing Runtime in Rust

 · quantum  · rust  · wasm

Quantum simulation is not a one-size-fits-all problem. A 30-qubit variational circuit, a 1000-qubit stabilizer circuit, and a Gaussian boson sampling experiment each demand fundamentally different computational strategies. Omega Functions is the runtime we built to handle that reality: an 11-crate Rust workspace where every quantum program dispatches to the backend that actually makes sense for the workload.

Why Multiple Backends

Most quantum frameworks pick one simulation engine and optimize around it. That works until your problem changes shape. We needed to support QAOA and VQE workloads (variational, moderate qubit counts), large Clifford-heavy circuits for error-correction research, tensor-network methods for circuits with limited entanglement, and photonic Gaussian states for boson sampling.

Rather than maintaining four separate simulators, we designed Omega Functions around a common circuit IR that compiles down to backend-specific execution plans. The backends currently include:

  • Statevector — full state simulation, the reference backend for correctness and small-to-medium circuits.
  • MPS Tensor Network — matrix product state simulation that scales gracefully when entanglement stays bounded.
  • Pauli (Clifford) — stabilizer-tableau simulation for circuits dominated by Clifford gates, running exponentially faster than brute-force statevector for the right workloads.
  • Photonics — continuous-variable Gaussian state evolution for optical quantum computing models.

A lightweight dispatcher examines the circuit structure — gate mix, entanglement pattern, qubit count — and selects the backend automatically. Users can also pin a backend explicitly when they know what they want.

Adjoint Differentiation

Variational quantum algorithms live and die by gradient quality. We implemented adjoint differentiation at the runtime level, which computes exact analytic gradients of circuit expectation values in a single backward pass through the circuit. This avoids the parameter-shift rule's overhead of running two circuits per parameter and gives us fast, numerically stable gradients that feed directly into classical optimizers.

The Circuit DSL

We wanted researchers on the team to express circuits without writing Rust. Omega Functions includes a small domain-specific language parsed by a Pest grammar. The DSL supports gate declarations, parameterized rotations, measurement, and classical control flow. The parser emits the common IR, which then flows through the backend dispatcher. The grammar is strict enough to catch errors early and loose enough to feel natural for anyone who has written OpenQASM or Quil.

WASM Runtime

One of the more unusual design choices was compiling the statevector and Clifford backends to WebAssembly. This lets us run QAOA and VQE circuits entirely in the browser — no server round-trip, no Python kernel, no notebook infrastructure. The QML Explorer web application uses this path for interactive demos, and we use it internally for quick circuit debugging without spinning up a local environment.

Why Rust

We evaluated C++, Python with C extensions, and Rust. Python was ruled out immediately for the core runtime — the overhead of crossing the Python/C boundary thousands of times per circuit execution is measurable and painful. C++ was viable but Rust gave us memory safety guarantees without runtime cost, a strong type system that caught backend-dispatch bugs at compile time, and Cargo workspaces that made the 11-crate structure manageable. The borrow checker is genuinely useful when you are juggling large state vectors and tensor contractions across threads.

Omega Functions underpins the Sqetch platform and several internal research pipelines, and the WASM build powers client-side execution in our web-facing tools. An open-source mirror of the runtime now lives at github.com/Anzaetek/omega-functions-public under Apache-2.0 — see the OSS release note for scope.

一部の旧記事は英語のみで提供されています。

← ブログに戻る