How Divi Works

How Divi Works

From Problem to Parallel Execution

Divi provides a structured pipeline that transforms high-level problem descriptions into batches of circuits, executes them in parallel, and aggregates the results.

Built-In Programs

Divi ships with several built-in program types:

Program Purpose
VQE Ground-state energy estimation for molecules
QAOA Combinatorial optimization on graphs and QUBOs
PCE Logarithmic-qubit QUBO optimization
TimeEvolution Hamiltonian time evolution via Trotterization
CustomVQA Optimize any parameterized circuit

Each program follows the same lifecycle:

  flowchart LR
    A["Define Problem"] --> B["Generate Circuits"]
    B --> C["Execute on Backend"]
    C --> D["Post-Process Results"]
    D --> E["Optimize Parameters"]
    E --> B

The Execution Pipeline

1. Problem Definition

You define the problem at a high level — a molecule, a graph, a QUBO matrix, or a custom circuit. Divi translates this into a cost Hamiltonian and parameterized circuits.

2. Meta-Circuits

Divi generates meta-circuits — circuit templates with symbolic parameters. These templates are bound to concrete parameter values at each optimization iteration, producing concrete circuit instances.

3. Circuit Generation

At each iteration, the optimizer proposes parameter values. Divi binds these to the meta-circuits and generates a batch of executable circuits. For algorithms like L-BFGS-B, parameter-shift gradient circuits are also generated — all in parallel.

4. Parallel Execution

The circuit batch is sent to the selected backend:

  • ParallelSimulator: Multi-threaded local simulation
  • QoroService: Cloud execution via Composer

Circuits within a batch are executed in parallel, maximizing throughput.

5. Post-Processing

Raw measurement results are combined and processed:

  • Expectation values are computed from measurement statistics
  • Observable grouping reduces the number of required circuits
  • Error mitigation (ZNE) is applied if configured
  • Results are aggregated across parameter sets

6. Optimization Loop

The optimizer uses the computed loss values to propose new parameters, and the loop repeats until convergence or the iteration limit is reached.

Extensibility

All built-in programs extend the VariationalQuantumAlgorithm base class. You can create custom programs by subclassing it and implementing:

  • _create_meta_circuits_dict() — Define circuit templates
  • _generate_circuits() — Produce circuit instances from parameters
  • _post_process_results() — Compute loss from raw results
  • _perform_final_computation() — Extract the final solution

This architecture ensures that parallelization, checkpointing, and backend selection work automatically for any custom algorithm.