Main

The term memristor (that is, a memory resistor) was introduced in the early 1970s in a seminal paper by L. Chua1. He hypothesized the existence of the memristor as the fourth fundamental passive circuit element—the other three being resistor, capacitor and inductor. The name ‘memory resistor’ reflects the main property of such a device, namely, the fact that its resistance depends on the history of its input; hence, this device retains a memory of the past states. Chua’s work remained mostly unnoticed until 2008, when Struckov2 famously reported finding the ‘missing memristor’. Later works have disputed this conceptual line by raising doubts on whether Chua’s memristor is even physical3 and questioning its status as a ‘fundamental’ element4. A wider framework is now commonly adopted, which also includes memcapacitors and meminductors, as it has been shown that all the memory elements can be actually derived from Kubo’s response theory5,6.

Notwithstanding the conceptual intricacies, Struckov’s study2 undeniably sparked enormous interest among experimentalists. In fact, it was quickly realized that memristors could potentially revolutionize electronics by allowing the storage of information without a power source and by enabling logic operations7, as well as being able to mimic the behaviour of neural synapses8,9. These observations opened up a whole field of applications in non-traditional computing, namely, physical neural networks and neuromorphic architectures10,11,12,13,14,15,16,17. Moreover, the formalism of memristive devices18 applies to a wide variety of physical systems and allows to extend these concepts well beyond the electronic domain.

In this work, we provide the first experimental demonstration of a quantum memristive device, which we simply refer to as a ‘quantum memristor’ for consistency with the previous literature19,20,21, even though it is clear that these are not ideal memristors. Our device is based on a laser-written integrated photonic circuit that is fully reconfigurable by means of integrated phase shifters, and is able to produce memristive dynamics on single-photon states through a scheme of measurement and classical feedback. Additionally, through numerical simulations, we show a possible application of our quantum memristor in the framework of quantum reservoir computing.

From classical to quantum memristors

We start by discussing the recent quantum memristor proposals19,20,21 and by analysing the issues in their definition and the challenges in their implementation.

In its most general formulation, a classical memristive device is defined by the following coupled equations:

$$y=f(s,u,t)\,u,$$
(1)
$$\dot{s}=g(s,u,t),$$
(2)

where u and y denote the input and output variables, respectively; and s denotes a state variable; all of them are implicitly assumed to depend on time t. What distinguishes this from a generic dynamical system is equation (1), where u multiplies the function f(). This implies that when the input u is zero, the output y is zero, too—except for particular cases where f() may go to infinity6; therefore, the input–output characteristic is typically a figure-of-eight hysteresis curve that always crosses the origin (Fig. 1e). In the case of the electronic memristor, u and y correspond to the current and voltage, and the zero-crossing property simply reflects the passive nature of a resistor (that is, zero current implies zero voltage).

Fig. 1: Comparison of classical and quantum memristors.
figure 1

a,b, Circuit symbol for a classical memristor (a) and quantum memristor (b). c, Struckov’s ‘memristor’2 based on a junction between doped semiconductor p and intrinsic semiconductor i. d, General concept of a quantum memristor: a device that acts on quantum states and whose state variable s(t) is coupled to the environment by a measurement process. The coupling must be engineered so that quantum coherence is sufficiently preserved from the input state \({\hat{\rho }}_{{{\mathrm{in}}}}\) to the output state \({\hat{\rho }}_{{{\mathrm{out}}}}\). e, Theoretical dynamics of the classical electronic memristor, showing the signature hysteresis loop pinched at the origin for a given frequency ω0. Approaching the high-frequency limit, for example, 10ω0, the curve approximates a line. f, In a quantum memristor, the expectation values of the quantum input observable \(\left\langle \hat{u}\right\rangle\) and output observable \(\left\langle \hat{y}\right\rangle\) obey the form of equations (1) and (2), thus yielding a hysteresis loop pinched at the origin that approximates a line at high frequencies.

