Skip to content

Standard Error Amplification circuit - #1601

Draft
ElStabilini wants to merge 20 commits into
qiboteam:mainfrom
ElStabilini:sea
Draft

Standard Error Amplification circuit#1601
ElStabilini wants to merge 20 commits into
qiboteam:mainfrom
ElStabilini:sea

Conversation

@ElStabilini

@ElStabilini ElStabilini commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

I am trying to implement the Standard Error Amplification (SEA) circuit to estimate the conditional phase error in CZ gate implementation.

The intended circuit is the following*:

SEA_circuit

The idea was to implement a protocol to correct the pulse amplitude based on the conditional phase error, it doesn't include information on leakage or single-qubit rotation imperfection.

Right now I'm only estimating the conditional phase error without implementing any update as I haven't implemented any protocol to estimate the phase amplitude slope**.

*I didn't find the original reference for the protocol, but I took the idea for the implementation from what is described in https://arxiv.org/pdf/2607.01422

** Maybe there's already something similar but I didn't look for that.

@alecandido

Copy link
Copy Markdown
Member

Thanks @ElStabilini!

The experiment is certainly interesting, since it is measuring the conditional phase with a single sequence.
In particular, for gate candidates, we still need to measure the individual virtual phases, to compensate them. But it is extremely interesting for tuneup landscapes, since it prevents the need of a phase sweep (which can be reduced at most to 2 points, as described in #1590) and the double experiment. I.e. at least a factor 4 speedup, and no need for pixel fits. Super nice :D

In principle, the amplification could be useful for landscape fine-tuning. But I don't have a feeling for how much precise we can get with the usual CZ scheme, since there is a tiny tension between the phase condition and leakage.

However, for sure we will try it. As soon as the PR is ready (and we have a suitable platform available)

@ElStabilini

Copy link
Copy Markdown
Contributor Author

In principle, the amplification could be useful for landscape fine-tuning. But I don't have a feeling for how much precise we can get with the usual CZ scheme, since there is a tiny tension between the phase condition and leakage.

Yes, this is the reason why in [https://arxiv.org/pdf/2607.01422](url) they use also the Echoed Leakage Error Amplification protocol. I think that the idea could be to write a cost function that takes the result from both to fine tune the calibration.

However, for sure we will try it. As soon as the PR is ready (and we have a suitable platform available)

This might take some time on my side :)

@alecandido

Copy link
Copy Markdown
Member

This might take some time on my side :)

No worries, just take the time you need ^^

If needed on our side, we will just reimplement the idea in a landscape - which will be anyhow a different experiment (because of the further sweeps).

