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 support for circuit cutting in TNs #51

Open
SaashaJoshi opened this issue Jan 19, 2024 · 10 comments
Open

Add support for circuit cutting in TNs #51

SaashaJoshi opened this issue Jan 19, 2024 · 10 comments
Labels
enhancement New feature or request research This requires additional research

Comments

@SaashaJoshi
Copy link
Owner

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.

@SaashaJoshi SaashaJoshi added enhancement New feature or request research This requires additional research labels Jan 19, 2024
@SaashaJoshi
Copy link
Owner Author

SaashaJoshi commented Feb 23, 2024

@tinaoberoi
Copy link

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

@SaashaJoshi
Copy link
Owner Author

SaashaJoshi commented Sep 29, 2024

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!

@SaashaJoshi
Copy link
Owner Author

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

@tinaoberoi
Copy link

tinaoberoi commented Oct 2, 2024

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.

@SaashaJoshi
Copy link
Owner Author

SaashaJoshi commented Oct 2, 2024

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.

@tinaoberoi
Copy link

tinaoberoi commented Oct 2, 2024

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.

@SaashaJoshi
Copy link
Owner Author

SaashaJoshi commented Oct 3, 2024

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?

@tinaoberoi
Copy link

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.

@SaashaJoshi
Copy link
Owner Author

SaashaJoshi commented Oct 24, 2024

HI @tinaoberoi,

Why is that the case? (Is it the limitatiion of the machine learning library in general or because of the subcircuits being depenedent).

It is mainly because of how the functions are structured in Qiskit Machine Learning library. I'll be honest, I haven't had the latest look after Feb 2024.

A wrapper function sounds good. Let me know if you'd need any help in making a PR etc. We should think more about its structure etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request research This requires additional research
Projects
None yet
Development

No branches or pull requests

2 participants