At an intuitive level, we want a quantum memristor to show similar features, in addition to providing a genuinely quantum behaviour that may be employed for manipulating quantum information. Here we propose to define the quantum memristor as a device that provides the following features:

  1. 1.

    Memristive behaviour in the classical limit, that is, showing the dynamics of equations (1) and (2) when the expectation values of the quantum observables are considered.

  2. 2.

    Quantum coherent processing, that is, the ability to coherently map a quantum input state onto an output state.

This is an appropriate definition because it captures the inherent conceptual and technological challenge of the device. In fact, point (1) requires non-Markovian behaviour, which cannot be achieved by simply performing unitary operations on closed quantum systems, which, in turn, is precisely the type of processing that ensures quantum coherence, as required in point (2). In other words, achieving memristive behaviour requires the design of an open quantum system where the quantum device interacts with an environment (for example, through a measurement process). This, in practice, is always associated with some level of decoherence, but a device with no quantum coherence (for example, one that collapses all quantum superpositions) would be no different than a classical memristor, an issue that previous proposals touched upon but did not fully discuss19,20. The apparent contradiction can be overcome by engineering the interaction with the environment to be strong enough to provide memristivity but weak enough to sufficiently preserve quantum coherence.

In Fig. 1, we summarize and compare the main properties of classical and quantum memristors.

A photonic quantum memristor

The possibility of realizing a quantum memristor in the photonic domain was first pointed out in another study21, but the scheme suffered from conceptual and technical drawbacks that severely hindered practical implementations. Here we go beyond the original proposal by introducing a substantially improved scheme suitable for realization in integrated optics. A detailed comparison of our scheme with respect to the original one is provided in Supplementary Section I.

To illustrate the basic principle, let us consider the beamsplitter represented in Fig. 2a, whose reflectivity R(t) is tunable and dynamically controlled by an active feedback based on single-photon detection at the output mode D. When a quantum state with photon-number expectation value 〈nin(t)〉 is sent to input mode A at time t, the expectation value 〈nout(t)〉 at mode C is

$$\left\langle {n}_{{{\mathrm{out}}}}(t)\right\rangle =\left[1-R(t)\right]\left\langle {n}_{{{\mathrm{in}}}}(t)\right\rangle .$$
(3)

The temporal dynamics of the device is determined by the choice of feedback, that is, the update rule for R(t). Assuming that 〈nin(t)〉 takes values between zero and 〈nmax, we choose the following relation:

$$\dot{R}(t)=\left\langle {n}_{{{\mathrm{in}}}}(t)\right\rangle -0.5{\left\langle n\right\rangle }_{\max }.$$
(4)

Evidently, equations (3) and (4) satisfy the form required by equations (1) and (2) and therefore define a memristive device with R(t) as the state variable. In fact, Supplementary Section J shows that equation (3) has a close formal analogy with Struckov’s memristor2, which inspired the choice of equation (4). Note that these two equations apply to any input state, which may also be classical light, and thus, they do not define a quantum memristor per se.

Fig. 2: Photonic quantum memristor scheme.
figure 2

a, Basic concept: a tunable beamsplitter with active feedback. Mode A is used as the input port, whereas modes C and D are used as the output ports. Reflectivity R(t) is updated based on the measurement at mode D. b, Purity Tr(ρout2) of the output state ρout as a function of reflectivity R and input variable β2. The state is fully mixed only for β2 = 1, R = 0.5. c, Equivalent of a tunable beamsplitter in integrated optics: a Mach–Zehnder interferometer, whose reflectivity (that is, the probability of photons crossing from mode A to mode D) is set by a phase shifter (PS) in one of the arms producing a phase shift \(\theta\). d, Dual-rail equivalent of the scheme, where the input state is encoded as a single photon in a superposition of the two upper modes, one of which goes into the Mach–Zehnder interferometer, whereas the other goes directly to the output (Supplementary Section B provides a detailed explanation). e, Integrated photonics quantum memristor processor, realized by direct laser writing on a glass substrate (Supplementary Section C). The chip includes a state-preparation and state-tomography stage before and after the quantum memristor, respectively. Single-mode fibres are glued to the upper input mode and to the three output modes. The reflectivity of the quantum memristor is externally set by a microcontroller. All the phases are controlled by thermal phase shifters, that is, micro-heaters that locally heat up the substrate, thereby locally changing its refractive index and thus the effective optical path.

