Replies: 6 comments 3 replies
-
|
Thanks @bastibock . I paste below the ADR that I originally created as |
Beta Was this translation helpful? Give feedback.
-
Architecture Decision RecordADR-0001: Qrisp Backend Abstraction Layer
1. Context and Problem StatementQrisp is a high-level quantum programming framework that must be able to execute compiled quantum circuits on a wide variety of backends: local statevector simulators, cloud-based simulators, and real quantum processing units (QPUs) from multiple hardware vendors including IQM, IBM, IonQ, Quantinuum, and others. The current backend implementation in Qrisp works as an extremely abstract "one-fits-all" tool. Essentially, the only existing feature is to send quantum circuits and receive results. At the moment, Qrisp has several internal backends ( As a consequence, Qrisp lacks a stable, vendor-agnostic abstraction layer for backend execution. Each integration is implemented ad hoc, leading to a growing maintenance burden as the ecosystem expands. We need to define a clean, minimal interface that:
1.1 Team and Timeline ConstraintsThe Qrisp core team at IQM is small and does not have prior experience designing a backend abstraction of this kind. The target delivery is approximately two to three months from the date of this ADR. These constraints significantly influence the design philosophy: we favour simplicity and well-understood patterns over novelty, and we actively seek review from developers more familiar with quantum hardware (particularly from IQM and the broader open-source quantum computing community) before the interface is frozen. 1.2 Stakeholder Alignment RequirementIQM and developers in the Eclipse Foundation must review and approve the interface contract before it is declared stable. Any breaking change after that point will require a revision process. This ADR is therefore both a design record and the starting point for that external review. 2. Decision Drivers
3. Considered OptionsOption A — Adopt Qiskit's Backend interfaceQiskit defines a mature
Option B — Adopt PennyLane's Device interfacePennyLane's
Option C — Define a minimal Qrisp-native Backend (chosen)Design a thin, Qrisp-owned abstract base class that defines only the essential execution contract, following the same philosophy used by Qiskit's
4. DecisionWe adopt Option C at this stage: a minimal Qrisp-native Backend abstraction. The necessity for a structured job management layer was notably emphasised by IQM engineers during discussions about this project in December 2025. 4.1 The Job-Based Execution ModelThe core idea is that submitting a circuit to a backend returns a job handle immediately, without blocking. The caller then decides when and how to wait for the result. This is the same philosophy adopted by Qiskit: calling The base This design also means that the question of asyncio compatibility is largely deferred to concrete backends. Because the base class does not prescribe how waiting is implemented internally, a backend built on asyncio primitives is free to override the waiting behaviour accordingly. This is the same approach Qiskit takes, and it is safer than baking a specific concurrency model into the shared interface. In summary, and to be extremely clear: we propose to handle the 4.2 The
|
| Pattern | Where it appears | What it expresses |
|---|---|---|
| Proxy (Virtual) | Job alone |
A local placeholder that controls access to a deferred or remote execution result |
| Bridge | Backend + Job together |
Two independently varying hierarchies: submission interface and execution handle |
| Adapter | Concrete backends (e.g. IQMBackend) |
A vendor SDK wrapped to satisfy the Backend interface expected by Qrisp |
These three patterns operate at different levels and are not mutually exclusive. The Proxy describes what a single Job is; the Bridge describes the relationship between the two abstract classes; and the Adapter describes how each concrete vendor integration fits into the overall structure.
6. Advantages and Disadvantages
Note: this section will be updated as the design evolves through the review process.
| Advantages | Disadvantages / Risks |
|---|---|
| Hardware-agnostic: no vendor lock-in in the base interface. | No shared circuit representation: each vendor must handle Qrisp circuit types explicitly. |
| Zero external dependencies beyond Python standard library. | |
Uniform async API for synchronous and asynchronous backends via run_async. |
No parallelism guarantee for batches: sequential vs. parallel execution is backend-defined. |
run() provides backward compatibility for existing code without any changes required. |
New ecosystem: existing Qiskit and PennyLane adapters cannot be reused directly. |
| Batch submission is supported natively. | |
| Explicit job lifecycle states make progress observable without blocking. | |
JobStatus as StrEnum gives human-readable status values that are still type-safe. |
Hardware metadata is untyped at the base level: schema agreement is deferred to vendors. |
Dedicated JobFailureError / JobCancelledError let callers distinguish failure modes. |
The team is designing this interface without prior experience, which carries a risk of structural mistakes that are costly to fix after the interface is frozen. |
last_known_status and refresh() make polling loops network-efficient for remote backends. |
The short runway limits the time available for external review and iteration. |
| The internal concurrency model is left to each backend, avoiding asyncio lock-in. | |
Minimal mandatory surface area for implementors: a single abstract method (run_async). |
7. Risks and Mitigations
R1 — Interface frozen too early
Risk: The interface is stabilised before sufficient external review, leading to breaking changes shortly after release.
Mitigation: This ADR is intended as a basis for discussion before the interface is declared stable. After a review window, we hope it will also be useful for more experienced software engineers to understand the design rationale and suggest alternatives. We can also ship the first release with an explicit pre-release label so that callers are aware of the risk of changes.
R2 — Lack of team experience
Risk: The design contains structural mistakes (for example, a wrong choice of abstraction level, missing lifecycle states, or inadequate concurrency handling) that are hard to fix after the interface is frozen.
Mitigation: We actively solicit review from experienced developers in the quantum computing open-source community. We will document design rationale extensively in the codebase. We will write comprehensive tests covering synchronous, asynchronous, error, and cancellation scenarios before the interface is published.
R3 — Vendor adoption friction
Risk: Hardware vendors implement the interface incorrectly or inconsistently, leading to user-facing bugs that appear to be Qrisp bugs.
Mitigation: We plan to ship a reference test backend and a conformance test suite alongside the interface. This gives vendors a concrete compliance target and reduces the risk of silent incompatibilities.
R4 — Asynchronous execution compatibility
Risk: Backends built on asynchronous frameworks (for example, cloud SDKs that use non-blocking I/O) may not integrate cleanly if the interface makes assumptions about how waiting is implemented.
Mitigation: The base class deliberately avoids prescribing an internal concurrency model. Concrete backends are free to implement waiting in whatever way suits their execution environment. This is the same approach taken by Qiskit. If a future need arises for a dedicated asynchronous variant, it can hopefully be addressed in the future without breaking the existing interface.
R5 — Short delivery timeline
Risk: The two-to-three-month ideal window is insufficient to reach genuine multi-vendor consensus, so the interface ships without adequate external buy-in.
Mitigation: We will prioritise IQM and Eclipse Foundation reviews as the primary partners and treat other vendor agreements as post-v1 stretch goals. We can publish the interface under an explicit stabilisation-period notice in the changelog.
8. External Review Request
The Qrisp team explicitly invites developers (particularly from IQM and the Eclipse Foundation) to review this interface and provide feedback on the following open questions.
Open Questions for Reviewers
-
Is the proposed Job lifecycle sufficient? Are there states specific to real hardware (for example, validation or transpilation phases) that should be standardised in the shared interface rather than left to individual backends?
Answer:
-
Should submitting a batch of circuits return a single job handle for the entire batch, or one handle per circuit? The current proposal returns one handle per batch submission.
Answer:
-
Should hardware metadata properties (qubit count, connectivity, supported gates, error rates) be formally typed in a shared schema, or remain loosely typed as proposed?
Answer:
-
Are there hardware-lifecycle concerns (for example, calibration refresh, session management, or credit and quota tracking) that should be reflected directly in the base interface rather than deferred to an extension point?
Answer:
-
Are there lessons from Qiskit's BackendV2 and Job design (positive or negative) that we have not adequately accounted for?
Answer:
-
Please write additional comments, suggestions, etc. in the space below.
Please submit feedback via comments and/or additions to this document.
9. Consequences
If this ADR is accepted:
- All existing Qrisp backend integrations must be ported to conform to the new interface. Concretely, each existing backend must rename its
run()method torun_async(). The base classrun()method handles the backward-compatible synchronous path automatically, so callers that usebackend.run()require no changes. - A reference test backend and conformance test suite must be shipped alongside the interface.
- A migration guide must be written for any users who have been relying on the existing backend structure.
- IQM and Eclipse Foundation must be engaged promptly after acceptance to begin the joint review process.
- The interface can carry an explicit pre-release label for a stabilisation window, during which breaking changes will require an appropriate discussion.
If this ADR is rejected or superseded:
- A new ADR must be filed documenting the alternative decision.
- In the interim, the backend abstraction problem remains unresolved and integrations continue to be implemented ad hoc.
10. References
Beta Was this translation helpful? Give feedback.
-
|
I have a question regarding the job-based execution model regarding how much it would be exposed to the user: Will it still be possible to run a program via Or would this then work for the user the "qiskit way": or would A related discussion: For execution via Catalyst on a PennyLane device (simulator, or potentially real backend) we enable passing the backend to the Similarly, I would envision to enable providing a backend to the jaspify (or some other) decorator to run Jasp quantum programs: (In this case, executing To put it in a nutshell, the main requirement would be not to expose circuit handling to the qrisp user (except for when the user chooses to work with QuantumCircuits instead of QuantumVariables). |
Beta Was this translation helpful? Give feedback.
-
|
Hi @renezander90 , thanks for the feedback! The Backend infrastructure we are proposing defines how circuits are submitted to hardware and how execution results are retrieved at a low level. How It seems to me that the two are compatible and can be designed independently. Taking into account its name, current signature: and the fact that this is heavily used (I have also seen this in the IQM demo notebooks), I think However, this convenience comes with an important constraint: a blocking For those scenarios, the right entry point is
Neither of these is possible through a method that blocks and returns a dictionary. But both work naturally through Regarding your third proposed option (that is, As a side note, on the current signature of |
Beta Was this translation helpful? Give feedback.
-
|
I have very little experience with Qiskit, but I think the proposed interface makes sense. I will be happy to review the implementation. |
Beta Was this translation helpful? Give feedback.
-
|
Hi team : ) I updated the ADR above and made a second version. This version of the ADR reflects several implementation changes made since the first draft (most of them have been discussed on Mattermost with Raphael and other IQM's engineers):
As a final comment, I will start working on the Plasma-Sabre package while waiting for review(s) on the PR. This will probably suggest further improvements on the Backend structure, which can be implemented in the following PRs before the next release 👍 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In this thread we want to discuss the structure and development of the new backend class.
@PietropaoloFrisoni please feel free to share the ADR based on your internal discussions!
Beta Was this translation helpful? Give feedback.
All reactions