From prediction to control
In the first post, a neural network represented a temperature field. Here it represents the functions that control a quantum system: how fast a parameter changes and which additional interactions accompany that change. The network is classical; its outputs parameterize a quantum Hamiltonian.
Counterdiabatic driving gives those outputs a physical target. It adds a term that cancels transitions between the instantaneous eigenstates of a reference Hamiltonian, preserving adiabatic state following during faster evolution. Berry’s transitionless-driving work makes this construction precise.
A solvable spin model will establish what a good control must achieve. We will then turn that requirement into network outputs, a physics-based loss and a training procedure. The figures below show analytic calculations checked against numerical evolution.
A spin in a rotating field
Consider an isolated spin one-half in a field whose direction rotates in the – plane. The Pauli operators describe its control directions. Use and gap frequency : time is measured in and energy in . The reference Hamiltonian is
During the duration , the angle increases from zero to . The energy levels stay at and , while their eigenvectors rotate. Starting in the initial ground state, slow evolution follows the moving ground state; a faster turn can cause transitions. The target is to follow that state throughout the protocol, not merely recover it at the end.
Adding the counterdiabatic term
The exact additional Hamiltonian is
The dot denotes a time derivative. This -directed control cancels the rotation-induced coupling in the frame that moves with the field. Under the sum of the two Hamiltonians, an initial reference eigenstate follows its moving counterpart up to a phase.
It follows an eigenstate of the reference Hamiltonian; it need not be an instantaneous eigenstate of the total Hamiltonian. This distinction matters when defining the target for a learned controller.
The blue arrow represents the spin state; the hollow circle marks the moving ground-state target. Grey shows the reference field corresponding to . The added orange field, corresponding to , rotates the state so it stays on the target. Both spheres use these same colors and the exact dynamics of the model above.
Video description
- The grey arrow shows the field of the reference Hamiltonian , which makes a half-turn in the vertical plane. A hollow circle marks the ground-state target, opposite the field. The dashed line marks this target's path.
- The blue arrow represents the spin state. With no added control, it evolves from the initial ground state and departs from the target. For a duration of two time units, its final fidelity to the reference ground state is approximately 0.347.
- The orange arrow shows the field of the added Hamiltonian , perpendicular to the reference field's plane. This field rotates the blue state so it follows the target throughout.
- Both spheres show the state in blue: without an added field on the left and with counterdiabatic control on the right. They use the same initial state, reference path and duration. Beneath each sphere, its curve shows fidelity to the reference ground state. Under exact control it stays at one throughout the protocol. The target remains an eigenstate of the reference Hamiltonian, not necessarily of the total Hamiltonian.
- Halving the duration doubles the exact control amplitude. The bars show the coefficient of the added Hamiltonian. Real controls face amplitude, bandwidth and switching limits.
Compare the same physical task
Let be the instantaneous reference ground state and the evolving state. Their fidelity is
Compare no added control, half the exact control and the full term, keeping the reference path, initial state and duration fixed. With control fraction between zero and one and normalized time , the solution is
At , the final fidelities are approximately 0.347, 0.652 and 1, respectively. Coherent evolution can bring an imperfect protocol back towards the target: high final fidelity alone does not establish transitionless evolution, and the uncontrolled final fidelity need not improve monotonically with duration.
Direct DOP853 integration of the Schrödinger equation used relative tolerance and absolute tolerance . At durations 0.5, 2 and 10 and control fractions 0, 0.5 and 1, fidelity agreed with the formula to within on 201 equally spaced times; normalization met the same bound.
Faster evolution has a control cost
Exact cancellation requires additional control. Here its operator norm equals the magnitude of the Pauli coefficient:
Halving the duration doubles the required strength at fixed control fraction. The linear sweep also switches a nonzero control on and off abruptly. A laboratory pulse must respect amplitude and bandwidth limits and may need smooth endpoints.
For a PINN, these become constraints on the admissible outputs.
What the PINN learns
The spin model needs no learning: its control is known. Harder Hamiltonians motivate a trainable representation of the operator and the schedule. These are different functions, with different physical constraints.
Inputs, outputs and shared weights
For a reference Hamiltonian parameterized by , the adiabatic gauge potential generates the change of eigenvectors. In the same convention, a useful representation is
A fully connected network can take as input and output the coefficients . Hidden layers with smooth activations such as compose a continuous function; the same trainable weights determine its values along the whole path. This connects predictions at different inputs, rather than fitting an unrelated coefficient vector at each point.
Choose the Hermitian Pauli strings from the allowed controls. Real output coefficients then make the trial operator Hermitian by construction. The operator basis sets what is representable; network depth and width determine how flexibly its coefficients can vary. Neither choice guarantees successful optimization.
Physics supplies the training signal
The approach of Sels and Polkovnikov provides the variational principle. Define
The brackets denote a commutator; the trace runs over the Hilbert space. For this operator-learning formulation, the training loop is:
- Sample fixed values of along the reference path. Reserve separate points for validation; no target gauge potentials are supplied.
- Evaluate the network, assemble the trial operator and compute the action at each point using the known Hamiltonian and its parameter derivative. Average these values to obtain the loss.
- Backpropagate through the network and matrix operations to differentiate the loss with respect to the network weights. An optimizer such as Adam updates those weights; the Pauli operators stay fixed.
- Monitor the action and any added constraints on the validation points. Repeat with different initializations to assess reproducibility.
The physics therefore supplies the training signal without a database of optimal controls. Minimizing the action reduces the uncancelled off-diagonal part of . Even for an exact potential, generally does not vanish: energy levels can change along the path. Commuting components of also require a gauge convention if a unique representation is wanted.
Avoiding eigenstate labels does not remove the cost of operator algebra. Dense matrices and a complete Pauli basis grow exponentially with qubit count. Restricting the basis reduces the network outputs but does not by itself remove dense-matrix costs; it can also leave approximation error. Training on one Hamiltonian family does not establish transfer to a different problem.
Learning the schedule
A second network can set when each part of the path is traversed. With normalized time as input and trainable parameters , one possible output transformation is
For finite network output, and hold exactly. Monotonicity, intermediate bounds and vanishing endpoint derivatives still need additional constraints. Automatic differentiation gives the derivative with respect to ; divide by to obtain the physical time derivative that multiplies the gauge potential.
The action alone does not select the best timing. A schedule objective can combine state-transfer error with amplitude or smoothness costs. Balancing these terms matters: reducing one loss can worsen another. The constrained output above illustrates a design choice, not the specific architecture used in our paper.
The joint PINN in our research
Our 2024 paper on PINNs for counterdiabatic quantum computation uses a coupled formulation: time enters one fully connected PINN, which outputs the schedule, the real and imaginary parts of the gauge potential, and its Pauli coefficients. These quantities are learned together from physical constraints rather than reference control labels. The main example is a two-qubit representation of molecular hydrogen.
The loss combines endpoint conditions, the commutator condition associated with the variational action, a schedule-rate penalty, and agreement between the matrix and Pauli representations. Matching a real-coefficient Pauli expansion encourages Hermiticity. This differs from directly minimizing the action over coefficients in the teaching recipe above. The implementation guide documents the terms and their weights.
The public code repository supplies code, trained models and Jupyter tutorials. It connects the method to reproducible calculations; the rotating-spin plots in this post remain a separate analytic example.
Reference: A. Ferrer-Sánchez et al., Physics-informed neural networks for an optimal counterdiabatic quantum computation, Machine Learning: Science and Technology 5, 025035 (2024).
Checks before trusting a learned control
A falling training loss is only the first check. Propagate the learned Hamiltonian with an independent dynamical solver at times absent from training. Tighten its tolerances; inspect normalization, fidelity throughout the path, control strength and endpoint behaviour. If a network also represents the state, check its Schrödinger residual and initial condition separately.
Compare with direct variational coefficient optimization or a simple schedule parameterization, as well as uncontrolled evolution. Keep the physical task and allowed controls fixed, and count training and validation costs. This establishes what the neural representation contributes beyond a good control ansatz. Hardware claims additionally require the device’s control restrictions and noise model.