However, consider now an input state |ψin(t)〉 in the quantum superposition

$$\left|{\psi }_{{{\mathrm{in}}}}(t)\right\rangle =\alpha (t){\left|0\right\rangle }_{{{\mathrm{A}}}}+\beta (t){\left|1\right\rangle }_{{{\mathrm{A}}}},$$
(5)

where α(t)2 + β(t)2 = 1, and |0〉A and |1〉A represent the vacuum and single-photon state in mode A, respectively. In the single-photon case, 〈nin(t)〉 = β(t)2 and 〈nmax = 1. If the photon is detected in D, the output at mode C is just the vacuum state |0〉C. However, when the photon is not detected in D, then the output state |ψout,C(t)〉 at mode C is projected onto

$$\left|{\psi }_{{{\mathrm{out,C}}}}(t)\right\rangle =\frac{\alpha (t)}{\sqrt{N}}{\left|0\right\rangle }_{{{\mathrm{C}}}}+\frac{\beta (t)\sqrt{1-R(t)}}{\sqrt{N}}{\left|1\right\rangle }_{{{\mathrm{C}}}}\,,$$
(6)

(N is the normalization factor) which is still a quantum superposition, thus proving that this device provides a genuine quantum behaviour. Intuitively, assuming the user only has access to output C, the overall output state is given by the statistical mixture of both cases, weighted by their respective probability:

$$\begin{array}{l}{\rho }_{{{\mathrm{out,C}}}}(t)=| \beta (t){| }^{2}R(t)\,\left|0\right\rangle {\left\langle 0\right|}_{{{\mathrm{C}}}}+\\+\left[1-| \beta (t){| }^{2}R(t)\right]\,\left|{\psi }_{{{\mathrm{out,C}}}}\right\rangle \left\langle {\psi }_{{{\mathrm{out,C}}}}\right|\end{array}$$
(7)

(a formal derivation is provided in Supplementary Section A). The purity of this state can be calculated as

$${{{\rm{Tr}}}}({{\rho }_{{{\mathrm{out}}}}}^{2}(t))=1-2| \beta (t){| }^{4}R(t)(1-R(t)),$$
(8)

and is shown as a function of reflectivity R and input variable β2 (Fig. 2b). The fact that the state is not fully mixed (except for the case of β2 = 1, R = 0.5) shows that the device is capable of preserving some measure of quantum coherence, thus satisfying the requirements of a quantum memristor.

Implementation and results

The input state proposed in equation (5) encodes a qubit as a superposition of two energy levels. Despite offering an intuitive picture and a ready comparison across different quantum platforms, this type of encoding (also known as single-rail encoding) is highly impractical in linear optics22,23. A more natural approach in quantum photonics is path encoding (also known as a dual rail), where the qubit is represented by a single photon being present in either of the two spatial modes. In Supplementary Section B, we show how the single-rail protocol presented earlier has a straightforward dual-rail equivalent. Practically, one just needs to introduce an additional spatial mode that does not go through the beamsplitter. Figure 2c–e summarizes the steps from the basic concept to the final integrated photonic processor.

The photonic quantum memristor processor is realized by femtosecond-laser micromachining24,25. All the sections are fully configurable by means of thermal phase shifters26,27 featuring novel thermal isolation structures that strongly reduce the power consumption and thermal crosstalk28. Fabrication details are reported in Supplementary Section C.

The reflectivity of the on-chip quantum memristor stage is externally set by a microcontroller, which approximates the solution of equation (4) by performing a time-window integration of the form

$$R(t)=0.5+\frac{1}{T}\int\nolimits_{t-T}^{t}(\left\langle {n}_{{{\mathrm{in}}}}(\tau )\right\rangle -0.5)\,\mathrm{d}\tau ,$$
(9)

