Manuscript Offprint

arXiv:2611.09744

QAOA for Layered Architecture Recovery: Feasibility, Limits, and the Role of Decomposition

Julien Cardinal, Andrew Chedid, Imen Benzarti, Ghizlane El Boussaidi, Christophe Pere, Jean-Marc Robert

Abstract

Layered architecture recovery (LAR) reconstructs a system's architectural layers from its package dependencies, and is defined as a combinatorial optimisation problem solved with classical search. We investigate whether the Quantum Approximate Optimization Algorithm (QAOA) can be applied to LAR, and with what practical limitations. We formulate LAR as a Quadratic Semi-Assignment Problem, transform it into a Quadratic Unconstrained Binary Optimisation (QUBO) problem in which each package is penalised unless it is assigned to exactly one layer, and encode it as an Ising Hamiltonian solved by QAOA. To reach instances beyond the qubit budget of a single circuit, we also apply an impact-guided decomposition that solves the problem as a sequence of smaller sub-problems. We evaluate the approach on three real Java systems (15, 18, and 24 qubits), studying the effect of circuit depth and sampling budget (RQ1), a comparison with a classical Tabu Search baseline (RQ2), robustness to simulated quantum noise (RQ3), and the decomposition (RQ4). We find that monolithic QAOA is feasible and accurate on the two smaller systems but fails on the 24-qubit instance, that the sampling budget rather than circuit depth governs its accuracy, and that it is competitive with but does not outperform Tabu Search. Decomposition restores reliable recovery on the 24-qubit instance, raising the optimal rate from 6.7% to 93.3%; its accuracy is governed by the size of each sub-problem and, unlike the monolithic pipeline, improves as the sampling budget is reduced. Our results indicate that, in the current noisy intermediate-scale regime, problem decomposition, rather than larger circuits or more sampling, is the key to applying QAOA to software architecture recovery.

Keywords: Layered architecture recovery, Quantum approximate optimization algorithm (QAOA), Quantum software engineering, Quadratic unconstrained binary optimization (QUBO), Impact-guided decomposition, Software architecture recovery

1 Introduction

Understanding a software system's architecture is essential for its maintenance and evolution [1]. As software systems evolve, however, their implementations often drift away from the intended architectural design. This phenomenon is referred to as architecture erosion [2, 3]. Architectural decisions become implicit, structural dependencies accumulate, and the original organization of the system may no longer be directly observable from the source code [1]. Architecture recovery aims to reconstruct this architectural structure from implementation artifacts, by supporting program comprehension, software evolution, and the identification of architectural degradation [1, 3].

Layered Architecture Recovery (LAR), as formalised by Belle et al. [4], addresses this problem by assigning software packages to architectural layers based on their observed dependencies. A good assignment favours dependencies toward the immediately adjacent lower layer while penalising architectural violations such as back-calls, skip-calls, and intra-layer dependencies [4]. Belle et al. formulate LAR as a Quadratic Semi-Assignment Problem (QSAP), a computationally difficult combinatorial optimization problem related to the Quadratic Assignment Problem (QAP) [4, 5]. Architecture recovery and software remodularization problems of this kind are commonly addressed using heuristic and metaheuristic search techniques [4, 6, 7]; in particular, Belle et al. employ Tabu Search to solve the LAR formulation. As the number of packages and candidate layers increases, however, the number of possible assignments grows combinatorially, making the exploration of the solution space increasingly challenging [4, 5] and motivating the investigation of alternative optimization paradigms.

Quantum optimization provides one such alternative. In particular, the Quantum Approximate Optimization Algorithm (QAOA) [8] is a hybrid quantum-classical variational algorithm designed for combinatorial optimization. QAOA encodes an optimization objective into a problem Hamiltonian and alternates problem and mixer operators in a parameterised quantum circuit, whose parameters are optimized through a classical routine. QAOA is particularly relevant to optimization problems that can be expressed as Quadratic Unconstrained Binary Optimization (QUBO) models. Within software engineering, quantum and quantum-inspired optimization has received increasing attention, although recent work remains concentrated in a limited number of problem domains, particularly software testing [9–12]. Applications include test-case optimization [9], test-case minimization [13], and test-case selection [10], while other software engineering activities remain comparatively underexplored [12].

LAR is particularly interesting from a quantum-optimization perspective because its QSAP formulation can be transformed into a QUBO and subsequently encoded as an Ising Hamiltonian suitable for QAOA. At the same time, the characteristics of current quantum computing raise important questions about whether such a formulation can produce useful solutions in practice. To the best of our knowledge, QAOA has not previously been investigated for layered architecture recovery.

In this work, we investigate the feasibility, effectiveness, and practical limitations of applying QAOA to LAR. Rather than seeking to demonstrate quantum advantage, which would be premature at the scale of current quantum hardware, our objective is to determine how LAR can be formulated for QAOA and to empirically characterise the behaviour of the resulting hybrid quantum-classical approach. In particular, we examine how circuit depth and sampling budget affect solution quality, how QAOA compares with a classical Tabu Search baseline, and how simulated quantum noise affects its behaviour. Experiments are conducted using ideal and noisy quantum simulators with configurations intended to reflect the resource constraints of near-term quantum execution.

This study builds on our earlier experience report on migrating a QAOA implementation across Qiskit versions [14]. That work focused primarily on the engineering and validation of the QAOA implementation, comparing a custom pipeline with the Qiskit Algorithms library and highlighting the importance of the sampling budget for solution quality. The present work moves from implementation validation to a systematic empirical investigation of QAOA for LAR. It introduces the problem formulation and evaluates the approach across multiple software systems, parameter configurations, a classical baseline, and noisy execution environments.

The main contributions of this paper are: (1) A formulation of Layered Architecture Recovery for quantum optimisation, transforming its QSAP representation into a QUBO with one-hot constraint penalties and subsequently into an Ising Hamiltonian suitable for QAOA, (2) A hybrid quantum-classical QAOA approach for LAR that combines parameterised quantum-circuit construction, COBYLA-based parameter optimisation, measurement, classical post-processing of sampled candidate solutions, and validation against the LAR assignment constraints, (3) An impact-guided decomposition of the LAR QUBO that bounds the width of each quantum circuit to an active set of packages, allowing instances that exceed the qubit budget of a single circuit to be recovered as a sequence of smaller sub-problems, (4) An empirical evaluation on three real-world Java systems investigating the sensitivity of QAOA to circuit depth and sampling budget (RQ1), its effectiveness and computational effort relative to a classical Tabu Search baseline (RQ2), its robustness under simulated quantum noise (RQ3), and the effect of impact-guided decomposition on recovery quality and feasibility (RQ4). (5) Empirical insights into the practical limitations of QAOA for software architecture recovery on resource-constrained quantum systems, including the roles of sampling, classical post-processing, problem size, decomposition, and noise.

This article is an extended version of our paper presented at the 7th International Workshop on Quantum Software Engineering (Q-SE 2026). It substantially extends the workshop version with : the full QSAP-to-QUBO-to-Ising formulation, the impact-guided decomposition and RQ4, the Tabu Search comparison, the noise study, and a complete re-evaluation on three systems.

The remainder of the paper is organised as follows. Section 2 introduces Layered Architecture Recovery, QAOA, and impact-guided decomposition. Section 3 presents the QSAP formulation of LAR and its transformation into QUBO and Ising representations. Section 4 describes the proposed QAOA-based recovery approach. Section 5 presents the experimental design and research questions, and Section 6 reports the results. Sections 7–9 discuss the findings, threats to validity, and related work. Finally, Section 10 concludes the paper and outlines directions for future work.

References (22)