## Main

Realizations of quantum computing have built on rapid progress in controlling physical systems that can support quantum information; for example, superconducting circuits^{1,2}, trapped ions^{3,4}, neutral atoms^{5} and light^{6,7}. These technological breakthroughs have brought four platforms to the regime of quantum computational advantage^{1,2,8,9,10} by solving specific sampling problems that would require unreasonable computing time even for the most powerful classical supercomputers. Two of these four are photonic, which highlights the position of light-based technology among the leading platforms. Quantum light as a quantum information carrier offers the advantage of low decoherence and comes with a many degrees of freedom with which to encode the information, while providing natural connectivity for distributed or blind quantum computing^{11}.

Over the years, a variety of proposals that take the discrete-variable photonic approach to universal fault-tolerant computing have been put forward, in which quantum information is encoded with single photons^{12,13,14,15}. With identified thresholds, these roadmaps motivate the development of quantum computing hardware based on single-photon sources, integrated photonic chips and single-photon detectors. Experimental progress of ever-increasing complexity has been achieved with integrated sources exploiting nonlinear effects, including with large-scale integrated chips^{16,17}. However, the probabilistic nature of the single-photon generation process, the need for it to be heralded and the requirement for it to operate at low efficiency to limit multiphoton events are strong constraints on hardware architectures. This has resulted in a limited number of manipulated photons with typical rates in the megahertz range for four photons, and the demonstration of specific information processing tasks that rely on dedicated photonic chips^{17}. Overcoming these limitations is foreseen through the use of massive multiplexing of hundreds of heralded sources^{18}.

Another path to large-scale quantum computing with single photons has emerged, owing to deterministic single-photon source devices based on semiconductor quantum dots^{19,20,21}. Such sources have demonstrated record single-photon generation efficiency that is 10–20 times higher than their nonlinear counterparts, allowing for a drastic reduction in resource requirements. Such efficiencies allowed a record manipulation of 14 single photons in a free-space boson sampling experiment^{22}. Very recently, the same quantum dot sources have shown their ability to deterministically generate photonic cluster states at high rates^{23}, even further reducing the foreseen overheads for large-scale measurement-based quantum computation^{24}.

In this work we report a multipurpose cloud-accessible^{25} single-photon-based quantum computing machine, named Ascella, which is based on six photonic qubits generated by an on-demand quantum dot source. The quantum information is encoded in the path degree of freedom and arbitrarily manipulated in a 12-mode integrated universal interferometer. A machine-learned transpilation process corrects for the hardware manufacturing errors. Ascella operates the largest number of single photons on a chip so far with a six-photon sampling rate of 4 Hz, and shows operation stability over weeks. We benchmark its performances and demonstrate applications both in the gate-based and photonic computation frameworks. Each reported result represents either state-of-the-art performance or a novel experimental demonstration for which we provide the full code to reproduce through Quandela Cloud^{25}. The numerous applications illustrate the general-purpose potential of the machine for noisy near-term quantum computing. We finally discuss the evolution of the reported platform towards scale-up, and demonstrate a critical step for future measurement-based quantum computation: heralded entanglement generation of three-photon Greenberger–Horne–Zeilinger (GHZ) states.

## Results

### Single-photon based computer

Ascella’s hardware (Fig. 1a) comprises an on-demand high-brightness single-photon source; a programmable optical demultiplexer, which allows up to six single photons to simultaneously interfere with a 12-mode reconfigurable universal interferometer; and a single-photon detection and post-processing unit.

The on-demand single-photon source (see Supplementary Section 1), which is based on an InGaAs quantum dot in a microcavity^{19}, is optically excited at an 80 MHz rate. It exploits a neutral dot and longitudinal-acoustic-phonon-assisted near-resonant excitation^{26} to emit linearly polarized single photons with 55% probability into the collection lens. To send six single photons to every even input mode of the chip, an active optical demultiplexer sequentially deflects the photon stream into six optical fibres of different lengths adjusted to synchronize the photons^{27}. Using optical shutters, the demultiplexer can prepare any input state from \(\left\vert 000000000000\right\rangle\) to \(\left\vert 101010101010\right\rangle\) (photon positions can subsequently be swapped; see Supplementary Section 2). The 12-mode photonic integrated circuit (Si_{3}N_{4} platform) is composed of 126 voltage-controlled thermo-optic phase shifters and 132 directional couplers^{28} that are laid out in a rectangular universal interferometer scheme (see Fig. 1a), allowing for the implementation of all 12 × 12 unitary matrices with an average fidelity of *F* = 99.7 ± 0.08% thanks to a custom compilation and transpilation process (see Methods). Finally, the 12 outputs of the circuit are connected to high-efficiency superconducting nanowire single-photon detectors, and *N*-photon detection events are registered using a time-to-digital converter.

The average total efficiency of the optical set-up is ∼8%, which includes the single-photon source device brightness, the transmission of all optical components, and the detection efficiencies (see Supplementary Section 2). This leads to record-breaking two- to four-photon on-chip coincidence rates (Fig. 1b), and on-chip processing of five and six photons, at rates of 50 Hz and 4 Hz, respectively. We measure high single-photon purity of >99% and high indistinguishability of ∼94%; these values are independent of the delays between photon emission (up to 1 μs), resulting in a measured on-chip two-photon interference visibility for all 15 pairs of 91−94% (see Supplementary Section 3). The genuine four- and six-photon indistinguishability—defined as the probability that the *N* photons are identical—establishes a new record value of 0.85 ± 0.02 for four photons^{29}, and a value of 0.76 ± 0.02 for six photons. We ensure long-term stability and high-performance operation of Ascella by monitoring key metrics and by performing automated system optimization runs hourly. This guarantees a highly stable and long-term operation over several weeks (see Fig. 1b), and robustness against external temperature fluctuations and mechanical perturbations.

To operate the machine, tasks are sent remotely using the Python-based open-source framework Perceval^{30}. The user can either specify (see Fig. 1c) a photonic circuit, a gate-based circuit, or a unitary transformation (*U*) to be applied to a specified input state containing one to six photons, as well as optional post-selection criteria. Output photon coincidences are then acquired up to the desired sample number, and data sample results are sent back to the user, either as a stream of events or as an aggregated state:count inventory.

### Gate-based quantum computation

Following the Knill–Laflamme–Milburn scheme^{31}, Ascella can perform probabilistic gate-based protocols. Within this quantum computation framework, we benchmark quantum logic gates on up to three qubits and implement a hybrid variational quantum eigensolver (VQE).

#### Benchmarking logic gates

Ideally, a gate *U* applied to an initial pure state \(\left\vert \psi \right\rangle\) will produce the pure state \(U\left\vert \psi \right\rangle\). In reality, errors, which are quantified by a noise channel *Λ* (ref. ^{32}), corrupt the final state, which is then described by a density matrix \(\rho ={{\Lambda }}(U\left\vert \psi \right\rangle \,\left\langle \psi \right\vert {U}^{\;{\dagger} })\). A standard figure of merit to quantify the gate performance is the quantum state fidelity \({F}_{\psi }(U)=\left\langle \psi | {U}^{\;{\dagger} }\rho U| \psi \right\rangle\) of the final state *ρ* to the ideal state \(U\left\vert \psi \right\rangle\). To assess Ascella’s performance for a given gate, we evaluate the fidelity of the gate averaged over all possible input states \(\left\vert \psi \right\rangle\), that is, *F*_{avg}(*U*) = ∫*F*_{ψ}(*U*)*d**ψ*, where the integral is taken over the Haar measure.