Yes, this is the reason why in [https://arxiv.org/pdf/2607.01422](url) they use also the Echoed Leakage Error Amplification protocol. I think that the idea could be to write a cost function that takes the result from both to fine tune the calibration.

Indeed! Thanks again, also for the reference

@sorewachigauyo

Copy link
Copy Markdown
Contributor

There is also section III of this paper https://arxiv.org/pdf/2508.16437, though it is tailored more towards couplers to reduce |02> state leakage

@ElStabilini

ElStabilini commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

There is also section III of this paper https://arxiv.org/pdf/2508.16437, though it is tailored more towards couplers to reduce |02> state leakage

As far as I know the main difference between the PALEA protocol described in section III of https://arxiv.org/pdf/2508.16437 and the ELEA described https://arxiv.org/pdf/2607.01422 is the phase sweep. I guess that choice depends on the kind of optimization loop one wants to perform.

If needed on our side, we will just reimplement the idea in a landscape - which will be anyhow a different experiment (because of the further sweeps).

As you prefer, the only reason why I implemented the protocol as it is was to understand how to write such a circuit in the context of pulse calibration. Eventually I can also leave the protocol simply as a way to estomate the conditional phase error without updating any of the pulses parameters. The update might be performed in an external optimization loop where the phase error is also combined with other FOMs.

@alecandido

Copy link
Copy Markdown
Member

As you prefer, the only reason why I implemented the protocol as it is was to understand how to write such a circuit in the context of pulse calibration. Eventually I can also leave the protocol simply as a way to estomate the conditional phase error without updating any of the pulses parameters.

This is perfectly fine. We also have a virtual phases experiment, which is used for measuring the phases for the chosen gate. It could be useful to have the individual point, since when you settled on the landscape, you may want to have a measurement (possibly more precise) of that point, without performing any scan on the other parameters.

The update might be performed in an external optimization loop where the phase error is also combined with other FOMs.

In this case, I would make a separate experiment, instead of an external loop. The reason is that I would implement in with hardware sweeps.
But once the experiment is known, it costs us little to upgrade it to use sweepers. And if we have a different experiment, we can burn in its fit also the figure of merits, and suitable plots.

@ElStabilini

Copy link
Copy Markdown
Contributor Author

In this case, I would make a separate experiment, instead of an external loop. The reason is that I would implement in with hardware sweeps.
But once the experiment is known, it costs us little to upgrade it to use sweepers. And if we have a different experiment, we can burn in its fit also the figure of merits, and suitable plots.

It definitely makes sense.

This is perfectly fine. We also have a virtual phases experiment, which is used for measuring the phases for the chosen gate. It could be useful to have the individual point, since when you settled on the landscape, you may want to have a measurement (possibly more precise) of that point, without performing any scan on the other parameters.

Then I'll proceed to keep only the conditional phase error estimate :).

@ElStabilini

Copy link
Copy Markdown
Contributor Author

I should have kept only the conditional phase estimation. Some things are still missing (real tests + circuit image) but overall I think it's ready for review.

@ElStabilini
ElStabilini marked this pull request as ready for review July 20, 2026 12:42
@ElStabilini
ElStabilini requested review from a team July 20, 2026 12:42
@alecandido
alecandido requested a review from RoyStegeman August 4, 2026 17:57
@RoyStegeman

Copy link
Copy Markdown
Member

@ElStabilini do you perhaps have a report generated from this experiment? I'm not sure if you have access to the qrc cluster to upload the reports, but if not you can also just zip the folder and share it in a comment.

@RoyStegeman RoyStegeman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few quick observations. I don't have a platform to test with a CZ now, but if you can provide a report that would make my review a lot easier.



def sea_fit(x, offset, amplitude, omega, phase, gamma):
return np.sin(x * omega + phase) * amplitude * np.exp(-x * gamma) + offset

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model in the docs is sin^2. Here the space of solutions is the same and you only care about omega, but a comment explaining why omega is the same as in the documentation would be helpful. Even better would be to match the functional form to that in the documentation.


The final :math:`X(\pi/2)` pulse on :math:`Q_a` is the second pulse of the Ramsey pair: it converts the phase :math:`\phi_n` of :eq:`sea_phase` into a measurable excited-state population

.. math:: P(\ket{1}_{Q_a}) \approx \sin^2\left(\frac{n\,\delta}{2}\right)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also since for n=0 the excited state probability is 1, should this be cos^2 instead?

Comment on lines +190 to +191
[0.4, 0.4, -np.inf, -np.pi / 4, 0],
[0.6, 0.6, np.inf, np.pi / 4, np.inf],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are the same as in flipping, but should they be? My understanding is that for example offset is expected to be 1 (as long as the function is sin instead of cos).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On this I think I must have a look again. At the beginning I had implemented the protocol in a way that was very similar to a flipping protocol and that's the reason why I had chosen those parameters. They probably come from there, I will check it.

Comment thread src/qibocal/protocols/two_qubit_interaction/sea.py Outdated
Comment thread src/qibocal/protocols/two_qubit_interaction/sea.py Outdated
Comment thread doc/source/protocols/standard_error_amplification.rst
Comment thread src/qibocal/protocols/two_qubit_interaction/sea.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Standard Error Amplification protocol for estimating CZ conditional-phase error.

Changes:

  • Adds SEA pulse acquisition, fitting, plotting, and calibration storage.
  • Registers the protocol and adds a test runcard.
  • Adds protocol documentation and bibliography metadata.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/runcards/protocols.yml Adds SEA smoke-test configuration.
src/qibocal/protocols/two_qubit_interaction/sea.py Implements the SEA protocol.
src/qibocal/protocols/two_qubit_interaction/__init__.py Exports the protocol.
src/qibocal/calibration/calibration.py Adds conditional-phase storage.
doc/source/refs.bib Adds the SEA reference and reformats entries.
doc/source/protocols/standard_error_amplification.rst Documents the protocol.
Suppressed comments (4)

src/qibocal/protocols/two_qubit_interaction/sea.py:165

  • The intended population is at an extremum when repetitions == 0 (the documentation gives sin²(nδ/2), while the pulse sequence has two same-axis π/2 pulses), but this model and its ±π/4 phase bound force the fit near the sine midpoint. Consequently, the model cannot represent the ideal SEA trace and the fitted omega is not a reliable phase error. Use the appropriate damped cosine/sign for the finalized pulse convention, or allow and initialize the equivalent ±π/2 phase.
    return np.sin(x * omega + phase) * amplitude * np.exp(-x * gamma) + offset

src/qibocal/protocols/two_qubit_interaction/sea.py:308

  • conditional_phase is declared as list[float], but this assignment strips the uncertainty and stores a scalar. Because assignment validation is disabled, the invalid value survives until the calibration is serialized and later fails model validation when reloaded. Store the fitted value/error pair (or change the calibration field contract to a scalar consistently).
    platform.calibration.two_qubits[target].conditional_phase = results.phase_error[
        target
    ][0]

doc/source/protocols/standard_error_amplification.rst:19

  • This placeholder leaves the central circuit description absent from the published protocol documentation. Add the circuit asset to the documentation tree and replace the comment with an image directive that references it.
..
  missing svg image of the circuit

doc/source/protocols/standard_error_amplification.rst:56

  • An image directive requires a URI; this empty directive will emit a documentation error once the page is included. Reference an added output image, or remove the unfinished expected-output section.
.. image::

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/qibocal/protocols/two_qubit_interaction/sea.py
Comment thread doc/source/protocols/standard_error_amplification.rst
Comment thread doc/source/protocols/standard_error_amplification.rst Outdated
Comment thread src/qibocal/protocols/two_qubit_interaction/sea.py Outdated
@ElStabilini

Copy link
Copy Markdown
Contributor Author

Thank you @RoyStegeman for the review. I should have addressed most of the issues.

Regarding the full functional form, I am not sure about keeping the exponential decay, I would probably test against some data but we are still trying to calibrate single qubit gates so I have no way to that.
Eventually can convert the PR back to draft and wait until I have a report :) .

@alecandido

Copy link
Copy Markdown
Member

Eventually can convert the PR back to draft and wait until I have a report :) .

We may be able to test on our side, but it could happen by the end of September or a bit later.

But you could also run it on the simulator :)

@ElStabilini
ElStabilini marked this pull request as draft September 1, 2026 13:42
@RoyStegeman
RoyStegeman self-requested a review September 3, 2026 07:49
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

Successfully merging this pull request may close these issues.

5 participants