Empowering Quantum Serverless Circuit Deployment Optimization via Graph Contrastive Learning and Learning-to-Rank Co-designed Approaches
Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence. AI4Tech: AI Enabling Technologies. Pages 9250-9258.
https://doi.org/10.24963/ijcai.2025/1028
Keywords
- Domain-specific AI4Tech: Other AI4Tech applications
- Advanced AI4Tech: Other advances
Abstract
With the rapid advancements in quantum computing, cloud-based quantum services have gained increasing prominence. However, due to quantum noise, optimizing the deployment of quantum circuits remains an NP-hard problem with an expansive search space. Existing methods usually use heuristic algorithms to approximate the solution, such as the representative IBM Qiskit. On the one hand, they often find suboptimal deployment solutions. On the other hand, prior technologies do not consider user-specific requirements and can only provide a single deployment strategy. In this paper, we propose QCDeploy that can provide a ranked list of effective deployment strategies to optimize quantum serverless circuit deployment. Specifically, we model quantum circuits as Directed Acyclic Graph (DAG) representations and utilize graph contrastive learning for vector embedding. Then, a tailored list-aware learning-to-rank architecture is employed to generate a list of candidate strategies (prioritizing better strategies). We conduct extensive evaluations involving 45 prevalent quantum algorithm circuits across 3~5 qubits, utilizing 3 IBM quantum physical devices with three types of chip topologies. The results demonstrate that our proposed framework significantly outperforms IBMQ's default deployment scheme, e.g., achieving 17.95% overhead reduction and increasing the execution success rate by 20%~40%.
- [Aleksandrowicz and others, 2019] Gadi Aleksandrowicz et al. Qiskit: An open-source framework for quantum computing. Accessed on: Mar, 16, 2019.
- [Apache, 2021] Apache. Open source serverless cloud plat- form. https://openwhisk.apache.org/, 2021. Link
- [Buyl et al., 2023] Maarten Buyl, Paul Missault, and Pierre- Antoine Sondag. Rankformer: Listwise learning-to-rank using listwide labels. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pages 3762-3773, 2023.
- [Chopra et al., 2021] Amit K Chopra, Munindar P Singh, et al. Deserv: Decentralized serverless computing. In 2021 IEEE International Conference on Web Services (ICWS), pages 51-60. IEEE, 2021.
- [Deng et al., 2022] Jinfeng Deng, Hang Dong, Chuanyu Zhang, Yaozu Wu, Jiale Yuan, Xuhao Zhu, Feitong Jin, Hekang Li, Zhen Wang, Han Cai, et al. Observing the quantum topology of light. Science, 378(6623):966-971, 2022.
- [Garcia-Alonso et al., 2021] Jose Garcia-Alonso, Javier Rojo, David Valencia, Enrique Moguel, Javier Berrocal, and Juan Manuel Murillo. Quantum software as a service through a quantum api gateway. IEEE Internet Computing, 26(1):34-41, 2021.
- [Gonzalez, 2021] Constantin Gonzalez. Cloud based qc with amazon braket. Digitale Welt, 5(2):14-17, 2021.
- [He et al., 2020] Kaiming He, Haoqi Fan, Yuxin Wu, Sain- ing Xie, and Ross Girshick. Momentum contrast for unsu- pervised visual representation learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 9729-9738, 2020.
- [Hietala et al., 2023] Kesha Hietala, Robert Rand, Liyi Li, Shih-Han Hung, Xiaodi Wu, and Michael Hicks. A veri- fied optimizer for quantum circuits. ACM Transactions on Programming Languages and Systems, 45(3):1-35, 2023.
- [IBM, 2022a] IBM. IBMQ Quantum. https: //quantum-computing.ibm.com/, 2022. Link
- [IBM, 2022b] Qiskit IBM. IBM Qiskit. https://qiskit.org/, 2022. Link
- [Kipf and Welling, 2017] Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR (Poster). OpenReview.net, 2017.
- [Lao et al., 2021] Lingling Lao, Hans Van Someren, Imran Ashraf, and Carmen G Almudever. Timing and resource- aware mapping of quantum circuits to superconducting processors. IEEE Transactions on Computer-Aided De- sign of Integrated Circuits and Systems, 41(2):359-371, 2021.
- [Li and Zhao, 2024] Tingting Li and Ziming Zhao. Moirai: Optimizing quantum serverless function orchestration via device allocation and circuit deployment. In 2024 IEEE International Conference on Web Services (ICWS), pages 707-717. IEEE, 2024.
- [Li et al., 2019] Gushu Li, Yufei Ding, and Yuan Xie. Tack- ling the qubit mapping problem for nisq-era quantum de- vices. In Proceedings of the 24th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), 2019.
- [Li et al., 2020a] Gushu Li, Yufei Ding, and Yuan Xie. Elim- inating redundant computation in noisy quantum comput- ing simulation. In 2020 57th ACM/IEEE Design Automa- tion Conference (DAC), pages 1-6. IEEE, 2020.
- [Li et al., 2020b] Gushu Li, Yufei Ding, and Yuan Xie. To- wards efficient superconducting quantum processor archi- tecture design. In Proceedings of the Twenty-Fifth Interna- tional Conference on Architectural Support for Program- ming Languages and Operating Systems, pages 1031- 1045, 2020.
- [Li et al., 2023] Junde Li, Mahabubul Alam, and Swaroop Ghosh. Large-scale quantum approximate optimization via divide-and-conquer. IEEE Transactions on Computer- Aided Design of Integrated Circuits and Systems (TCAD), 2023.
- [Li et al., 2024a] Tingting Li, Liqiang Lu, Ziming Zhao, Ziqi Tan, Siwei Tan, and Jianwei Yin. Qust: Optimizing quan- tum neural network against spatial and temporal noise bi- ases. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 2024.
- [Li et al., 2024b] Tingting Li, Ziming Zhao, and Jianwei Yin. Minerva: Enhancing quantum network performance for high-fidelity multimedia transmission. In Proceedings of the 32nd ACM International Conference on Multimedia, pages 3704-3712, 2024.
- [Li et al., 2024c] Tingting Li, Ziming Zhao, and Jianwei Yin. Qlsel: Demonstrating efficient high-fidelity link se- lection for quantum networks in the wild. In Proceedings of the 30th Annual International Conference on Mobile Computing and Networking, pages 1766-1768, 2024.
- [Li et al., 2024d] Tingting Li, Ziming Zhao, and Jianwei Yin. Task-driven quantum device fingerprint identifica- tion via modeling QNN outcome shift induced by quan- tum noise. In WWW (Companion Volume), pages 557-560. ACM, 2024.
- [Li et al., 2025a] Tingting Li, Ziming Zhao, Liqiang Lu, Si- wei Tan, and Jianwei Yin. Empowering quantum error traceability with moe for automatic calibration. In 2025 Design, Automation & Test in Europe Conference (DATE), pages 1-7. IEEE, 2025.
- [Li et al., 2025b] Tingting Li, Ziming Zhao, Liqiang Lu, and Jianwei Yin. Quframe: A novel encoding ensemble frame- work for quantum neural networks. In 2025 International Conference on Quantum Communications, Networking, and Computing (QCNC), pages 583-590. IEEE, 2025.
- [Mei et al., 2015] Lijun Mei, Hao Chen, Shaochun Li, Qicheng Li, Guangtai Liang, and Jeaha Yang. A service- based framework for mobile social messaging in paas sys- tems. In 2015 IEEE International Conference on Web Ser- vices, pages 751-754. IEEE, 2015.
- [Nguyen et al., 2024a] Hoa T Nguyen, Prabhakar Krish- nan, Dilip Krishnaswamy, Muhammad Usman, and Ra- jkumar Buyya. Quantum cloud computing: a review, open problems, and future directions. arXiv preprint arXiv:2404.11420, 2024.
- [Nguyen et al., 2024b] Hoa T Nguyen, Muhammad Usman, and Rajkumar Buyya. Qfaas: A serverless function-as-a- service framework for quantum computing. Future Gen- eration Computer Systems, 154:281-300, 2024.
- [Patel and others, 2020] Tirthak Patel et al. UREQA: lever- aging operation-aware error rates for effective quantum circuit mapping on nisq-era quantum computers. In USENIX ATC, 2020.
- [Pirandola and others, 2020] Stefano Pirandola et al. Ad- vances in quantum cryptography. Advances in optics and photonics, 12(4):1012-1236, 2020.
- [Preskill, 2018] John Preskill. Quantum computing in the NISQ era and beyond. Quantum, 2018.
- [Ren et al., 2022] Wenhui Ren, Weikang Li, Shibo Xu, Ke Wang, Wenjie Jiang, Feitong Jin, Xuhao Zhu, Jiachen Chen, Zixuan Song, Pengfei Zhang, et al. Experimental quantum adversarial learning with programmable super- conducting qubits. Nature Computational Science, 2022.
- [Saravanan and Saeed, 2023] Vedika Saravanan and Samah M. Saeed. Data-driven reliability models of quantum circuit: From traditional ML to graph neural network. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems (TCAD), 2023.
- [Shor, 1999] Peter W Shor. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM review, 41(2):303-332, 1999.
- [Smith et al., 2016] Robert S Smith, Michael J Curtis, and William J Zeng. A practical quantum instruction set archi- tecture. arXiv preprint arXiv:1608.03355, 2016.
- [Svore et al., 2018] Krysta Svore, Alan Geller, Matthias Troyer, John Azariah, Christopher Granade, Bettina Heim, Vadym Kliuchnikov, Mariia Mykhailova, Andres Paz, and Martin Roetteler. Q# enabling scalable quantum comput- ing and development with a high-level dsl. In Proceed- ings of the real world domain specific languages workshop 2018, pages 1-10, 2018.
- [Tan and Cong, 2020] Bochen Tan and Jason Cong. Optimal layout synthesis for quantum computing. In Proceedings of the 39th International Conference on Computer-Aided Design, pages 1-9, 2020.
- [Tan et al., 2023] Siwei Tan, Mingqian Yu, Andre Python, Yongheng Shang, Tingting Li, Liqiang Lu, and Jianwei Yin. Hyqsat: A hybrid approach for 3-sat problems by integrating quantum annealer with cdcl. In 2023 IEEE International Symposium on High-Performance Computer Architecture (HPCA), pages 731-744. IEEE, 2023.
- [Wang et al., 2022] Hanrui Wang, Jiaqi Gu, Yongshan Ding, Zirui Li, Frederic T. Chong, David Z. Pan, and Song Han. QuantumNAT: quantum noise-aware training with noise injection, quantization and normalization. In 59th ACM/IEEE Design Automation Conference (DAC), 2022.
- [Wille et al., 2019] Robert Wille, Lukas Burgholzer, and Al- win Zulehner. Mapping quantum circuits to IBM QX ar- chitectures using the minimal number of SWAP and H op- erations. In Proceedings of the 56th ACM/IEEE Design Automation Conference (DAC), 2019.
- [You et al., 2020] Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, and Yang Shen. Graph con- trastive learning with augmentations. Advances in neural information processing systems, 33:5812-5823, 2020.
- [Zhang et al., 2023a] Hezi Zhang, Anbang Wu, Yuke Wang, Gushu Li, Hassan Shapourian, Alireza Shabani, and Yufei Ding. Oneq: A compilation framework for photonic one- way quantum computation. In Proceedings of the 50th An- nual International Symposium on Computer Architecture, pages 1-14, 2023.
- [Zhang et al., 2023b] Pengfei Zhang, Hang Dong, Yu Gao, Liangtian Zhao, Jie Hao, Jean-Yves Desaules, Qiujiang Guo, Jiachen Chen, Jinfeng Deng, Bobo Liu, et al. Many- body hilbert space scarring on a superconducting proces- sor. Nature Physics, 19(1):120-125, 2023.
- [Zhao et al., 2025] Ziming Zhao, Tingting Li, and Zhaoxuan Li. Qufm: Towards efficient quantum link fidelity mea- surements in quantum networks. In 2025 International Conference on Quantum Communications, Networking, and Computing (QCNC), pages 516-520. IEEE, 2025.
- [Zhou et al., 2020] Xiangzhen Zhou, Sanjiang Li, and Yuan Feng. Quantum circuit transformation based on simu- lated annealing and heuristic search. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Sys- tems, 39(12):4683-4694, 2020.
- [Zulehner et al., 2018] Alwin Zulehner, Alexandru Paler, and Robert Wille. An efficient methodology for mapping quantum circuits to the ibm qx architectures. IEEE Trans- actions on Computer-Aided Design of Integrated Circuits and Systems, 38(7):1226-1236, 2018.
References were extracted automatically from the PDF and may contain errors.
Full text extracted automatically from the PDF; figures, tables and equations may differ. The PDF is the version of record.
1 Introduction
Quantum computing offers a significant advantage over classical computing in addressing computationally intensive problems, owing to its inherent properties of quantum superposition and entanglement [Zhao et al., 2025; Li et al., 2024c]. Some application scenarios involve physical simulation [Zhang et al., 2023b; Deng et al., 2022], quantum machine learning [Saravanan and Saeed, 2023; Ren et al., 2022], optimization problems [Li et al., 2023; Tan et al., 2023]. The broader quantum computing ecosystem is currently constrained by the limited availability of quantum hardware resources, which has led to the emergence of Quantum-as-a-Service (QaaS) platforms [Li and Zhao, 2024]. QaaS marks a pivotal shift in the provisioning of specialized quantum computing resources, following the industrywide trend of delivering technology through service-oriented models. It parallels established paradigms such as Functionas-a-Service (FaaS) [Chopra et al., 2021] and Platform-as-aService (PaaS) [Mei et al., 2015].
∗Co-corresponding authors.

