Pattern Atlas

Extended Quantum Computing Patterns

Pre-deployed Execution

Aliases:

Tags:

© https://www.scitepress.org/Link.aspx?doi=10.5220/0012057700003538

Intent

How to execute quantum circuits with classical pre- and post-processing steps that have custom deployment requirements?

Context

Most quantum algorithms are hybrid, e.g., VQAs contain a hybrid loop with many successive executions of parameterized quantum circuits with optimization steps in-between performed on classical hardware [Cerezo et al., 2021]. Further, quantum devices are accessed via the cloud and to execute a circuit, it is queued in the job-queue of the respective service, which may not support the execution of classical code parts. Thus, a quantum circuit and its classical pre- and post-processing steps may need to be deployed in a specific manner, e.g., together or using specific combinations of cloud service offerings.

Forces

Quantum service offerings vary significantly feature-wise and often rely on different authentication mechanisms, proprietary formats, and SDKs. Additional technical expertise may be required to successfully execute a provided quantum circuit with its pre- and post-processing steps that can be hosted separately, e.g., due to data processing requirements. In certain cases, it is more beneficial to execute quantum and classical parts of the application in proximity of each other, e.g., to reduce the networking overhead.

Solution

Pre-deploy the quantum circuit with its pre- and post-processing steps either on (i) a single quantum offering that supports execution of quantum and classical parts, or (ii) a specific combination of quantum and cloud offerings that fulfills the given deployment requirements. Figure 4 shows the solution sketch of this pattern: In Step 1, the quantum and classical parts are deployed according to deployment preferences. The subsequent execution and fetching of the results shown in Steps 2&3 can be done independently by developers or client applications.

Solution Sketch for Pre-deployed Execution

Variants: One deployment target option in Step 1 is a Hybrid Execution Environment offering that can speed up the interaction between quantum and classical computations. Hence, they reduce the network overhead and queuing times for many successive quantum circuit executions. Another variant is a Distributed Deployment in which parts of the quantum application are deployed on a combination of different cloud offerings. Implementation of quantum and classical parts, as well as their deployment models, depend on chosen technologies, e.g., implementation of QAOA for Qiskit Runtime would impose more coding and deployment modeling constraints compared to more general deployment scenarios such as packaging the quantum application as one or more containers that can be deployed to a container orchestration engine such as Kubernetes and later executed via client requests.

Result

The deployment of quantum applications is decoupled from its execution, hence, enabling the invocation by other users or integration with other applications, e.g., a pre-deployed VQA can be subsumed as a part of another application. In the case of hybrid runtimes, the pre-deployed application benefits from provider-managed execution transparency but is locked into the requirements and limitations of the underlying offering. In the Distributed Deployment variant, developers can benefit from combining different services for specific parts of the application.

Related Patterns

Pre-deployed execution of hybrid applications improves the reusability of different algorithms such as the VQA and the more concrete patterns like VQE and QAOA [Weigold et al., 2021b]. Additionally, pre- and post-processing steps, such as STATE PREPARATION [Leymann, 2019] or READOUT ERROR MITIGATION [Beisel et al., 2022], can be applied to run on preferred execution targets.

Known Uses

Qiskit Runtime [Qiskit, 2023a] is a service from IBM, which offers a hybrid execution environment that enables deploying a quantum application packaged as a Python file with a JSON meta-data file, and subsequently executing it via a publicly available HTTP endpoint. A similar service is Amazon Braket Hybrid Jobs [AWS, 2023]. Microsoft also introduced the hybrid execution environment and shows an example how to use it [Frachon, 2023]. For distributed deployment scenarios, various cloud offerings can be employed for classical tasks. Example offerings from AWS include AWS Lambda for executing classical Python code, AWS S3 as an object storage offering, and Amazon Cloudwatch for monitoring.