optimizing quantum circuits with classical thinking
play

Optimizing quantum circuits with classical thinking Craig Gidney - PowerPoint PPT Presentation

Optimizing quantum circuits with classical thinking Craig Gidney Google Quantum AI QPL/MFPS 2018 Goal: explain section 3-D of arXiv:1805.03662 [...] [...] Key ideas we'll cover 1. Cost of error corrected quantum computation 2. Preparing


  1. Optimizing quantum circuits with classical thinking Craig Gidney Google Quantum AI QPL/MFPS 2018

  2. Goal: explain section 3-D of arXiv:1805.03662 [...] [...]

  3. Key ideas we'll cover 1. Cost of error corrected quantum computation 2. Preparing phase-insensitive superpositions == random sampling 3. Fast proportionate sampling 4. Putting it all together for savings!

  4. Part 1 The cost of error corrected quantum computation

  5. """Real world""" parameters: d code ≈20, t cycle ≈1us 40 9 time: 1.25d cycles 9 2.5d qubits Area: 2401 qubits 2.5d 40 qubits 25us

  6. Basic error-corrected operations initialization: cheap measurement: cheap Time NOT gate: free Sqrt(NOT) gate: cheap Controlled-NOT: cheap this space intentionally left blank

  7. Time ≈ 150us Not so cheap: Sqrt(Sqrt(NOT)) output T state factory: Footprint ≈150K physical qubits noisy T state injections

  8. Quantum AND gate: expensive! OR, NAND, NOR, etc are similarly expensive. 150us + 150us + 150us + 150us = 0.6ms

  9. Wildly differing costs Classical perspective on gate costs Quantum perspective on gate costs FullAdder isn't even a whole instruction. FullAdder takes a half millisecond.

  10. Another cost: reading data under superposition - RAM takes O(N) space to store. - N AND gates is expensive, but N logical qubits are even more expensive. - Instead of storing data in qubits, hardcode it into a circuit ("QROM"). - QROM circuit needs AND gates.

  11. Reading data under superposition: QROM circuit Iterate over possible index values. Encode data into presence/absence of CNOT targets.

  12. Reading data under superposition: Expensive! +3 +2 total=7 N=8 +1 +1 QROM query over N values: N-1 AND gates Video games render frames faster than we hope to do QROM reads Note: uncomputing AND is ~cheap

  13. Part 2 Preparing quantum states

  14. The Preparation Problem Given precomputed coefficients for a superposition, prepare such a superposition

  15. Previous Approach Set ON-vs-OFF proportion of a qubit just right with a precise rotation. Conditioned on first qubit, set another qubit's ON-vs-OFF proportion just right. Etc.

  16. Cost of Previous Approach Uses N-1 precise rotations. Cost of precise rotation ≈ 12 AND gates. (≈50 T gates) Roughly 3/4 of a second at N=100.

  17. Key insight: sometimes junk is okay You were asked to prepare a superposition: But if its usage is insensitive to phase error, you can prepare this instead: i.e. just get the probabilities right:

  18. Key insight: sometimes junk is okay Context: prepared superposition is only used as a control

  19. Key insight: sometimes junk is okay entanglement cancels against phase error inverse operations during uncompute

  20. Example: Preparing Step 3: Quantum-ify. Step 1: What's the Step 2: Create a probability distribution? classical sampling uniform sample method. u = uniform_random() uniform superposition return u**2

  21. Part 3 Sampling hard-coded probability distributions

  22. Fitness proportionate selection f a =7 f e =5 Common step in genetic algorithms f b =4 f c =3 Given: a list of items with fitnesses f d =1 a b c d e Goal: sample items with twice as much fitness twice as often f a =7 f b =4 f c =3 f d =1 f e =5 0 20

  23. Common Fitness-Proportionate Selection Methods https://jbn.github.io/fast_proportional_selection/ Classical Sampling Cost Linear Walk O(N) Bisecting Search O(lg N) Stochastic Acceptance O(p max N) f a =7 f b =4 f c =3 f d =1 f e =5 0 20

  24. Common Fitness-Proportionate Selection Methods https://jbn.github.io/fast_proportional_selection/ Classical Sampling Cost Quantum Preparation Cost Linear Walk O(N) O(N lg(1/ε)) Bisecting Search O(lg N) O(N lg(1/ε)) Stochastic Acceptance O(p max N) Not Reversible Search trees don't help quantum cost. Under superposition, you must do the operations for every path.

  25. Common Fitness-Proportionate Selection Methods https://jbn.github.io/fast_proportional_selection/ Classical Sampling Cost Quantum Preparation Cost Linear Walk O(N) O(N lg(1/ε)) Bisecting Search O(lg N) O(N lg(1/ε)) Stochastic Acceptance O(p max N) Not Reversible Alias Sampling* O(1) O(N + lg(1/ε)) *Walker 1974: "New fast method for generating discrete random numbers with arbitrary frequency distributions"

  26. Alias sampling: repacking histograms 0 Pick initial item uniformly at 0 random, then probabilistically switch to an alternate item. 0 4 0 1 4 0 1 0 4 0 0 1 2 4 0 1 2 4 0 0 1 2 4 0 1 2 4 4 0 1 2 3 4 0 1 2 3 4

  27. How to repack a histogram 0 0 0 4 Average 0 1 4 0 1 2 4 0 1 2 4 0 1 2 3 4

  28. How to repack a histogram 0 0 0 4 Average 0 1 4 S O 0 1 2 4 L V 0 1 2 4 E D 0 1 2 3 4

  29. How to repack a histogram too large 0 too small 0 0 4 Average 0 1 4 S O 0 1 2 4 L V 0 1 2 4 E D 0 1 2 3 4

  30. How to repack a histogram top up by transferring 0 0 4 Average 0 1 0 4 S O 0 1 2 4 L V 0 1 2 4 E D 0 1 2 3 4

  31. How to repack a histogram 0 0 4 Average 0 1 0 4 S S O O 0 1 3 4 L L V V 0 1 3 4 E E D D 0 1 3 3 4

  32. How to repack a histogram It's okay to undershoot the average when donating 0 0 Average 0 1 0 4 S S O O 0 1 3 4 L L V V 0 1 3 4 4 E E D D 0 1 3 3 4

  33. How to repack a histogram 0 0 Average 0 1 0 4 S S S O O O 0 1 3 4 L L L V V V 0 1 3 4 4 E E E D D D 0 1 3 2 4

  34. How to repack a histogram Average 0 1 0 4 0 S S S O O O 0 1 3 4 0 L L L V V V 0 1 3 4 4 E E E D D D 0 1 3 2 4

  35. How to repack a histogram Average 0 1 0 4 0 S S S S S O O O O O 0 1 3 4 0 L L L L L V V V V V 0 1 3 4 4 E E E E E D D D D D 0 1 3 2 4

  36. Repacking costs Linear time using Vose's algorithm Doesn't affect runtime of quantum algorithm (classically precomputed) All approximations happen here. Sampling adds zero additional error! 0 0 0 4 0 1 4 0 1 0 4 0 O(N) 0 1 2 4 0 1 2 4 0 0 1 2 4 0 1 2 4 4 0 1 2 3 4 0 1 2 3 4

  37. Part 4 Putting it all together

  38. Using alias sampling to prepare a superposition Classical Sampling Quantum Preparation def alias_sample(alternates, keep_weights, precision): # Pick an item uniformly at random. n = len(alternates) k = randint(n) # Look up alternate item and keep chance. alt = alternates[k] keep = keep_weights[k] # Potentially switch to alternate item. threshold = randint(2**precision) kept = threshold < keep return k if kept else alt

  39. Cost of alias preparation Preparing a uniform superposition costs O(lg N + lg 1/ε) QROM lookup uses N-1 AND gates (dominant cost) Compare+swap costs O(lg N + lg 1/ε) Runs at ≈20Hz given N=100. (an order of magnitude faster)

  40. Part 5 Wrap-up

  41. What we covered: section 3-D of arXiv:1805.03662 [...] [...]

  42. Preparation is a small part of a larger algorithm Quantum phase estimation 1 This talk lg N N

  43. Estimated costs of the overall algorithm Contrast with previous work*, which had: *Reiher et al: "Elucidating reaction - Execution times in months mechanisms on quantum computers" - Using hundreds of millions of physical qubits - Assuming 10 nanosecond T gates instead of 150us T gates

  44. Key Takeaways - Quantum algorithms start with a constant factor penalty of a billion (if not more). - When a quantum subroutine is phase-insensitive, try porting classical methods. - Random sampling methods seem to port particularly well. - Alias sampling dominates bisecting search sampling yet is less well known.

  45. 0 0 0 4 0 1 4 0 1 0 4 0 0 1 2 4 0 1 2 4 0 0 1 2 4 0 1 2 4 4 0 1 2 3 4 0 1 2 3 4 Thanks for listening!

Recommend


More recommend