Quantum Dynamic Programming in Qibo

How to use quantum computers programmed by quantum information?

Can quantum states program a quantum computer?

Can quantum information be the source code?

What would it be good for?

Kay Giang - NTU Singapore

J. Son et al, arxiv:2403.09187

Introduction to
Dynamic Quantum Algorithm

What is a dynamic quantum algorithm?

Dynamic Quantum Algorithm

  1. Consider a data qubit \(\sigma\) and an instruction qubit \(\rho\)
  2. Make an infinitesimal rotation by applying partial SWAP (\(\delta\)SWAP) gate, realized by Heisenberg interaction





     
  3. Discard the instruction qubits and prepare a fresh copy of \(\rho\)

Toy model example: Density Matrix Eponentiation

Goal: Approximate the unitary \(e^{it\rho}\)

\sigma
\rho
XX + YY + ZZ
\rho
XX + YY + ZZ

Kjaergaard et al., arxiv:2001.08838

Dynamic Quantum Algorithm

4. Repeat the partial SWAP and fresh preparation

\sigma \to e^{idtM\rho}\sigma e^{-idtM\rho} + O(M^{-1})

5. If the infinitesimal rotation duration is \(dt\) then after \(M\) steps we will have

6. The circuit will be exactly the same even if we use different qubit states

\sigma
\rho
XX + YY + ZZ
\rho
XX + YY + ZZ

Kjaergaard et al., arxiv:2001.08838

Density Matrix Exponentiation

  • Density matrix \(\rho\) is Hermitian \(\to\) can use as operator
  • In summary:
    • DME implements an infinitesimal rotation about an axis defined by instruction qubit 𝜌 on data qubit 𝜎 (where \(\delta = \theta/N\)):\[\sigma\to e^{-i\rho\delta}\sigma e^{i\rho\delta}\]
    • After Trotterization, DME implements: \(U = e^{-i\rho\theta}\)
  • Again, this is dynamic because \(\rho\) is only determined at runtime

Dynamic Quantum Algorithm

  • Quantum algorithms that are dynamic: their operation is revealed on runtime.
  • Question 1: How to use quantum computers programmed by quantum information?
  • Answer: Using dynamic quantum algorithm, which:
    • Take an unknown density matrix
    • Design a circuit that will meaningfully use this quantum information as an instruction

Dynamic Quantum Algorithm

  • Question 2: Can quantum information be the source code?
  • Answer: Kimmel et al. (arxiv 1608.00281) shows that this model is basis of a universal model for quantum computation
  • Questions 3: What would QDP be good for?
  • Answer: 
    • Example usage: QDP provide a universal circuit that compute the Schmidt spectrum
    • QDP also gives more useful examples

Static vs Dynamic

  • Usual quantum computing is static: To change operation, we have to change the circuit
  • Dynamic quantum computing: To change operation, only need to change instruction qubit

Normal way we do quantum computing: Static

Dynamic Quantum Computing

Kjaergaard et al., arxiv:2001.08838

Existing literature

Kjaergaard et al., arxiv:2001.08838

Motivation for

Quantum Dynamic Programming

What is Quantum Dynamic Programming (QDP) good for?

What is a quantum recursion

  • Definition:
     
  • The recursive state is instructing the propagation
  • Dynamic: The unitary is different for different states
  • Problems:
    • What is a meaningful \(U(\psi)\)?
    • To calculate \(\ket {\psi_2}\) will we need to recalculate \(\ket {\psi_1}\) and calculate \(U(\psi_1)\)?
    • For higher order terms, do we need to recalculate all lower terms?
  • Solution: QDP shows how to do it in a quantum coherent way.
\ket{\psi_1} = U(\psi_0) \ket {\psi_0}\\
U(\psi_0) \neq U(\psi_1)\\ \text{if } \psi_0 \neq \psi_1
\ket{\psi_2} = U(\psi_1) \ket{\psi_1}\\

Quantum recursion examples

  • Examples of meaningful unitaries for quantum recursions:
    • Grover rotation:
                             
      G(ψ1)=U0†G(ψ0)U0=id−2∣ψ1⟩⟨ψ1∣G^{(\psi_1)} = U_0^\dagger G^{(\psi_0)}U_0=\mathbb{id} - 2\ket{\psi_1}\bra{\psi_1}
    • Grover search: Add static unitaries Q and R that don’t depend on the state:
                   
    • Density Matrix Exponentiation: Give rise to dynamic Grover rotation implementation:

\(G=id - 2\ket\psi\bra\psi\)

\(U^{(\psi)} = QG^{(\psi)}R\) with \(Q,R\in U(D)\)

G = e^{i\psi s}

Quantum recursion examples

  • Reduced group commutator:
    \[e^{isD}e^{it\rho}e^{-isD}\]
  • We can use this to diagonalize
    eisDeitρe−isDe^{isD}e^{it\rho}e^{-isD}

Marek DBI paper, arxiv:2206.11772

QDP paper, arxiv:2403.09187

Unfolding quantum recursions

Consider Grover reflector: \(G=id - 2\ket\psi\bra\psi\) 

\(Q,R \in U(D)\), initial state \(\ket{\psi_0}\), \(\ket{\psi_{k+1}} = QG^{(\psi_k)}R\ket{\psi_k}\)

\begin{align*} G^{(\psi_1)} &=\mathbb{1} - 2\ket{\psi_1}\bra{\psi_1}\\ &=\mathbb{1} - 2U(\psi_0) \ket{\psi_0}\bra{\psi_0}U(\psi_0)^\dagger\\ &=U(\psi_0)(\mathbb{1}-2\ket{\psi_0}\bra{\psi_0})U(\psi_0)^\dagger\\ &= U(\psi_0) G^{(\psi_0)}U(\psi_0)^\dagger \end{align*}
\begin{align*} U(\psi_0) &= QG^{(\psi_0)}R\\ \ket{\psi_1} &= QG^{(\psi_0)}R\ket{\psi_0} \end{align*}

However, it's more complicated to get \(\ket{\psi_2}\). To do this, we need to get \(U(\psi_1)\). Ordinary idea:

Reflection of \(\psi_1\) is the rotated reflection of \(\psi_0\)

To get \(\ket{\psi_1}\) is simple:

\begin{align*} \ket{\psi_2} &= QG^{(\psi_1)}R\ket{\psi_1}\\ &={Q(QG^{(\psi_0)}R)G^{(\psi_0)}(QG^{(\psi_0)}R)^\dagger R QG^{(\psi_0)}R\ket{\psi_0}} \end{align*}

Motivation for QDP

  • Unfolding the recursion make the depth grow exponentially
  • Using placeholder memory is not straightforward with quantum computing
  • Notice that the unitary \(U(\psi)\) depends on \(\ket\psi\). Can we use the state to steer the evolution?
  • Quantum Dynamic Programming (QDP), a framework that uses copies of the recursive state to implement the recursion step unitary
  • This is dynamic because the instruction state is revealed only on runtime
  • QDP yields exponential reduction in circuit depth than when unfolding

Quantum Dynamic Programming

J. Son et al, arxiv:2403.09187

Quantum Dynamic Programming

  • QDP speed up recursion of the form (single memory call):
    \[ U^{(\mathcal{N},\rho)} =  V_2e^{i\mathcal{N}(\rho)}V_1\] where \(\mathcal{N}\) is any Hermitian-preserving map
  • Memory call: Idealized transformation we want to make. It asks for memory (instruction state \(\rho\)).
  • General case:

     
  • Problem: We can't implement this naturally in qunatum mechanics

Quantum Dynamic Programming

  • Solution: QDP approximate this memory call unitary:

     
  • QDP does this by using memory usage query:


    where \(N\) is the operator of the memory usage query, the partial transpose of the Choi matrix corresponding to \(\mathcal{N}\)
    • Consume (trace out) an instruction state
  • Repeat this procedure M times, we obtain
\mathcal{E}_s^{(N,\rho)}(\sigma) = Tr_\rho [e^{-iNs} (\rho\otimes\sigma) e^{iNs}]
E^{(\mathcal{N},\rho)}(\sigma) = e^{i\mathcal{N}(\rho)} \sigma e^{-i\mathcal{N}(\rho)}
\mathcal{E}^{(\mathcal{N},\rho,M)}_{QDP} \coloneqq (\mathcal{E}^{(\mathcal{N},\rho)}_{1/M})^M = E^{(\mathcal{N},\rho)} + O(1/M)

Quantum Dynamic Programming

Example: Density Matrix Exponentiation

  • Memory call unitary:                                                            
    \[E^{(\mathcal{N},\rho)}(\sigma) = e^{i\rho\theta} \sigma e^{-i\rho\theta}\]
  • Memory call operator: \[\mathcal{N}\rho = \rho \to \mathcal{N} = id\]
  • Memory usage query operator: \[N = \delta SWAP\]
  • Memory usage query: \[\sigma\to\text{Tr}_\rho[e^{-i\text{SWAP}\delta}(\sigma\otimes\rho) e^{i\text{SWAP}\delta}]\]