In QaaS, quantum serverless architecture lowers the barrier to accessing quantum hardware [Li and Zhao, 2024; Nguyen et al., 2024b], but deploying quantum algorithms is a complex and multifaceted process. Particularly, Noisy IntermediateScale Quantum (NISQ) hardware [Preskill, 2018; Li et al., 2024d; Li et al., 2024a] is characterized by limited coherence times, noisy operations, and restricted qubit connectivity. Unlike logical qubits, physical qubits on NISQ devices can typically interact only with their immediate neighbors, making two-qubit gate operations challenging. Consequently, algorithm deployment necessitates a series of transpilation steps, including qubit mapping, circuit optimization, gate decomposition, topology-aware gate insertion, and eventual execution on physical hardware [Li et al., 2019]. We provide the illustrative explanation for circuit deployment in Figure 1. Consider deploying the original circuit (involving 3 qubits) onto the IBM Lima [IBM, 2022a] (the quantum device contains 5
qubits), the right part of Figure 1 displays two types of qubit mapping methods. It is clear that the transpiled circuit obtained using the Virtual to Physical: {0:1; 1:0; 2:3} strategy will use fewer gates and have a shorter execution time than the Virtual to Physical: {0:1; 1:4; 2:2} strategy. A detailed explanation of the factors leading to these differences in transpiled circuits is provided in § 3.2.
Deploying quantum algorithms on NISQ devices faces key challenges in qubit mapping and layout optimization, both NP-hard problems with large search spaces [Lao et al., 2021]. To this end, existing methods use heuristic algorithms for approximations, and a representative solution is IBM Qiskit [Aleksandrowicz and others, 2019]. Nevertheless, previous techniques have some limitations. On the one hand, they often provide suboptimal solutions, resulting in additional quantum gate overhead and reduced execution efficiency. On the other hand, existing solutions only provide a single deployment scheme, which may fail to satisfy specific functional requirements (e.g., constraints on fidelity).
In this paper, we propose QCDeploy that can provide a ranked list of effective deployment strategies to optimize quantum serverless circuit deployment. To the best of our knowledge, this is the first solution that considers user requirements of function execution results and provides a list of candidate strategies. Specifically, we model quantum circuits as Directed Acyclic Graph (DAG) representations and utilize graph contrastive learning for vector embedding. Subsequently, a tailored list-aware learning-to-rank architecture is employed to generate a list of candidate strategies (prioritizing better deployment strategies). As a result, QCDeploy not only delivers low-overhead deployment strategies but also offers multiple alternatives to accommodate diverse user-specific constraints and preferences.
In summary, this paper makes three key contributions.
- We carefully examine the challenges of function deployment when using current serverless FaaS technologies for quantum computing. Then, we propose QCDeploy, to provide a list of effective deployment strategies to optimize quantum serverless circuit execution.
- In QCDeploy, we employ the Graph Convolutional Network (GCN) to extract the embedding features of the circuit DAG, and leverage graph contrastive learning to capture structural patterns. The circuit graph embedding vector is then fed to the learning to rank architecture and outputs a list of candidate deployment strategies.
- We implement a prototype of QCDeploy and evaluate it substantially on the IBM Quantum platform with 3 physical devices. The experiments involve 100 groups of function sets based on 45 prevalent quantum circuits, encompassing 15 algorithms each configured with 3 different qubit counts. The results demonstrate that QCDeploy significantly outperforms the IBMQ default deployment scheme in terms of circuit execution overhead and execution success rate.
2 Background and RelatedWork
Quantum Computing and QaaS. Quantum computing has shown great potential in solving computational problems that are intractable for classical computers [Li et al., 2025b], such as factoring large numbers [Shor, 1999], cryptography [Pirandola and others, 2020], and simulating quantum systems [Zhang et al., 2023b]. Quantum as a Service (QaaS) is a cloud-based paradigm that provides remote access to quantum computing resources via the Internet [Garcia-Alonso et al., 2021], such as IBM Quantum [IBM, 2022a] and Amazon Braket [Gonzalez, 2021]. It allows users to leverage the power of quantum processors for various computational tasks without owning or maintaining the sophisticated and costly quantum hardware themselves. In the Noisy IntermediateScale Quantum (NISQ) [Preskill, 2018] era, characterized by the availability of quantum devices with a limited number of qubits that are prone to noise and error, has sparked a surge in quantum computing research and development [Li et al., 2025a]. Effectively utilizing NISQ-era quantum processors depends heavily on the efficient management of quantum resources. Therefore, optimizing the orchestration and choreography of circuit deployment is essential, as it can enhance resource efficiency, improve algorithm performance, and scalability.
Quantum Circuit Deployment. Deploying quantum algorithms onto physical hardware requires bridging the gap between high-level logical circuits and low-level hardware implementations [Preskill, 2018; Li and Zhao, 2024]. This deployment process typically involves compiling the algorithm into a sequence of quantum gates compatible with the target hardware [Smith et al., 2016], optimizing the circuit to reduce noise and resource consumption [Hietala et al., 2023], and mapping logical qubits to physical qubits [Zulehner et al., 2018]. The physical implementation is constrained by the hardware topology, which dictates how qubits can interact [Wille et al., 2019]. To accommodate these constraints, additional operations like SWAP gates may be required [Svore et al., 2018], complicating the deployment process. The above operations (such as mapping and routing) are NP-hard problems [Lao et al., 2021], making efficient and scalable solutions a critical area of research. Current solutions mainly include mathematical optimization and heuristic algorithms. Mathematical methods, such as integer linear programming (ILP) [Tan and Cong, 2020], aim for globally optimal solutions but often struggle with scalability due to the exponential size of the search space. Heuristic approaches, like genetic algorithms and simulated annealing [Zhou et al., 2020], provide approximate solutions that prioritize efficiency over optimality. In light of recent advances in artificial intelligence, we intend to promote a data-driven scheme for generating deployment strategies via deep learning techniques.
3 Preliminaries and ProblemFormulation
In this section, we formalize the system model and problem space of quantum serverless circuit deployment optimization.
3.1 SystemModel
We consider a system represented by the tuple SM = (D, F), where D denotes the available quantum devices (i.e., quantum computers) and F represents the set of functions that need to be executed. Formally, D = {d1, d2, ...} and F = {f1, f2, f3, ...}. The objective is to execute all functions in F using the devices in D. Note that for any function fi ∈ F requiring nc qubits, it can only be executed on a device dj ∈ D that provides at least nd ≥ nc qubits.


3.2 Optimization Goals
The optimization of quantum function deployment primarily involves two aspects: circuit deployment and candidate strategies. On the one hand, circuit deployment relies on the qubit mapping method to transpile the virtual circuit into a physical one. This process involves decomposing virtual circuit gates into basis gates supported by the target quantum hardware and inserting SWAP gates to satisfy the qubit connectivity constraints imposed by the device topology [Li et al., 2019]. Specifically, qubit mapping refers to assigning the nc qubits of the original circuit to the nd physical qubits of the selected quantum device, where nd ≥ nc. As shown in Figure 1, different qubit mapping configurations yield distinct transpiled circuits, which vary in terms of gate count and execution overhead. The primary reason for this variability lies in the physical connectivity constraints of the quantum chip, not all two-qubit operations can be directly executed between arbitrary pairs of qubits. In Figure 1, the original circuit includes a two-qubit gate (i.e., the CX gate involved q0 and q1). We analyze two different qubit mapping strategies for circuit deployment based on IBMQ Lima [IBM, 2022a]. For the Virtual to Physical: {0:1; 1:0; 2:3} strategy, q0 (corresponding to q1 in original circuit) and q1 (corresponding to q0 in original circuit) in IBMQ Lima are directly connected so as the CX gate can be directly implemented. For the Virtual to Physical: {0:1; 1:4; 2:2} strategy, q4 (corresponding to q1 in original circuit) and q1 (corresponding to q0 in original circuit) in IBMQ Lima are not directly connected so that the CX gate needs to be implemented with a series of additional SWAP gates to exchange the quantum states of two qubits. Therefore, we can see that more gates are introduced in Figure 1 (d) to achieve transpilation in the physical device.
On the other hand, considering that quantum computers are affected by quantum noise, when a given deployment scheme cannot meet user requirements (e.g., realize greater than 0.9 fidelity), we tend to provide a list of candidate deployment strategies to ensure the successful execution of user functions as much as possible.
Figure 3: The DAG conversion of the quantum circuit.
4 Design Details of QCDeploy
4.1 Architecture and Overview
In Figure 2, we depict a high-level architecture of QCDeploy, including key components of quantum circuit representation and learning to rank module. Among them, the functions (i.e., quantum circuits) arrive sequentially over time. Then, the function circuit will be converted into a Directed Acyclic Graph (DAG) to feed the Graph Convolutional Network (GCN) [Kipf and Welling, 2017] for embedding vector extraction. To enhance the representation, a tailored graph contrastive learning module is used to train the GCN parameters. Subsequently, the learning to rank module is used to generate a list of candidate deployment strategies.
4.2 QuantumCircuit Representation
A quantum circuit can be converted into a Directed Acyclic Graph (DAG), as illustrated in Figure 3. In this representation, each quantum gate corresponds to a node in the graph, and the qubits serve as edges connecting these nodes. For instance, a two-qubit gate results in a node with both in-degree and out-degree equal to 2, such as the CX gate in the BV 3 example shown in Figure 3. Note that the resulting DAG from a quantum circuit may be a MultiDiGraph, which allows multiple (parallel) edges between the same pair of nodes. Formally, a quantum circuit DAG (i.e., graph) can be defined as G = {V,A}, where V is the gate set consisting of n nodes {v1, · · · , vn}, and A ∈ Rn×n is a symmetric matrix used to characterize the adjacency relationship for nodes. Specifically, aij = 1 indicates an edge between nodes vi and vj, and 0 otherwise. To record the edge number of nodes, the node degreematrix is defined asD = diag(d1, · · · , dn) with
Algorithm 1 Contrastive Learning for Circuit Graph
Input: The initialized GCN-based graph embedding model
M, the quantum circuit graph dataset S Output: The well-trained modelM 1: # Generate graph viewwith random perturbations 2: procedure GENE GRAPH VIEWS(g) 3: g′ ← copy(g) 4: edges ← list(g′ .edges(keys=true)) ▷ Multiple edges 5: Initialize the perturbation probability prob 6: for edge ∈ edges do 7: if rand().item() < prob then 8: g′ .remove edge(edge) 9: end if 10: end for 11: return g′ .feature, g′ .edges 12: end procedure 13: # The training pipeline 14: Initialize the optimizer 15: Initialize the self-supervised contrastive loss criterion 16: for g ∈ S do 17: optimizer.zero grad() 18: feature1, edge1 ← Gene graph views(g) 19: feature2, edge2 ← Gene graph views(g) 20: zi ←M(feature1, edge1) 21: zj ←M(feature2, edge2) 22: loss ← criterion(zi, zj ) 23: loss.backward() 24: optimizer.step() 25: end for 26: return The well-trained modelM
In addition, we generate one-hot vectors for each node in the graph and stack them to form the feature matrix. Specifically, the nodes considered include 10 types, i.e., {'barrier', 'in', 'out', 'cx', 'cz', 'h', 'rz', 'u1', 'u3', 'x'}. Among them, 'barrier', 'in', and 'out' belong to circuit control nodes, corresponding to circuit logic partitioning, quantum state initialization, and quantum state measurement, respectively. And {'cx', 'cz', 'h', 'rz', 'u1', 'u3', 'x'} correspond to various single-qubit gates and two-qubit gates. Therefore, each node is finally mapped into a 10-dimensional one-hot vector, and the feature matrix of the circuit graph is represented as an n × 10 matrix.
4.3 Graph Vector Embedding
We employ a Graph Convolutional Network (GCN) [Kipf and Welling, 2017] model to extract the embedding representations of the circuit DAG. Specifically, GCN transforms each node vector of size f (i.e., the dimension of node input) into a vector of size c (i.e., the embedding dimension) through multiple graph convolutional layers. At the final layer, the embedding vectors of all nodes are averaged to obtain the embedding representation of the DAG. Formally, let X(l) = {x(l) 1 , · · · , x(l) n } ∈ Rn×c (l ∈ {1, · · · ,L}) denotes the node feature matrix after layer l and the row feature vector of node i represented as x(l) i = {h0, · · · , hc-1} ∈ Rc (especially, x(0) i ∈ Rf ). These vectors are updated at every layer, so as to construct a hierarchical profile with higher-level vectors representing broader and more abstract properties.

