Replies: 6 comments 6 replies
-
Tagging @bubakazouba who was involved in the original submissions of QSE and the decorator code (according to git blame) to get the persons views. |
Beta Was this translation helpful? Give feedback.
-
Hi @gachchami, there is a similar open discussion on this. #2267 (comment) As stated previously in our Discord discussion, the way you define your Yes, we have open issues to update the documentation on how techniques could be stacked. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the question! We clearly have not figured out a great way to show users who are not intimately aware of the needs/requirements of these techniques what they are. As @purva-thakre mentioned in her reply, we are going to add some documentation about stacking techniques, but if you have any ideas about how we can make it more clear which techniques can be stacked or what errors to throw we'd greatly appreciate it! |
Beta Was this translation helpful? Give feedback.
-
If I could add a suggestion here, I think it would help a great deal to add type checks to each QEM method, in addition to the existing type hints. i.e.
Even when combining different techniques without using decorators, it can be difficult to tell which types are supported as input and which returned as output for different executors. If we added type checks (perhaps even running a test input to an executor to check what it returns?), it would be harder to end up with mismatching input/outputs when stacking techniques. |
Beta Was this translation helpful? Give feedback.
-
I am assuming here that when some mitigation strategies throw this error that they are semantically different and hence stacking them does not make sense. If that is true than I believe an error message like "you are stacking X and Y Mitigation strategies and they are not stackable" would be more prudent. Instead the current error message says "You are passing some variable to your decorator and hence something didn't work". this second error message leaves you with a hope that you can still stack them, just not the way you are doing right now. I think we could build a static compatibility map that can be maintained based on the semantics of the mitigation strategy and then during stacking if this compatibility is violated then we fail early and more clearly. |
Beta Was this translation helpful? Give feedback.
-
@gachchami Thank you for this feedback. Yes, one of the reasons why I created #2288 is to make it clear which techniques could be stacked and which ones could not be stacked. I figured once I have all the data, I will add some I am not familiar with a 'static compatibility map'. Could you please provide more information on how this might work? |
Beta Was this translation helpful? Give feedback.
-
Hello there,
This discussion is created following the discussion thread on discord. https://discord.com/channels/764231928676089909/1227280999004766208
In the mitiq paper an example for stacking mitigation strategies is described.
The exector for qse is defined in the follow manner.
https://github.com/unitaryfund/mitiq/blob/v0.35.0/docs/source/guide/qse-1-intro.md#2-define-an-executor
Based on the above documentation we tried the below code.
This seems to fail with the error.
this error is happening as the mitigate_executor that the decorator is calling is "changing the prototype of the executor we are defining. as we go through the stack we notice that all of this depends on type hints to ensure that the decorator has the prototype expected.
I would recommend discussing in this thread "how" to use the decorator to stack. If it is not possible today to stack then how to make it easy to identify which mitigations can be stacked together.
Thank you for your kindness in spending the time to reply.
Beta Was this translation helpful? Give feedback.
All reactions