where T is the width of the integration window (Supplementary Section D provides the derivation). A challenge in implementing this operation is that the measurement of the expectation value 〈nin〉 itself requires some form of windowed integration of the input signal. Such a window needs to be large enough to collect meaningful photon statistics; since it is much smaller than T, on the time scale of the memristor, 〈nin〉 can be considered to be an instantaneous quantity. Our solution, along with a full description of the experimental setup, is detailed in Supplementary Section E, where we show that 〈nin〉 is estimated within a time window of approximately 100 ms, corresponding to a few hundred photon counts on average.

A stream of single photons is coupled via a single-mode fibre to the upper mode of the chip (Fig. 2e) and using the integrated state-preparation stage, the input number of photons to the memristor is varied in time as

$$\left\langle {n}_{{{\mathrm{in}}}}(t)\right\rangle =| {\beta }^{2}(t)| ={\sin }^{2}(\uppi /{T}_{{{\mathrm{osc}}}}\,t),$$
(10)

where Tosc is the oscillation period. The dynamics of the device is determined by the ratio T/Tosc. We refer to the high-frequency regime when the input oscillates many times within an integration window, that is, TTosc, and conversely to the low-frequency regime when TTosc.

An upper bound to fosc = 1/Tosc is given by the response of the thermal phase shifters of the chip, which can be modelled as low-pass filters with a cutoff frequency fcut 5 Hz. Notably, we observed that when fosc approaches this frequency range, it causes an additional memristive behaviour (Supplementary Section F). In Fig. 3, we instead report our results when keeping a constant fosc = 0.1 Hz (well below fcut) and varying the integration time T. The device shows a hysteresis figure pinched at the origin, which reduces to a linear relation at higher frequencies and to a nonlinear one at lower frequencies. This is precisely Chua’s definition of a memristive device18.

Fig. 3: Characterization of the photonic quantum memristor.
figure 3

Experimental results (blue lines) and simulated dynamics (red lines) for different frequency regimes. The oscillation period is kept constant at Tosc = 10 s, and the integration time T is varied in the range of one period. Since the high-frequency limit is, in this case, the same as T = Tosc, this provides a full characterization of the dynamic response of the device (Supplementary Section D). The experimental data are in perfect agreement with the simulated dynamics. Specifically, the low-frequency limit is 〈noutLF = 〈nin〉 – 〈nin2, whereas the high-frequency limit is 〈noutHF = 0.5〈nin〉. This is also in perfect agreement with the original definition of a memristive device18.

For further demonstrating the functionality of the quantum memristor, we have characterized the output state with respect to the input state and reflectivity R. As an example, for β2 = 0.3 and R = 0.7, we experimentally reconstruct the density matrix with a fidelity of F = 99.7% to the theoretical one. The purity of the state is measured to be Tr(ρout,EXP2) = 0.66, which matches the theoretical value of Tr(ρout,THEO2) = 0.67, showing that our quantum memristor does not substantially introduce additional decoherence. Supplementary Section G provides details of the reconstruction together with 16 output states with an average fidelity of F = 98.8%.

A memristor-based quantum reservoir computer

Neural networks are known to be very effective in computational tasks where a small amount of information (for example, whether an image represents a cat or a dog) needs to be extracted from high-dimensional data (for example, an image matrix of thousands of pixels). Typical neural approaches to these problems involve densely connected, multilayer structures like the schematic shown in Fig. 4a. Although proven to be extremely effective, training these networks requires an iterative optimization of thousands—sometimes, millions—of parameters, which, in turn, requires very large amounts of high-quality training data and computational time. This issue represents the main limiting factor for the scalability of these architectures.

Fig. 4: Quantum reservoir computing.
figure 4