At each GCN layer, the vector of each node is first transformed by a learned matrix W (l) ∈ Rf×c as ˜x(l) i = x(l-1) i W (l) . Then, each node's representation vector is averaged with that of its direct neighbors, which allows this node to include its neighbor qubit information, effectively capturing the topological structure of the quantum circuit.
Furthermore, a non-linear function σ is applied at the end to complete updating the node representation vectors for the current layer. More compactly, we can express the above update in matrix form as X(l) ← σ( ¯ AX(l-1)W (l) ), where σ usually employs ReLU activation function (i.e., σ(x) = max(0, x)), and ¯ A = D-1/2 (A + I)D-1/2 is the normalized adjacency matrix (I refers the identity matrix).
Next, we will adopt self-supervised contrastive learning [You et al., 2020] to train the GCN embedding model parameters. The contrastive learning workflow is summarized in Algorithm 1. Given quantum circuit graph dataset S, take out a specific circuit g, and call the Gene graph views function to generate two views of g after random perturbations. Particularly, perturbation refers to randomly removing edge connections with a certain probability (lines 1∼12 in Algorithm 1). Subsequently, a tailored self-supervised contrastive learning loss is defined as follows:
where ˜ zi and ˜ zj are the normalized results of the embedding vectors (zi and zj at lines 20∼21 in Algorithm 1). In Eq. (3), the numerator calculates the positive-pair score, while the denominator represents the negative-pair score. Moreover, · represents the dot product, τ is the temperature hyperparameter [He et al., 2020], and ϵ is a small value to prevent numerical instability. The above contrastive learning loss is used to calculate the embeddings from both graph views. Then, the loss is backpropagated through the network, and the optimizer updates the model's parameters. Finally, we can obtain a well-trained model M, which enables effectively extracting embedding representations of quantum circuit graphs.

