Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error-free arbitrary state transmission demo to QEC_BitFlipCode kata #859

Open
CarlosLaraFP opened this issue Dec 7, 2022 · 7 comments

Comments

@CarlosLaraFP
Copy link
Contributor

The first 6 tasks in QEC_BitFlipCode.ipynb have learners implement the operations required for the single-qubit bit flip QEC code.

We can enhance the learning experience by tying together these operations into an end-to-end demo.

This demo includes the following steps:

  1. Encode an arbitrary state.
  2. Introduce a noise channel that flips a single qubit randomly.
  3. Detect random single-qubit error.
  4. Correct random single-qubit error.
  5. Verify error-free state transmission.
  6. Verify initial state was not disturbed (probability amplitudes did not change).

The demo code would be placed immediately following Task 6 (screenshot attached below).

TestBitFlipQEC

Please let me know your thoughts and whether to proceed with a PR.

@tcNickolas, @anpaz, @ricardo-espinoza, @Manvi-Agrawal

@Manvi-Agrawal
Copy link
Contributor

@CarlosLaraM, I like the demo suggested by you. But I am not sure if we should add a demo task in the kata. Are you open to the possibility of creating a tutorial for QEC_BitFlipCode?

As a general rule of thumb , kata offers only programming exercises on a topic and some reference material (links, lecture notes, etc); while a tutorial offers the theory and demos on some topic, complimented by some exercises.

For some topics like Grover's Algorithm, Deutsch Jozsa algorithm, we initially started with a kata and then created a tutorial to make it easy for learner to follow along.

For more details, you can refer structure of kata/tutorial.

@tcNickolas thoughts?

@CarlosLaraFP
Copy link
Contributor Author

@Manvi-Agrawal I love your idea of creating a tutorial for QEC_BitFlipCode, and it definitely makes sense to add the demo(s) there.

What do you think about giving the tutorial a broader name (i.e. QuantumErrorCorrection) so that we can include additional QEC codes (phase flip, Shor, Steane)?

@Manvi-Agrawal
Copy link
Contributor

Manvi-Agrawal commented Dec 7, 2022

@CarlosLaraM , the idea of naming tutorial as "Quantum Error Correction" sounds good to me since it would allow us to include additional QEC codes in future

It would be helpful if you could share a short structure of the QEC tutorial before raising the PR. More specifically a highlight of different demos and exercises that would be added in PR.

@tcNickolas thoughts?

@CarlosLaraFP
Copy link
Contributor Author

CarlosLaraFP commented Dec 8, 2022

@Manvi-Agrawal, this is the proposed structure of the QEC tutorial:

Bit Flip Code

  • Task 1.1: Computational basis parity measurement
  • Task 1.2: Encode logical qubit into 3 physical qubits
  • Task 1.3: Detect bit flip error on the first qubit
  • Task 1.4: Correct bit flip error on the first qubit
  • Task 1.5: Detect bit flip error on any qubit
  • Task 1.6: Correct bit flip error on any qubit
  • Task 1.7: Verify bit flip code does not disturb the initial state
  • Demo: Error-free arbitrary state transmission using bit flip code
  • Task 1.8: Implement bit flip code using Microsoft.Quantum.ErrorCorrection

Sign Flip Code

  • Task 2.1: Hadamard basis parity measurement
  • Task 2.2: Encode logical qubit into 3 physical qubits
  • Task 2.3: Detect sign flip error on the first qubit
  • Task 2.4: Correct sign flip error on the first qubit
  • Task 2.5: Detect sign flip error on any qubit
  • Task 2.6: Correct sign flip error on any qubit
  • Task 2.7: Verify sign flip code does not disturb the initial state
  • Demo: Error-free arbitrary state transmission using sign flip code
  • Task 2.8: Implement sign flip code using Microsoft.Quantum.ErrorCorrection

Shor code

  • To be continued...

Steane code

  • To be continued...

These tasks will be accompanied by theory markup cells as needed.

My plan is to split the work over several small PRs, completing one section at a time (or perhaps 1-2 tasks at a time). Small batches will minimize the time spent in code review and deliver value to learners incrementally.

Thoughts?

@Manvi-Agrawal
Copy link
Contributor

@CarlosLaraM , thanks for your plan. Sounds good to me. I would like to wait for @tcNickolas's thoughts on this approach.

@tcNickolas
Copy link
Member

I would really like to take a look at #418 before we start working on a new variant of QEC tutorial, and to spend some time figuring out the best way to move forward with the broader QEC tutorials. For example, we have noise simulator in the QDK that can be used to explore error correction - it would be interesting to think how we can incorporate it into these tutorials.

Returning to the question that spawned this thread, we're absolutely free to add end-to-end tasks to the katas, as well as bits of theory. For example, BB84 kata is something mid-way between a pure kata and a tutorial - the protocol is simple enough that it doesn't need extensive theory, so we added some bits of theory and E2E tasks instead of doing a separate tutorial. (For Deutsch-Jozsa algorithm, I did a tutorial after the kata because I really wanted to spend time on the classical solution and especially on the concept of oracles that is a major thing to learn.)

To summarize: I think it's a good idea to add an E2E task to the QEC_BitFlipCode kata, similar to task 2.6 in KeyDistribution_BB84: comments highlighting each step and // ... to fill each step, no automatic test but a %simulate cell to run that task in the notebook and an @Test annotation to run it in the VS/VS Code environment.

@tcNickolas
Copy link
Member

@CarlosLaraFP Are you planning to make the pull request to add the E2E task following the structure of the code in your screenshot? I think it's the best next step here, let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants