Sequential MPS encoding #394
Replies: 12 comments 4 replies
-
|
This can be used as a compiler as well as a transpiler. compiler: Compiles statevector to circuit |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for your proposal @ACE07-Sev . So this would be the first approximate encoding pass in UCC. We haven't previously compiled differently based on logical features of a circuit (e.g. if it's an MPS or quantum chemistry problem, etc.), but this is a potentially interesting direction. This could be the start building out an approximate encoding module. Next step would be to build a prototype which tests the circuit -->state vector -->MPS workflow for one of our benchmark circuits, track the number of gates, and simulate and evaluate the overlap of the MPS encoded circuit with the exact solution. |
Beta Was this translation helpful? Give feedback.
-
|
So, choose a few different circuits, generate them for difference qubit sizes, get their statevector (no need to convert them to MPS. MPS is useful for two reasons, one is to perform the encoding given it's the core of the algorithm, and two is for calculating the inner product efficiently but it's not needed explicitly speaking), and then encode that statevector using sequential and compare the fidelity and depth. Did I get all that correctly? |
Beta Was this translation helpful? Give feedback.
-
|
Yep, that's correct! |
Beta Was this translation helpful? Give feedback.
-
|
Copy that. I'll be done in a bit. Quick question, where do I put it for the PR? |
Beta Was this translation helpful? Give feedback.
-
|
So following the directions above in the Developing Your Pass section, if you've already forked UCC, you'll start with the prototype and then submit a PR to merge your fork when you've got a version integrated into UCC and have demonstrated improved benchmarks :) |
Beta Was this translation helpful? Give feedback.
-
|
Copy. |
Beta Was this translation helpful? Give feedback.
-
|
@ACE07-Sev Let us know if your have any questions or need any support on this compiler pass :) |
Beta Was this translation helpful? Give feedback.
-
|
Greetings there, Hope you're doing well. No I don't need help, just not permitted to make a PR because I didn't know we had to keep PRs under 4, so have to wait until the other PRs are closed before they allow me to make a new one. I finished the code same day as when I posted the discussion. I can discuss it though:
I'm going to make a PR for both scenarios (single PR, but two .py to showcase both approaches), and you can choose which one you prefer. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @ACE07-Sev thanks for the update! We've decided to make an exception for the PRs you mentioned above since we already had this discussion going. You can go ahead and submit the PRs for UCC. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you so much. I'll be done in a few moments. |
Beta Was this translation helpful? Give feedback.
-
|
Just tracking here, I went ahead and reviewed your PR The prototype notebook looks good, so your next step will be 5. Implement the New Pass in the UCC Codebase (refer to comments on the PR for details) If you wouldn't mind, please also edit the original Discussion post to link your fork of UCC and the demonstration notebook, just so we have everything in one place :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
1. How the technique works
Sequential MPS encoding [1] is a way to approximately encode a matrix product state up to arbitrary fidelity in$O(N)$ circuit depth where $N$ is the number of qubits. The cap fidelity is based on the bond dimension $\chi$ which trades off memory and runtime with potential for squeezing more fidelity from the encoding.
The figure below compares state-of-the-art exact encoding with the MPS approach. The fidelities are placed below the figure:

2. Performance expectations
MPS are mathematical representations for approximating 1D tensor networks efficiently. That being said, it represents entanglement within a 1D chain where longer entanglement range equates to deeper circuits. Data that is short-range entangled like images are perfect for such a compiler and are useful for state preparation blocks in QML use-cases. However, the focus is to provide the improvement over Isometry for arbitrary states.
MPS boasts$O(N)$ depth scaling, thus it significantly reduces the circuit depth and thus the 2 qubit gates.
Develop your compiler pass
Once the maintainers have given you the go-ahead, you can work on the next sections:
Create a fork of UCC to develop in: [link your fork here]
Hint: We recommending syncing your fork with the main branch of UCC to stay up to date with changes.
Implement and Validate a Prototype of the Pass:
A Jupyter notebook or a small script is sufficient for the prototype: [link prototype script/notebook here].
Important: Make sure your compiler pass works as you expect on the circuits you defined in step 2a.
Implement the New Pass in the UCC Codebase:
Documentation to guide you through this process is available in the user guide. For more detailed information and examples, refer to the Qiskit documentation.
Fork: https://github.com/ACE07-Sev/ucc
Link to notebook: https://github.com/ACE07-Sev/ucc/blob/main/ucc/aqc/testing%20mps%20sequential.ipynb
Benchmark performance
UCC benchmarks live in the separate repo called ucc-bench. We have a suite of quantum circuits that we regularly benchmark UCC and other popular quantum compilers on. Several of the key metrics we track are:
Compiling alone:
Simulating compiled circuits:
Your new pass should improve one or more of these metrics on our existing benchmark suite.
When you are ready to run benchmarks...
Useful documentation
Contributing Guide
Setting up your Developer Environment
Writing a Custom Transpiler Pass
-We use "transpiler pass" to refer to transformations that act only on the Directed Acyclic Graph (DAG) representation of the quantum circuit. Higher or lower-level optimizations (e.g. algorithm-level or pulse-level, respectively), we call "compiler passes."
Beta Was this translation helpful? Give feedback.
All reactions