4.4 Candidate Deployment Strategy Generation
Given a quantum circuit graph, its virtual circuit (before deployment) assumes that all qubits are interconnected, as shown in the upper part of Figure 4. However, on a physical quantum chip, there is a certain connection relationship between qubits (i.e., chip topology). In addition, the deployment strategy will directly affect the connection relationship between qubits in the physical quantum circuit. A specific example is shown in the lower part of Figure 4, the qubit mapping from virtual to physical reference {0:1, 1:0, 2:2}. Thus, q[0] and q[1] are connected to each other in virtual circuits (due to q[1] is connected with q[0] in physical circuit); q[0] and q[2] are connected to each other in virtual circuits (due to q[1] is connected with q[2] in physical circuit).
For a specific deployment strategy mapping into a circuit graph, we can extract its graph vector embedding (in § 4.3), and the top node representations X(L) (after L layers) are cascaded with the average function, and the embedding vector representation of the circuit DAG can be denoted as follows.
To generate the candidate strategies, we use RankFormer architecture [Buyl et al., 2023] in QCDeploy, a list-aware Transformer designed for Learning-to-Rank (LTR) tasks. Let Ei represent the embedding vector for the i-th deployment strategy. The embedding vectors E1, E2, . . . , En are fed into a Transformer encoder. The Transformer processes these vectors to capture interdependencies among items within the list.
Each item's features hi are passed through a scoring head to produce a raw score si. This scoring head typically consists of a linear layer followed by an activation function.

In addition to individual item scores, QCDeploy also models the overall quality of the list using the [CLS] token's output from the Transformer, denoted as hCLS.
The final score for each item is a combination of its raw score si and the list's quality score q. This combination ensures that per-item scores are adjusted based on the overall list quality.
where α is a learnable parameter that controls the influence of the listwide quality on individual scores. The items are then ranked based on their final scores s′ . The ranking can be formally represented as sorting the indices i based on s′i :
Overall, QCDeploy will produce the candidate strategy list based on embedding vectors of deployment strategies.
5 Evaluation
In this section, we comprehensively evaluate the quantum serverless circuit deployment effect by QCDeploy, with code available in the online repository 1 .
5.1 Experiment Setup
Testbeds. We use OpenWhisk [Apache, 2021] to implement the quantum serverless framework, given that OpenWhisk is an open-source, distributed serverless computing platform that provides a flexible and scalable environment for running code snippets or functions without the need to manage infrastructure. Specifically, we deploy the IBMQ as the backend and employ IBM Qiskit [Aleksandrowicz and others, 2019] to conduct quantum experiments. Three quantum machines ['IBMQ Lima', 'IBMQ Manila', 'IBMQ Jakarta'] are utilized, and these machines consist of three distinct topological structures of quantum chips, as shown in Figure 5. For the quantum circuit deployment baseline, we use the default scheme of IBM [IBM, 2022a; IBM, 2022b] quantum computing platform as the competing algorithm, which is consistent with existing work [Wang et al., 2022].
Basic Quantum Circuits. For serverless function orchestration experiments, we generate a series of basic quantum circuits as the function to be executed. Specifically, 15 classical quantum algorithm circuits [Zhang et al., 2023a; Li et al., 2019; Li et al., 2020b; Li et al., 2020a] are used, including ['BV', 'Clifford', 'Grover', 'Ising', 'QFT', 'QKNN', 'QNN', 'QPE', 'QSVM', 'QuGAN', 'RB', 'Shor', 'Simon', 'VQC', 'XEB'], that cover commonly used quantum algorithm circuits. For each algorithm, we set the used qubit ranging from [3, 5], resulting in a total of 45 original circuits. These 45 (i.e., 15 algorithms × 3 types of qubit settings) original circuits will be transpiled onto 3 quantum devices with three types of chip topologies.
1 Repository https://github.com/Secbrain/QCDeploy.
| Candidate | Number of strategies = 10 | Number of strategies = 20 3 | Number of strategies = 30 | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Qubit | qubit = 3 | qubit = 4 | qubit = 5 | qubit = | qubit = 4 | qubit = 5 | qubit = 3 | qubit = 4 | qubit = 5 |
| IBMQ Lima | 87.47±0.09 | 83.41±0.12 | 92.03±0.08 | 73.30±0.11 | 73.53±0.18 | 78.15±0.15 | 68.67±0.09 | 69.12±0.21 | 75.83±0.15 |
| IBMQ Manila | 89.22±0.08 | 88.23±0.09 | 86.32±0.13 | 72.11±0.15 | 74.29±0.14 | 75.01±0.19 | 70.29±0.12 | 72.03±0.16 | 71.62±0.21 |
| IBMQ Jakarta | 82.42±0.15 | 89.12±0.10 | 84.47±0.18 | 73.04±0.15 | 75.90±0.16 | 74.45±0.18 | 66.96±0.15 | 71.22±0.17 | 68.51±0.22 |
| Candidate | Number of strategies = 40 | Number of strategies = 50 | Number of strategies = 60 | ||||||
| Qubit | qubit = 3 | qubit = 4 | qubit = 5 | qubit = 3 | qubit = 4 | qubit = 5 | qubit = 3 | qubit = 4 | qubit = 5 |
| IBMQ Lima | 65.66±0.12 | 69.03±0.24 | 72.65±0.16 | 60.16±0.18 | 66.49±0.27 | 72.78±0.18 | 60.03±0.21 | 65.80±0.28 | 71.51±0.19 |
| IBMQ Manila | 67.95±0.10 | 71.59±0.20 | 69.31±0.22 | 63.68±0.12 | 69.33±0.22 | 68.43±0.24 | 61.48±0.13 | 67.64±0.23 | 65.17±0.28 |
| IBMQ Jakarta | 66.34±0.09 | 68.40±0.18 | 64.83±0.25 | 65.96±0.09 | 66.54±0.20 | 59.68±0.26 | 65.36±0.10 | 66.54±0.19 | 60.75±0.24 |

