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 x–z plane. The Pauli operators describe its control directions. Use ℏ=1 and gap frequency Ω=1: time is measured in Ω−1 and energy in ℏΩ. The reference Hamiltonian is

H0(t)=12[cosθ(t)σz+sinθ(t)σx],θ(t)=πtT.

During the duration T, the angle θ increases from zero to π. The energy levels stay at −1/2 and +1/2, 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

HCD=θ˙2σy=π2Tσy.

The dot denotes a time derivative. This y-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 H0. The added orange field, corresponding to HCD, rotates the state so it stays on the target. Both spheres use these same colors and the exact dynamics of the model above.

Two Bloch spheres compare the uncontrolled state, away from its target, with the counterdiabatically controlled state, which follows the target.
Spin dynamics with and without counterdiabatic control. Download video (MP4).
Video description
  1. The grey arrow shows the field of the reference Hamiltonian H0, 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.
  2. 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.
  3. The orange arrow shows the field of the added Hamiltonian HCD, perpendicular to the reference field's plane. This field rotates the blue state so it follows the target throughout.
  4. 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.
  5. 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 g(t) be the instantaneous reference ground state and ψ(t) the evolving state. Their fidelity is

F(t)=|⟨g(t)|ψ(t)⟩|2.

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 s=t/T, the solution is

Q=T2+(1−η)2π2,Fη(s)=1−(1−η)2π2Qsin2(sQ2).
Ground-state fidelity versus the fraction of the protocol elapsed. At duration T equals two, exact counterdiabatic control stays at one; half-strength control ends near 0.652 and no control near 0.347.
Analytic evolution at T = 2. The full counterdiabatic term preserves fidelity throughout the protocol; half-strength control leaves transitions. All three curves start in the same reference ground state.

At T=2, 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 10−11 and absolute tolerance 10−13. At durations 0.5, 2 and 10 and control fractions 0, 0.5 and 1, fidelity agreed with the formula to within 2×10−10 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:

‖ηHCD‖=cη=ηπ2T.
Control coefficient decreases as the inverse duration. The exact counterdiabatic coefficient is twice the half-strength coefficient at every duration.
Peak added-control coefficient for the same half-turn of the reference field. Units are ℏΩ for the coefficient and Ω⁻¹ for time. The amplitude grows as the duration decreases; the half-strength protocol uses less control but does not cancel transitions exactly.

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 Aλ generates the change of eigenvectors. In the same ℏ=1 convention, a useful representation is

HCD(t)=λ˙(t)Aλ,Aλ≈∑jaj(λ)Pj.

A fully connected network can take λ as input and output the coefficients aj. Hidden layers with smooth activations such as tanh 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 Pj 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

Gλ=∂λH0+i[Aλ,H0],S(Aλ)=Tr(Gλ2).

The brackets denote a commutator; the trace runs over the Hilbert space. For this operator-learning formulation, the training loop is:

  1. Sample fixed values of λ along the reference path. Reserve separate points for validation; no target gauge potentials are supplied.
  2. 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.
  3. 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.
  4. 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 Gλ. Even for an exact potential, Gλ generally does not vanish: energy levels can change along the path. Commuting components of Aλ 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 s as input and trainable parameters w, one possible output transformation is

λw(s)=s+s(1−s)Nw(s).

For finite network output, λ(0)=0 and λ(1)=1 hold exactly. Monotonicity, intermediate bounds and vanishing endpoint derivatives still need additional constraints. Automatic differentiation gives the derivative with respect to s; divide by T 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.

Flow chart of the joint PINN. Time samples enter one network, which predicts the schedule, complex gauge-potential matrix and real Pauli coefficients. Automatic differentiation supplies the schedule rate. Physical constraints define a loss; backpropagation and Adam update the shared weights. After training, an independent propagation checks the learned Hamiltonian.
Joint PINN workflow. The dashed arrow returns weight updates to the network; the blue branch evaluates the learned Hamiltonian after training. Endpoint, commutator, schedule-rate and matrix–Pauli terms supply the training signal. This joint formulation differs from the coefficient-only teaching example above.

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.