a, Classical neural approach to a classification problem. The input information (for example, the pixels of an image) is fed to the first layer. The network can be trained to ‘switch on’ the neuron in the last layer corresponding to the correct class. b, Reservoir computing. The input information is mapped to a nonlinear, high-dimensional space, whose output is interpreted by a simple linear readout network. Only the readout network is trained, which requires minimal resources. c, A quantum reservoir computer based on quantum memristors. The input information is encoded on the quantum states of three photons in nine optical modes. A fixed matrix of beamsplitters with random reflectivity distributes the information across all the optical modes, which are fed to three quantum memristors, whose outputs are scrambled again before reaching the photon counters. The re-injection of photons is assumed if the measurement takes place at the feedback port of a memristor. The output pattern is interpreted by a trainable linear readout function.

Reservoir computing29,30 addresses this challenge by having the input data processed through a fixed nonlinear high-dimensional system (a reservoir). This reservoir maps the data such that the output only requires an elementary readout network for being interpreted, for example, a linear classifier (Fig. 4b). One key advantage of this approach is that only the readout network needs to be trained, which requires minimal resources in both time and data. Secondly, reservoirs can be implemented on physical systems rather than computer models, which promises even further speed-ups31. Classical physical reservoirs have been demonstrated on a variety of platforms, including classical memristors16,32 and classical optics33,34,35. Considerable interest has been recently devoted to quantum reservoirs36,37,38,39,40. Here we propose and numerically evaluate a quantum photonic reservoir based on quantum memristors.

Figure 4c shows a schematic of the working principle of a quantum reservoir computer. In this simulated example, the input information is encoded as the quantum states represented by three photons that can occupy nine different optical modes. A fixed matrix of beamsplitters with randomly assigned reflectivity scrambles the information across all the optical modes, which is then fed into the input ports of three quantum memristors. The outputs of the quantum memristors are scrambled again before reaching an array of photon counters. Note that the system is inherently resilient to photon losses, as the detectors always herald threefold events. In the end, this detected output signal is fed into the readout network. It has been shown40 that reservoir computing provides excellent performances when having access to (1) high dimensionality, (2) nonlinearity resources and (3) short-term memory. Here we propose a quantum reservoir that combines passive optical networks with our demonstrated quantum memristors. The photonic network gives access to a large Hilbert space that grows exponentially with the size of the quantum system. In contrast, the nonlinearity and short-term memory are provided by quantum memristors. This is a key difference with respect to the scheme shown elsewhere36, where the nonlinearity and memory arise from the dynamics of the ensemble of solid-state qubits.

Image classification by sequential data analysis

Reservoir computing is naturally suited for interpreting time-dependent data. Image classification, although usually regarded as a static task, can be reframed as a time-dependent task when considering images as pixels whose arrangement is defined by an ordered sequence of columns. Such an approach provides the advantage that the instantaneous input dimension is greatly reduced, as it only needs to encode one column at a time rather than the whole pixel matrix. A second, more practical advantage is that very high quality image databases are available. We consider here a subset of the MNIST handwritten digit database41 representing digits ‘0’, ‘3’ and ‘8’ (chosen for their column-wise similarity). Each image is cropped to 18 pixels × 12 pixels, and the columns are encoded one at a time into the quantum reservoir via a simple amplitude-encoding scheme (Supplementary Section H). At each step, the state of the quantum memristors is updated via a discrete-time equivalent of equation (9). The output corresponding to the last column is finally interpreted by the linear readout network, which is composed of approximately 1,600 tunable parameters. After training on 1,000 different images over 15 epochs, we achieve a classification accuracy of 95% on a never before seen test set of 1,000 images evenly split across the chosen digits.

Remarkably, our analysis shows that high accuracy was achieved on this three-digit classification task by only using an extremely small training set of just 1,000 images, using a very small physical reservoir containing only three quantum memristors and a very small readout network. Although comparing the performances of neural networks is challenging as they tend to be very case specific, reported classical schemes require more resources for similar tasks. The authors of another study32, who implemented a similar scheme, reported a simulated 91% accuracy on the ten-digit classification using 14,000 training images and a reservoir containing 88 classical memristors. In another study42, an accuracy of 92% was reached with three-layered reservoirs, 60,000 training images and approximately 500,000 tunable parameters. It, thus, seems plausible to conclude that our scheme is more resource efficient than these reported classical ones. Whether such efficiency reflects a genuine quantum advantage associated to the quantum reservoir remains to be discussed. Although numerical evidence has often been reported, a full proof of quantum advantage is still an active field of research.

Therefore, for obtaining insights into the quantum advantage of quantum memristors, we have compared the performance of our quantum reservoir computation with the one obtained when using only classical information as the input (Fig. 5a). This was achieved by encoding the input information with coherent classical light, rather than single photons, and by keeping all other conditions the same. The resulting accuracy for distinguishing the three digits dropped to approximately 71%, which indicates a superior performance of the quantum case. Also, when switching off the feedback loop of the quantum memristor (which eliminates both nonlinearity and memory from the reservoir), the performance drops to 34%, which is essentially random guessing for a three-label classification task.

Fig. 5: Performance of quantum reservoir computing using quantum memristors.
figure 5

Simulation of a quantum reservoir computer composed of three photons, nine modes, three quantum memristors and a final readout network. a, Classical task. For the image classification of three different digits, the simulations show the best accuracy when the input is encoded as the quantum state using single photons. Encoding with coherent light strongly degrades the performance, indicating superior performance when processing quantum data. Switching off the quantum memristors in the reservoir reduces the accuracy to essentially random guessing. b, Quantum task. For discrimination of the quantum input states—whether to be separable or maximally entangled, the same quantum reservoir computer allows to distinguish these states with high accuracy.

Entanglement detection

Naturally, a quantum reservoir is also suited for quantum tasks that are inaccessible with classical resources. For demonstrating this potential, we took the same quantum reservoir computer as the classical image classification. As an exemplary task for quantum applications, we analysed the capability of detecting quantum entanglement as a two-way discrimination problem between separable and maximally entangled quantum states. Here 100 copies of each state are sequentially fed to the quantum reservoir, and the state of the quantum memristors is updated based on the measurement statistics collected from this sequence. For this specific task, the nonlinearity rather than the memory of quantum memristors is exploited for increasing the complexity of the map performed by the quantum reservoir. By training on a set of just 1,000 randomly generated pure states, we obtain a discrimination accuracy of 98% (Fig. 5b), which indicates that the network has effectively learned to generate a relatively high-performing entanglement detection protocol with no user input.

Conclusions

We have designed an optical memristive element that allows the transmission of coherent quantum information as a superposition of single photons on spatial modes. We have realized the prototype of such a device on a glass-based, laser-written photonic processor and thereby provided what is, to the best of our knowledge, the first experimental demonstration of a quantum memristor. We have then designed a memristor-based quantum reservoir computer and tested it numerically on both classical and quantum tasks, achieving strong performance with very limited physical and computational resources and, most importantly, no architectural change from one to the other.

Our demonstrated quantum memristor is feasible in practice and readily scalable to larger architectures using integrated quantum photonics, with immediate feasibility in the noisy intermediate-scale quantum regime. The only hard limit for larger scalability—as with most quantum photonic applications—is the achievable single-photon rate. A foreseeable advancement would be the integration of optical and electronic components within the same chip (rather than using external electronics), which is conceivable using current semiconductor technology. Additionally, the frequency at which our quantum memristor operates can be easily improved. For laser-written circuits, high-frequency operations are readily available at the expense of higher-power consumption28, whereas other photonic platforms routinely enable frequencies even in the gigahertz regime43. For exploiting these frequencies, however, the photon detection rate must be improved as well. The vast development of quantum photonics technology shows that such performances are in reach by using customized fast detectors and bright single-photon sources using quantum dots44.

We emphasize that our results are not restricted to photonic quantum systems, and would be equally applicable to other platforms such as superconducting qubits19,20. On the other hand, our photonic implementation offers a particularly simple and robust approach that relies on a mature technological platform, and may even provide the missing nonlinear element for recently proposed quantum-optical neural networks45. Given the recent progress in photonic circuits for neuromorphic applications46, we envisage our device to play a key role in future photonic quantum neural networks.