Function Groups. For function sets, we randomly generate 200 groups from the original circuits, and each group comprises a random number of circuits ranging from [20, 50]. These 200 groups are divided into training and testing sets according to 1:1. For 100 testing groups of function sets, we visualize them in native-generated order in Figure 6 (a), and Figure 6 (b) corresponding to reordered by circuit index. Note that the groups with native-generated order in Figure 6 (a) are the test data for subsequent experiments.
5.2 Generated Strategy Analysis
We analyze the generated strategies based on the Normalized Discounted Cumulative Gain (NDCG) metric [Buyl et al., 2023], which is widely used to evaluate ranking quality. Different Number of Candidate Strategies. Under three quantum devices and three types of qubit settings, we consider different numbers of candidate strategies (i.e., [10, 20, 30, 40, 50, 60]), calculate the NDCG results of the generation strategies by QCDeploy and summarize them in Table 1. It is clear that when the number of candidates is smaller, QCDeploy realizes better results, e.g., under IBMQ Lima and qubit = 5, the NDCG is 92.03% for 10 candidate strategies. Even when considering 60 candidate strategies, QCDeploy can still achieve more than 60% NDCG results. This demonstrates the effectiveness of QCDeploy because we can usually narrow the candidate deployment strategies to less than a dozen by combining the topological connections between circuits and quantum chips.

