Skip to main contentIBM Quantum Documentation Preview
This is a preview build of IBM Quantum® documentation. Refer to quantum.cloud.ibm.com/docs for the official documentation.

Parity Twine Optimizer: A Qiskit Function by ParityQC

Note

Qiskit Functions are an experimental feature available only to IBM Quantum® Premium Plan, Flex Plan, and On-Prem (via IBM Quantum Platform API) Plan users. They are in preview release status and subject to change.


Overview

The Parity Twine Optimizer allows users to solve optimization problems with quantum computers using the Parity Twine method. This approach, built on the Parity Architecture, uses the ParityQC compiler to minimize the gate counts and circuit depth required to run a quantum algorithm while accounting for device connectivity.

This resource reduction enables solving industry-relevant optimization problems for sizes that are unfeasible with standard, SWAP-heavy, transpilation methods. The Parity Twine Optimizer automates transpilation steps and can be used with minimal user input.

The Parity Twine approach outperforms all other compilation methods in terms of reducing gate counts and circuit depths for quantum algorithms such as the quantum approximate optimization algorithm (QAOA) and quantum Fourier transform (QFT). By abstracting quantum information away from the physical qubits, non-local interactions are implemented without SWAP gates. Instead, Parity Twine chains (sequences of CNOT gates) systematically distribute logical parity information between qubits.

The optimizer uses the QAOA to minimize the energy of a given cost function. QAOA is a hybrid quantum-classical variational algorithm designed to solve combinatorial optimization problems by approximating the ground state of a cost Hamiltonian (HCH_C). A mixing term (HBH_B) drives transitions between states to explore the solution space. An alternating sequence of these terms, controlled by parameters γ\gamma and β\beta, defines the unitary U(γ,β)=Πi=1peiβiHBeiγiHCU(\gamma, \beta) = \Pi_{i=1}^p e^{-i \beta_i H_B} e^{-i \gamma_i H_C}, which acts on the initial state.

Encoding of the problem unitary, exp(iβHC)-i \beta H_C)), requires encoding of all logical nn-body rotation operators (exp(iβJi,j,...nZiZj...Zn-i \beta J_{i,j,...n}Z_iZ_j...Z_n)). This can be accomplished using nn-body generators (Parity Twine Networks), which reduce the QAOA circuit depth and two-qubit gate count.


Description

The Parity Twine Optimizer input consists of an optimization problem, the chosen IBM Quantum hardware name, and additional optional arguments to tailor the transpilation and hardware execution settings. The optimizer function routes the problem definition to the Parity Twine Compiler. Figure 1 shows a summary of the function workflow.

Parity Twine Optimizer workflow
Figure 1: Summary of the Parity Twine Optimizer workflow.

The input optimization problem is pre-processed into a (normalized) Hamiltonian. The ParityQC compiler then constructs a parameterized Parity Twine ansatz circuit, which is transpiled to a logical ansatz matching the native gate set of the chosen hardware.

QAOA circuit parameters are classically optimized using the "efficient depth one" approach and assigned to the transpiled circuit. As one round of QAOA is used, optimal γ\gamma and β\beta parameters are obtained using a grid search on a CPU without the need for costly iterative optimization over many circuit calls. This greatly minimizes the required QPU runtime of the optimizer. Execution time per circuit is mostly determined by the constant overhead to run a job on the QPU. With the circuit parameters set, the job is submitted to the specified IBM® QPU.

Raw results are then post-processed. This step uses a local greedy search that iterates randomly through the solution string and flips bit values if this reduces the value of the cost function.


Benchmarks

Disclaimer

Performance can depend on both the problem instance and subsequent processing steps. In some cases, classical samples and quantum-generated samples might achieve similar final solution quality after equivalent post-processing. Evaluation should therefore consider the complete optimization workflow.

Sherrington-Kirkpatrick model

Figure 2 demonstrates the effectiveness of the Parity Twine Optimizer. This compares results obtained using the optimizer against random sampling for the Sherrington-Kirkpatrick model with increasing qubits.

Post-processing of both the random and optimizer results leads to exact ground states, but the raw minimum energy output from Twine QAOA is always better than random values. For the largest qubit numbers considered (90 and 100), hardware noise degrades the optimizer result where it reverts to raw values matching random sampling.

Parity Twine Optimizer SK Benchmarks
Figure 2: Benchmark results for Parity Twine Optimizer for SK model compared to random sampling. Results were obtained on `ibm_boston` with 20,000 shots, repeated three times.

See this tutorial for an introduction to the Sherrington-Kirkpatrick model and details on how to solve it with the Parity Twine Optimizer.

Market Split problem

Table 1 shows specific performance metrics for the Parity Twine Optimizer applied to various instances of the Market Split (MS) problem. These were obtained from the QOBLIB - Quantum Optimization Benchmarking Library and correspond to submissions made to the library using the Parity Twine Optimizer.

MS violation is an accuracy metric that measures how far the solution is from satisfying all constraints, defined as i((Axb)i)2\sum_i ((Ax - b)_i)^2. Lower values of this metric indicate more accurate solutions. Table 1 reports averaged values for five runs of each instance using the Parity Twine Optimizer with the ibm_boston device as a backend and 100,000 shots. The minimum MS violation obtained from the runs of each instance is reported.

Instance
Qubits
Two-qubit gates
Two-qubit depth
MS violation
Mapping time (s)
QPU runtime (s)
Post-process time (s)
ms_03_050_00220399760452971
ms_03_100_02220399760302977
ms_03_200_17720399760332963
ms_04_050_0013089911616829216
ms_04_100_0033089911628929187
ms_04_200_0303089911638929219
ms_05_100_003401599156323730364
ms_06_050_001502499196449930464
ms_07_050_0016035992361785831637
ms_08_050_00170489927636156131773

Table 1: Performance metrics for different instances of the Market Split problem. Instance names are for corresponding examples in the QOBLIB problem library. As mentioned previously in the description section, the QPU time is minimal and almost constant, as only one round of QAOA is used with optimal circuit parameters obtained on a CPU.

See this tutorial for an introduction to the Market Split problem and details on how to solve it with the Parity Twine Optimizer.

Maximum Independent Set problem

Figure 3 compares results obtained using the Parity Twine optimizer against random sampling for the maximum independent set problem for selected instances obtained from the QOBLIB - Quantum Optimization Benchmarking Library. These range from 18 (mammalia-kangaroo-interactions) to 114 (es60fst03) qubits.

For small instances, the raw Maximum Independent Set size results from the optimizer and random sampling are similar, but for larger instances, the optimizer gives far better results. Post-processing of both the random-sampled and optimizer results again leads to set sizes in agreement with exact values.

Parity Twine Optimizer MIS Benchmarks
Figure 3: Benchmark results for Parity Twine Optimizer for MIS model compared to random sampling. Results were obtained on `ibm_boston` with 20,000 shots, repeated three times.

Get started

Authenticate using your IBM Quantum Platform API token and select the Qiskit Function as:

from qiskit_ibm_catalog import QiskitFunctionsCatalog

# Authenticate and load the Qiskit Function
catalog = QiskitFunctionsCatalog(
    channel="ibm_quantum_platform",
)
function = catalog.load("parityqc/parity-twine-optimizer")

Example

The Parity Twine Optimizer can be applied to a simple QUBO example as follows. The problem is first defined by using a dictionary:

problem = {"()": 3, "(0,)": 1, "(0, 1)": 2, "(1, 2)": -1}

Then, the variable type has be defined as binary or spin:

variable_type = "spin"

This defines the objective function 3+s0+2s0s1s1s23 + s_0 + 2 s_0s_1 - s_1s_2 where si{1,1}s_i \in \{-1, 1\}.

Choose a backend. For example:

backend_name = "ibm_phoenix"

Use catalog.backends() to see a list of available backends from the user account/instance.

If no backend is specified, the least-busy backend (the one with the least number of pending jobs) is automatically selected.

Once the optimizer is loaded (see previous), you can run it on the problem using default options:

function_job = function.run(
    problem=problem, variable_type=variable_type, backend_name=backend_name
)
print(f"Job ID: {function_job.job_id}")

Check the job status as follows:

# Monitor the job status
function_job.status()

Retrieve results as follows:

# Retrieve the job result if the status is DONE
result = function_job.result()

result

Printing the results gives the following:

{
    'solution': {'0': -1, '1': 1, '2': 1},
    'objective_value': -1.0,
    'solution_bitstring': '100',
    'metadata': {
        'circuit_metrics': {
            'depth': 20,
            'gate_count': 198,
            'two_qubit_gate_depth': 4,
            'two_qubit_gate_count': 4,
            'num_qubits': 3,
            'operations': {'delay': 158, 'rz': 17, 'sx': 14, 'cz': 4, 'measure': 3, 'x': 2}
        },
        'solver_info': {
            'variable_mapping': {'0': 0, '1': 1, '2': 2},
            'bitstring_distributions': {
                'before_postprocessing': {'100': 71760, ... },
                'after_postprocessing': {'100': 88440, '011': 11560}
            },
            'best_parameters': {
                'beta': [-0.46259546391008877],
                'gamma': [0.6181957189727373]
            }
        },
        'resource_usage': {
            'RUNNING: MAPPING': {'CPU_TIME': 42.878},
            'RUNNING: OPTIMIZING_FOR_HARDWARE': {'CPU_TIME': 0.094},
            'RUNNING: WAITING_FOR_QPU': {'CPU_TIME': 790.623},
            'RUNNING: EXECUTING_QPU': {'QPU_TIME': 28.0},
            'RUNNING: POST_PROCESSING': {'CPU_TIME': 0.828}
        }
    }
}

The solution dictionary corresponds to the qubits defined in the problem (s0,s1s_0, s_1, and s2s_2) and gives their optimized spin values.

The objective_value is the cost or energy of the optimization problem. It quantifies the solution quality.

metadata gives information on the transpilation (two-qubit gate counts/depth, gates used, active qubits) and various runtimes for both quantum and classical compute time.

Additionally, metadata provides a glimpse into the internal workings of the algorithm. You can see the optimized variational parameters (beta and gamma) and review how the distribution of measured bitstrings improved after classical post-processing was applied to the raw quantum results.

All bitstrings in the result output can be mapped to the problem variables by using the variable_mapping. For example, you can map the 'solution_bitstring': '100' with the 'variable_mapping': {'0': 0, '1': 1, '2': 2} to the binary solution: {'0': 1, '1': 0, '2': 0}. Since you are solving the problem in terms of spin variables, you need to apply the binary to spin transformation (0 -> 1, 1 -> -1 ). You then arrive at the final solution 'solution': {'0': -1, '1': 1, '2': 1}.

Refer to the API reference for full details of the input to and output from the Parity Twine Optimizer function.


Changelog

[1.0.1] - 2026-09-15

Notes

This release marks the first stable production version of the Parity Twine Optimizer Qiskit Function. Future releases are expected to introduce the following:

  • higher-order problem compilation,
  • additional optimization algorithms, and
  • improvements in pre- and post-processing.

Features

  • Solve sparse and dense QUBO problems with the efficient Parity Twine Compiler.

Documentation

  • Getting started user guide.
  • Tutorials with examples for Market Split and Sherrington-Kirkpatrick problems.
  • API documentation.

Get support

Contact ParityQC with any questions or issues.


Next steps

Recommendations