Quantum Dynamic Programming

Example: Double bracket iteration

  • Double bracket iteration step with instruction operator \(H\):
     
  • Memory call operator: \(\mathcal{N} =-is[D,\rho]\)
  • Memory usage query:

     
  • Memory usage query operator:
\rho_{n+1} = e^{s_n[D,\rho_n]}\rho_ne^{-s_n[D,\rho_n]}
\mathcal{E}_s^{(N,\rho)}(\sigma) = Tr_\rho [e^{-iNs} (\rho\otimes\sigma) e^{iNs}]

Quantum Dynamic Programming

Example: Oblivious Schmidt decomposition

  • Bipartite pure state \(|\psi\rangle\) has a Schmidt decomposition: 
|\psi\rangle_{AB} = \sum_j \sqrt{\lambda_j} |\phi_j\rangle_A|\chi_j\rangle_B
  • Double bracket iteration of OSD: 
e^{i\mathcal{N}(\psi_n)} = e^{s_n[D,\rho_n^(A)]}\otimes \mathbb{I}_B
  • Memory usage query:
  • Memory usage query operator:

Density Matrix Exponentiation (DME) in Qibo

How does DME model work in Qibo?

 

 

Kjaergaard et al., arxiv 2001.08838

Memory usage query in DME

  • Goal: DME approximate the rotation (the memory call):
    \[U = e^{-i\rho\theta}\]
  • DME replace the infinitesimal angle memory call unitary (where \(\delta = \theta/N\)): \[\sigma\to e^{-i\rho\delta}\sigma e^{i\rho\delta}\] by the memory usage query \[\sigma\to\text{Tr}_\rho[e^{-i\text{SWAP}\delta}(\sigma\otimes\rho) e^{i\text{SWAP}\delta}]\]
  • DME then does \(N\) memory usage queries (Trotterization):
     
DME(\rho,N,\theta) = e^{-i\rho\theta} + O\left(\frac{\theta^2}{N}\right)

DME flowchart

\text{Tr}_\rho[e^{-i\text{SWAP}\delta}(\sigma\otimes\rho) e^{i\text{SWAP}\delta}] \\ = e^{-i\rho\delta}\sigma e^{i\rho\delta}+O(\delta^2)

Problem of Entanglement

  • To use quantum info from \(\rho\), we need it to interact and correlate with \(\sigma\)
  • How do we avoid entanglement between \(\rho\) and \(\sigma\)?
  • Example: the Bell state circuit create entanglement

How DME avoid entanglement

  • DME uses a series of partial SWAP gate, realized by Heisenberg interaction: \(H_{\text{Heisenberg}} = e^{it{(XX + YY + ZZ)}}\)
  • DME relies on the relation:

     
  • Where, after the partial SWAP, by tracing out the instruction qubit, we get in first order the desired rotation
  • The data qubit is in a pure state since the rotation is infinitesimal

DME in Qibo

DME tutorial notebook

QDP code structure

QDP code structure

There are 2 important parts of a QDP circuit: 

  • Memory call circuit:
    • How many instruction qubit to use
    • How to get N copies of the instruction qubit
  • Memory usage query (circuit):
    • Define the operator used to generate the unitary rotation
    • (in the case of DME the 𝛿SWAP)
  • Memory call circuit: How many instruction qubit to use, how to get N copies of the instruction qubit
  • Memory usage query (circuit): Define the operator used to generate the unitary rotation (in the case of DME the 𝛿SWAP)
  • 𝛿SWAP is decomposed into 3 CNOTs and single qubit rotations

Conclusion

Conclusion

  • QDP applications:
    • Useful for 2+ qubits
    • We need 3 CNOTs per step
  • DME has been realized only once
    • Only for 2 qubits
    • Maybe we can compile it better?
  • Oblivious Schmidt Decomposition (OSD) is from March this year
    • It is interesting already for 4 qubits
    • Can be an original algorithm for demonstration
  • DME and OSD implementation in Qibo

Copy of Quantum Dynamic Programming in Qibo

By Marek Gluza

Copy of Quantum Dynamic Programming in Qibo

I will present to you Quantum Dynamnic Programming, a new protocol that let us use quantum computers programmed by quantum infomation, and our pull-request on Github.

  • 111