Deployment Strategy Visualization. Furthermore, we visualize the generated strategies to provide more in-depth insights. Among them, the lighter the color of the block, the better the deployment strategy. Figure 7 shows 15 circuits with three types of qubit settings on IBMQ Manila (results of other devices can be found in the online repository), QCDeploy almost generates excellent deployment strategy lists, in which colors are arranged from light to dark. In addition, even if the first one is a suboptimal deployment strategy in some cases, the candidate strategy list generated by QCDeploy can support the optimal deployment strategy within a limited number of times.
Convergence Process during Training. We record the training loss and NDCG logs and plot them in Figure 8. It can be seen that the model converges quickly. At about Epoch = 25, the loss value drops to a lower level, and then NDCG gradually approaches the highest value at about Epoch = 75.
5.3 Deployment Effectiveness Evaluation
Next, we evaluate the practical deployment effect with IBMQ physical machines as the backend.
Circuit Execution Time Analysis. For three quantum machines, we randomly select 10 sets of functions and analyze the execution time of each quantum circuit. As shown in Figure 9, our solutions all outperform the default deployment strategy of IBMQ. For example, for G10 under IBMQ Manila machine, the maximum execution time is reduced from ∼78µs to ∼64µs, which realizes 17.95% overhead reduction. This demonstrates that vector embedding design and graph contrastive learning in QCDeploy can effectively extract quantum circuit representations, thereby enabling remarkable deployment strategy generation.

Function Execution Success Rate. Moreover, we consider a conditionally constrained setting in the real world where users have requirements on the execution overhead and fidelity of functions. Specifically, we set the execution fidelity greater than 0.9 as the success condition. We plot four groups of function sets from the testset in Figure 10, based on the IBMQ Lima machine. We can observe that, at the end of each function set, the success rate of IBMQ is between 40% to 80%. In contrast, all our solutions achieve a 100% success rate. The black star mark indicates that this function succeeded after executing two candidate strategies. In other words, in the candidate list generated by QCDeploy, the first one cannot meet the fidelity condition, while the second strategy can meet the requirement. This highlights that the Learning-to-Rank design in QCDeploy is able to prioritize and recommend the optimal deployment strategy, thereby supporting low execution overhead and high fidelity within a limited number of times to meet user needs.
6 Discussion
Practicability of Quantum Serverless FaaS. In the realm of quantum computing, the efficient orchestration of quantum resources is paramount to enhancing the performance and scalability of quantum algorithms. Motivated by the current advancements in Function-as-a-Service (FaaS) and Quantumas-a-Service (QaaS) [Nguyen et al., 2024b], our research aligns with the ongoing technological convergence of these paradigms and explores their architectural integration. Furthermore, our proposed approach is also readily applicable to major quantum cloud service providers, such as IBM, Amazon Web Services (AWS), Microsoft Azure, Google Cloud Platform, and so on [Nguyen et al., 2024a]. This compatibility underscores the practical extensibility of our method in real-world quantum computing infrastructures.

Limitations and Future Work. For different users, there may be some specific patterns in circuit architectures (or scale), so considering fine-grained customer-customized orchestration solutions may be an interesting and promising direction. As part of future work, we will explore more advanced neural network architectures that can be integrated into the QCDeploy framework to enhance its decisionmaking capabilities. Furthermore, quantum noise [Patel and others, 2020; Li et al., 2024b] can also be considered and used as input for function orchestration action to build higherfidelity circuits on physical machines. Finally, which components can be parallelized to run more efficiently will be considered in subsequent work.
7 Conclusion
In this paper, we present QCDeploy, to provide a list of effective deployment strategies to optimize quantum serverless circuit deployment. Given the properties of quantum circuits, QCDeploy designs the tailor-made circuit representation scheme, including DAG conversion and GCN embedding vector feature extraction. Moreover, QCDeploy leverages graph contrastive learning for mining node connection patterns and learning-to-rank architecture to generate a list of candidate strategies. Based on 3 IBM quantum physical devices, extensive experiments with 45 quantum algorithm circuits demonstrate that QCDeploy can effectively reduce circuit execution time and improve execution success rate.
@inproceedings{ijcai2025p1028,
title = {Empowering Quantum Serverless Circuit Deployment Optimization via Graph Contrastive Learning and Learning-to-Rank Co-designed Approaches},
author = {Li, Tingting and Zhao, Ziming and Yin, Jianwei},
booktitle = {Proceedings of the Thirty-Fourth International Joint Conference on
Artificial Intelligence, {IJCAI-25}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
editor = {James Kwok},
pages = {9250--9258},
year = {2025},
month = {8},
note = {AI4Tech: AI Enabling Technologies},
doi = {10.24963/ijcai.2025/1028},
url = {https://doi.org/10.24963/ijcai.2025/1028},
}
TY - CPAPER TI - Empowering Quantum Serverless Circuit Deployment Optimization via Graph Contrastive Learning and Learning-to-Rank Co-designed Approaches AU - Li, Tingting AU - Zhao, Ziming AU - Yin, Jianwei T2 - Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence, IJCAI-25 PB - International Joint Conferences on Artificial Intelligence Organization PY - 2025 SP - 9250 EP - 9258 DO - 10.24963/ijcai.2025/1028 UR - https://doi.org/10.24963/ijcai.2025/1028 ER -Copied
Machine-readable versions of this paper, for tools and AI agents: