SaashaJoshi/piQture

Add support for circuit cutting in TNs

Opened this issue · 9 comments

Refer:

[1] D. Guala, S. Zhang, E. Cruz, C. A. Riofrío, J. Klepsch, and J. M. Arrazola, “Practical overview of image classification with tensor-network quantum circuits,” Scientific Reports, vol. 13, no. 1, p. 4427, Mar. 2023, doi: https://doi.org/10.1038/s41598-023-30258-y.

Hi @SaashaJoshi I would like to work on this task for Hacktoberfest.

Hi @tinaoberoi, that's great.
Regarding the expectations from this issue: I do not particularly expect a code contribution immediately, hence any non-code workflow/pipeline discussion or literature research as a part of Phase 1 of developing such a feature may suffice. I will be open to your ideas as well. I previously did some work on combining circuit cutting with tensor networks here that you can take a look at. Let me know what you think!

Hi @tinaoberoi, let me know if you need help at any moment or wish to discuss things going forward.

Hi @SaashaJoshi
I read the QML-circuit-cutting repo where circuit cutting is implemented on tensor networks. I believe the qiskit circuit_knitting package is used for the implementation.
Since for piQture, we already have tensor networks in place, for Phase1 once we integrate the circuit_kitting library
We can execute the circuit cutting using

observables = PauliList(["ZIIIIIII"])
partitioned_problem = partition_problem(circuit=ttn, partition_labels="AAAABBBB", observables=observables)
sub_circuits = partitioned_problem.subcircuits
sub_observables = partitioned_problem.subobservables
bases = partitioned_problem.bases

And for the next steps we can add module to modify the circuit_knitting source code to overcome blockers like "allowing only single cuts"
Let me know what you think.

This is great. I am thinking along similar lines. I believe classes like SamplerQNN and EstimatorQNN from the Qiskit Machine Learning library need to be modified to make them compatible with circuit cutting structures. This is because tensor networks need to be trained iteratively after a cut has been made on them and these classes do not readily accept multiple circuits that can be executed simultaneously.

However, modifying these classes or adding a module from scratch might be too much work for Hacktoberfest. If you are focused on Hacktoberfest, then quite honestly, I do not think this issue will be a good fit. Also, you will have to show some merged pull requests to complete the Hacktoberfest requirements, which may not happen immediately with this issue. But if you wish to discuss things irrespective of the event I am all ears.

I would like to work on this irrespective of Hacktoberfest. What do you think will be better approach, I was thinking of adding a wrapper module so that we can add additional functionalities going forward.

Perfect!
As per my "exploration" sometime when Qiskit 1.0 was released, circuit cutting produces two sub-circuits per gate/wire cut. These two sub-circuits are difficult to train simultaneously when using the SamplerQNN and EstimatorQNN classes from the Qiskit Machine Learning library. Looking at the commit history here I do not think any changes have been made to accommodate multiple circuits.

A wrapper can be a good alternative to explore. Although I was thinking more along the lines of making the entire training module from scratch, however, starting with a wrapper class/function is good. Do you have some specifics on what the wrapper must do?

These two sub-circuits are difficult to train simultaneously when using the SamplerQNN and EstimatorQNN classes from the Qiskit Machine Learning library. Looking at the commit history here I do not think any changes have been made to accommodate multiple circuits.

Why is that the case? (Is it the limitatiion of the machine learning library in general or because of the subcircuits being depenedent). I found this as a way to parallelise QNN training
And

A wrapper can be a good alternative to explore. Although I was thinking more along the lines of making the entire training module from scratch, however, starting with a wrapper class/function is good. Do you have some specifics on what the wrapper must do?

I agree writing a training module should be the final step, but a wrapper will help me familiarize with the modules.