A brute-force approach to estimating *F*_{avg}(*U*) requires an impractically large number of measurements. A more efficient method, randomized benchmarking, has been proposed for matter qubits^{33}, but applies long sequences of gates from specific sets of unitaries^{34}. As photonic quantum processing converts any quantum circuit to a photonic circuit^{35}, we use a new method to evaluate *F*_{avg} (R.M. & S.C.W., manuscript in preparation). Our method exploits symmetries so that the contribution of most *F*_{ψ}s to *F*_{avg} cancel out, allowing *F*_{avg} to be expressed as a finite discrete sum \({F}_{{{{\rm{avg}}}}}=\mathop{\sum }\nolimits_{i = 1}^{K}{w}_{i}{m}_{i}\) of *K* expectation values *m*_{i} with weight *w*_{i} (see Supplementary Section 5). The *w*_{i} and the state preparation and measurement configurations for each *m*_{i} depend on the gate *U* and are pre-computed. Each configuration consists in preparing an unentangled initial state \(\left\vert \psi \right\rangle\), applying the gate and performing single-qubit Pauli measurements. For the gates benchmarked on Ascella (see Table 1), the *K* expectation values *m*_{i} are obtained from *M* ≤ *K* measurement configurations, with *K* less than the ∼2^{4n} measurements required for full process tomography^{36} of an *n*-qubit gate.

The average gate fidelities measured for the *T* (defined as \(T:=\left\vert 0\right\rangle \left\langle 0\right\vert +{e}^{i\frac{\pi }{4}}\left\vert 1\right\rangle \left\langle 1\right\vert\)), CNOT and Toffoli gates are shown in Table 1. To the best of our knowledge, these are record fidelities for the two-photon CNOT^{37,38} and three-photon Toffoli^{39} gates. This group of measurements sets a benchmark for universal photonic quantum computing, and is on par with the benchmarked performance of open-access quantum computing platforms based on ions and superconducting qubits (see Supplementary Section 5). These values are a lower bound on the true average gate fidelities, as they also include errors related to state preparation and measurement roughly given by (1 − *F*_{avg}(*T*-gate)^{2n/3}), which is 0.3 ± 0.1%, 0.5 ± 0.1% and 0.8 ± 0.2% for the *T*, CNOT and Toffoli gates, respectively.

#### Variational quantum eigensolver

We illustrate gate-based computation possibilities by implementing a VQE algorithm to compute the ground-state energies of an H_{2} molecule; VQE exploits the variational principle stating that, given a Hamiltonian \(\hat{{{{\mathcal{H}}}}}\) and an ansatz wavefunction \(\left\vert \psi (\overrightarrow{\theta })\right\rangle\) parameterized by \(\overrightarrow{\theta }\), the ground-state energy associated with \(\hat{{{{\mathcal{H}}}}}\) satisfies \({E}_{0}\le \left\langle \psi (\overrightarrow{\theta })\right\vert \hat{{{{\mathcal{H}}}}}\left\vert \psi (\overrightarrow{\theta })\right\rangle\) (ref. ^{40}). In this context, VQE explores the state space by minimizing the energy to find a chemically accurate approximation of *E*_{0}. Reaching chemical accuracy (defined as obtaining a result within ±0.0016 Ha of the theoretical value) is critical for making realistic chemical predictions.

We build the fermionic Hamiltonian for H_{2} using the symmetry-conserving Bravyi–Kitaev transformation^{41}, which is available via the OpenFermion^{42} Python package (see Methods). Symmetry allows reduction of the problem to the effective Hamiltonian \({\hat{{{{\mathcal{H}}}}}}_{{{{\rm{qubit}}}}}\), which acts on two qubits expressed in the standard Pauli basis (??, *X*, *Y* and *Z*),

with real parameters *α*, *β*, *γ*, *δ* and *μ*, which depend on the choice of bond length *r*. We create ansatz states \(\left\vert \psi (\overrightarrow{\theta })\right\rangle\) made of two path-encoded qubits using single-qubit operations \(R({\overrightarrow{\theta }}_{i})\) and an entangling post-selected controlled NOT (CNOT) gate (see Fig. 2a). To make a chemically accurate prediction of *E*_{0}, we first find the optimal bond length (*r*^{opt}), which is the one that corresponds to the lowest energy by varying *r* between 0.2 and 2.05 Å.

The expectation value of \({\hat{{{{\mathcal{H}}}}}}_{{{{\rm{qubit}}}}}(r)\) on \(\left\vert \psi (\overrightarrow{\theta })\right\rangle\) is obtained from the weighted averages of 10,000 post-processed two-photon samples, giving an accuracy of ±0.01 Ha. The classical processor then evaluates a loss function by using a gradient-free optimizer based on expectation values obtained from Ascella, and corrected using an error-mitigation scheme inspired by ref. ^{43}. Then \(\overrightarrow{\theta }\) is updated classically in a feedback loop between Ascella and a classical processor to reach lower and lower energies. We then make an additional experimental run at *r*^{opt} with 400,000 post-processed two-photon samples to obtain an accuracy of ±0.00158 Ha on the ground-state energy associated with \({\hat{{{{\mathcal{H}}}}}}_{{{{\rm{qubit}}}}}({r}^{{{\;{\rm{opt}}}}})\). We compare this value with *E*_{0} to confirm that we have reached chemical accuracy. In the two steps highlighted above, we use error mitigation to compute the minimal energies of \({\hat{{{{\mathcal{H}}}}}}_{{{{\rm{qubit}}}}}(r)\) (see Supplementary Section 8). For any initial random parameters and bond lengths, the algorithm consistently converges to the theoretical eigenvalues in 50 to 100 iterations (see Fig. 2a). The entire experiment time per bond length is approximately four times faster than past photonic VQE experiments of a system with the same number of degrees of freedom^{40}. At fixed initial conditions and *r*^{opt}, chemical accuracy was achieved with a success probability of 93%, with greater accuracy than recent photonic VQE experiments^{43}. These two improvements are due to higher-quality single-photon sources and chip control. Note that the accuracy is on par with VQE experiments on superconducting qubits^{44,45} and ions traps^{46,47}, and is reached by using a photonic platform.

### Photon-native quantum computation

We now demonstrate the operation of Ascella in its native photonic framework, where the information is directly processed through photonic quantum interferences in chosen unitary transformations and detection.

#### Photon-based quantum neural network

We train a quantum neural network^{48} on Ascella for a supervised learning classification task. We build a VQE algorithm where, taking inspiration from ref. ^{49}, we use a native photonic ansatz. We perform multiclass classification on the well-known IRIS dataset^{50}. To the best of our knowledge, this is the first experimental implementation of a variational quantum classifier with single photons; we refer to ref. ^{51} for a realization on a superconducting platform and to ref. ^{52} for a two-photon classifier based on kernel methods. Following our photon-native approach, we design the ansatz of the variational algorithm directly using the beamsplitters and phase shifters on five modes of Ascella, in which we input three photons. We also implement partial pseudo photon-number resolution by exploiting four extra modes of the chip.

We train the model using a see-saw optimization between the chip parameters and the output state parameters that define the measurement observable. Each iteration requires 112 experiments, one for each data point in the training set, and we gather 50,000 samples per run. A batch functionality in Perceval^{30} allows us to send all data points as one job to the server. Details on the ansatz and the training can be found in Methods and Supplementary Section 7. After about 15 iterations, we find an accuracy of 0.92 and 0.95 on the training and test sets, respectively. Figure 2b provides a summary of the model predictions versus actual labels as a confusion matrix.

#### Boson sampling with six single photons

Boson sampling is a sampling problem suited for demonstrating a quantum-over-classical advantage with optical quantum computing platforms^{53}. The recent demonstrations of quantum advantage^{6,10} in the Gaussian boson sampling framework used squeezed light manipulated in free-space interferometers to limit optical losses. Genuine single-photon-based Boson sampling has progressed poorly on integrated chips due to the low efficiency of heralded sources^{54,55,56,57}. Here we demonstrate on-chip boson sampling for a record number of six photons with a fully reconfigurable interferometer. A 12 × 12 Haar-random unitary matrix is randomly chosen using the dedicated tool in Perceval. We record the threshold statistics of all *N*-photon coincidences (*N* ∈ [[1; 6]]) and acquire in total 340.10^{9} samples, with a six-photon coincidence rate reduced by the strong bunching of photons in this sampling task down to 0.16 Hz.

To validate our experimental results, we discriminate our collected boson sampling statistics from the uniform^{58} and distinguishable^{59} sampler hypotheses. We also reconstruct the six-photon output distribution from the sampled data and compare it with the ideal output distribution corresponding to the chosen unitary matrix. Both distributions are plotted in Fig. 2c, from which we deduce a fidelity \(F={\sum }_{i}\sqrt{{p}_{i}{q}_{i}}\) and a total variation distance (TVD) \(D=\frac{1}{2}{\sum }_{i}| {p}_{i}-{q}_{i}|\), where {*p*_{i}} and {*q*_{i}} are the ideal and experimental output probability distributions, respectively, with *i* ∈ {1, … , 924} labelling the no-collision output configuration of the boson-sampling device^{53}. We measure state-of-the-art values *F* = (0.97 ± 0.03) and *D* = (0.16 ± 0.02)^{22,60}. Details on the measurement simulation with Perceval as well as boson sampling with *k* photons lost (*k* ∈ [[1; 4]]) are given in Supplementary Section 6. Our experiment marks a demonstration of boson sampling with six single photons on an integrated photonic circuit (see Supplementary Table 4). In contrast with previous experimental demonstrations, our fully reconfigurable chip admits to sampling from any target unitary matrix, a critical feature for proving a quantum-over-classical advantage in boson sampling.

## Discussion

### Near-term improvements

The above results demonstrate the suitability of the architecture for near-term quantum computing tasks. In the short-term, the record 4 Hz rate for six photons demonstrated here can be further pushed to 12 photons by optimizing each hardware component (see Supplementary Table 1). These optimizations could be pushed even further in the mid-term; for instance, the current single-photon source efficiency of 55% at the first lens can be brought to 96% (ref. ^{61}). The number of modes in the photonic chip can be increased while reducing photon transmission loss^{16,17,57}. Finally, it is anticipated that heterogeneous integration of the different components (source, chip, detectors) will drastically reduce interconnection losses. For the high indistinguishability, our single-photon source technology has demonstrated ≥99.5% indistinguishability^{19}, which would bring the two-qubit gate fidelities close to unity^{62}. Altogether, these technological improvements will allow high-fidelity linear-optical computing protocols to be performed with dozens of photons.

### Scaling

Beyond noisy intermediate-scale tasks, the current platform constitutes a step towards large-scale fault-tolerant quantum computing. By experimentally implementing quantum algorithms and protocols on such a platform, we have demonstrated key ingredients to scale up, specifically, high-fidelity multiphoton interference and entanglement generation on an integrated platform, which, moreover, is robust for continuous operation^{63}. The next steps in reducing the overhead of probabilistic linear-optical protocols will involve shifting to a measurement-based paradigm that relies ultimately on the generation of large graph states^{12}. Heralded three-photon GHZ states are a sufficient resource to build larger entangled states through type-II fusion^{13,15,64}. This is the last demonstration we report on Ascella.

We use a scheme adapted from ref. ^{13,65} where three out of the six single photons are consumed to herald the generation of the three-photon state \(\left\vert {{{{\rm{GHZ}}}}}_{3}^{+}\right\rangle =(\left\vert 000\right\rangle +\left\vert 111\right\rangle )/\sqrt{2}\).

Using the stabilizer operators of \(\left\vert {{{{\rm{GHZ}}}}}_{3}^{+}\right\rangle\), we experimentally measure a fidelity of \({F}_{{{{{\rm{GHZ}}}}}_{3}^{+}}=0.82\pm 0.04\) (see Fig. 3 and Methods) providing a reference value and benchmark of heralded GHZ state generation.

Finally, our recent demonstration of efficient generation of linear cluster states directly from the same quantum dot source technology^{23}—combined with ingredients demonstrated by this platform—could lead to additional reductions in hardware resource overheads required for fault-tolerance^{66}.