qalgora-Q Docs Hub量子文档 ✦ Ask AI✦ 问问文档

Quantum Volume

◐ Design-level API
This page documents qalgora-Q API design, architecture, or adaptation workflows. Code examples illustrate intended usage and are not guaranteed to run in the current reference implementation.

A single number that measures a quantum computer's usable size — it folds qubit count, connectivity, gate fidelity, and crosstalk together into one figure. Adding more qubits does not move the number if they cannot work together across a deep enough circuit.

The question it tries to answer

"How many qubits do you have" is a dangerously misleading metric. A machine advertised at 50 qubits but plagued by high gate error and sparse connectivity may be far less useful than a 27-qubit machine with high fidelity and full connectivity. Quantum Volume (QV) exists precisely to answer a more honest question with one number: how large a circuit can this machine run reliably? Here "large" means both width (qubit count) and depth (number of gate layers), because real algorithms need both.

The crucial design choice is that QV tests square circuits — running circuits of depth n on n qubits. Tying width to depth means any single weakness drags the whole score down; no one can game the metric by simply piling on qubits.

Intuition — why random circuits

The test circuits are generated randomly: each layer randomly pairs the qubits two by two and applies a random SU(4) two-qubit gate to every pair. There are two reasons for this. First, random circuits smear out errors, making it hard for any single error source to be optimised away — and hard to "teach to the test." Second, the ideal output distribution of a random circuit is highly non-uniform: some bitstrings are naturally more probable (the "heavy outputs") and some less so.

On real hardware, each random SU(4) gate must be compiled into a sequence of native single- and two-qubit gates, so QV tests both the quality of the hardware and the capability of the compiler.

An ideal, noise-free machine samples those heavy-output bitstrings at a noticeably elevated rate. Noise does the opposite: it pushes the output distribution toward uniform, flattening the peaks and valleys. So "how often can I still sample a heavy output" becomes a sensitive ruler for noise.

The criterion — heavy-output probability and the 2/3 threshold

For a given random circuit, you first classically simulate the ideal statevector and use it to decide which output bitstrings count as "heavy" (their ideal probability exceeds the median over all outputs). Then you sample the real machine many times and measure how often the results land in the heavy-output set — the heavy-output probability (HOP).

For a sufficiently random circuit of large enough size, the ideal heavy-output probability is expected to be about (1+ln 2)/2 ≈ 0.846; under full decoherence (output tending to uniform) it approaches 0.5. The criterion is: with statistical significance, the machine's average heavy-output probability over a family of random circuits must exceed 2/3. The largest square size n that reliably clears the 2/3 threshold gives

QV = 2n

Note the exponential form: going from n to n+1 doubles QV. This means the QV number itself grows fast, while the n that actually changed underneath it only increments by one — always convert back to n in your head when reading it.

What it measures — and what it doesn't

  • It is a holistic single number. QV will not tell you the fidelity of one particular gate or the connectivity of two specific qubits on its own; it folds all of that, together with crosstalk and compilation quality, into one figure. The upside is that it is hard to cheat; the downside is that it is hard to use for locating a bottleneck.
  • It does not measure speed. Two machines with the same QV can differ greatly in how many circuits they complete per second. To address this, the field added throughput metrics such as CLOPS (circuit layer operations per second).
  • Its square constraint saturates. When the qubit count far exceeds the depth QV can reach, more qubits cannot raise QV, because depth has become the bottleneck. For machines with thousands of qubits, QV alone is no longer enough to characterise their capability.
  • It depends on classical simulability. Deciding heavy outputs requires classically computing the ideal distribution, so QV can only be measured at scales that are still classically simulable — which is exactly what caps the largest size it can certify.
Why vendors love to report QV — and why you should read it carefully
Quantum Volume is hard to dress up by cherry-picking favourable metrics, which makes it a relatively honest cross-vendor benchmark — and that is why so many vendors are happy to publish it. But it saturates and carries no speed information, so on large-scale machines it is increasingly being supplemented by a suite of metrics (QV plus CLOPS, and even error-correction-oriented logical-qubit benchmarks) rather than replaced by any single number.

The measurement procedure, step by step

  1. Choose a square size n and randomly generate a batch of depth-n model circuits.
  2. For each circuit, classically compute the ideal statevector and determine its heavy-output set.
  3. Sample each circuit many times on the real machine, counting how often results fall in the heavy-output set.
  4. Average the heavy-output probability over the whole batch and run a statistical significance test.
  5. Take the largest n that reliably clears the 2/3 threshold, giving QV = 2n.

Generating a model circuit

Read the kernel below against the principles above: it applies, layer by layer on n qubits, random SU(4) gates acting on randomly paired qubits — exactly the random square circuits the QV protocol prescribes. get_state retrieves the ideal statevector used to determine the heavy-output set; sample simulates sampling the real machine, and its frequencies are then compared against that ideal distribution to compute the heavy-output probability.

import qalgora

@qalgora.kernel
def qv_circuit(n: int, perms: list[int], angles: list[float]):
    q = qalgora.qvector(n)
    # layers of random SU(4) gates on permuted qubit pairs ...
    mz(q)

# heavy-output probability is compared to the ideal statevector
ideal = qalgora.get_state(qv_circuit, n, perms, angles)
counts = qalgora.sample(qv_circuit, n, perms, angles, shots_count=10000)
A skeleton, not the full protocol
The kernel above is only a skeleton. A complete QV implementation also needs random model-circuit generation (random pairings plus random SU(4) gates), classical computation of the ideal distribution and its heavy-output set, the heavy-set membership test over many shots, and a statistical significance test with confidence intervals across a family of circuits.
Try it yourself
Increase n step by step and watch the ideal heavy-output probability settle around 0.846; then add noise to the sampling and you will see that probability slide toward 0.5 — once it drops below 2/3, that size no longer counts toward the quantum volume. The readout error mitigation and noisy simulation pages explain the error sources that pull this probability down.

References

  • A. W. Cross, L. S. Bishop, S. Sheldon, P. D. Nation, J. M. Gambetta, "Validating quantum computers using randomized model circuits," Phys. Rev. A 100, 032328 (2019). arXiv:1811.12926

量子体积

◐ 设计接口
本页描述的是 qalgora-Q 的接口设计、架构设计或适配工作流。相关代码用于说明预期用法,当前参考实现不保证可以直接运行。

用单一数值衡量量子计算机的实际可用规模——它把量子比特数量、连接性、门保真度与串扰一并压进一个数字。比特再多,如果它们不能在足够深的线路里协同工作,这个数字也不会变大。

它想回答的问题

"你有多少个量子比特"是一个极易误导的指标。一台标称 50 比特、但门误差高、连接稀疏的机器,可能远不如一台 27 比特但保真度高、全连接的机器有用。量子体积(Quantum Volume,QV)正是为了用一个数字回答更诚实的问题:这台机器能可靠运行多大的线路?这里的"大"同时指宽度(比特数)和深度(门的层数),因为真实算法两者都需要。

关键的设计选择是:QV 测的是方形线路——在 n 个比特上运行深度也为 n 的线路。把宽度与深度绑在一起,意味着任何一项短板都会拉低整体得分,没有谁能靠堆比特数刷分。

直觉 为何要用随机线路

测试线路是随机生成的:每一层把比特随机两两配对,并在每一对上施加一个随机的 SU(4) 双比特门。这样做有两个理由。其一,随机线路会把误差搅匀,让任何单一错误源都难以被针对性优化掉,从而难以"应试作弊"。其二,随机线路产生的理想输出分布高度不平坦——某些比特串的概率天然偏高(称为"重输出",heavy outputs),某些偏低。

随机 SU(4) 门在真实设备上需编译为原生单/双比特门序列,QV 同时测试硬件质量和编译器能力。

一台理想的无噪声机器会以明显偏高的频率采到那些重输出比特串。而噪声的作用恰恰相反:它把输出分布推向均匀,抹平峰谷。于是"我还能多频繁地采到重输出"就成了一把灵敏的噪声标尺。

判据 重输出概率与 2/3 阈值

对给定的随机线路,先用经典模拟算出理想态矢量,据此确定哪些输出比特串属于"重输出"(其理想概率高于全部输出概率的中位数)。然后在真机上多次采样,统计实际落在重输出集合里的频率,即重输出概率(HOP)。

对足够随机且规模较大的理想线路,重输出概率期望约为 (1+ln 2)/2 ≈ 0.846;在完全去相干(输出趋于均匀)的情形下趋近 0.5。判据是:在统计显著性下,机器对一族随机线路的平均重输出概率超过 2/3。能稳定通过 2/3 阈值的最大方形尺寸 n,给出

QV = 2n

注意这个指数形式:从 nn+1 会让 QV 翻倍。这也意味着 QV 这个数字本身增长很快,但它背后真正变化的 n 每次只加一——读数时务必心里换算回 n

它测了什么 又没测什么

  • 它是一个整体性的单一数值。QV 不会单独告诉你某一个门的保真度或某两个比特的连接情况;它把这一切连同串扰、编译质量一起折叠进一个数。优点是难以作弊,缺点是难以定位瓶颈。
  • 它不衡量速度。两台 QV 相同的机器,每秒能完成的线路数可能相差很多。为弥补这一点,业界又提出了 CLOPS(每秒线路层操作数)这类吞吐量指标。
  • 它的方形约束会饱和。当比特数远超 QV 所能达到的深度时,再多的比特也无法提升 QV,因为深度成了瓶颈。对动辄上千比特的机器,单凭 QV 已不足以刻画其能力。
  • 它依赖经典可模拟性。判定重输出需要经典算出理想分布,因此 QV 本身只能在经典仍可模拟的规模下测量——这恰好限制了它能认证的最大尺寸。
为何厂商爱报 QV 也要小心读它
量子体积难以通过挑选有利指标来粉饰,因此是一个相对诚实的横向对比基准,这也是众多厂商乐于公布它的原因。但它会饱和、且不含速度信息,所以在大规模机器上正逐渐被一组指标(QV 加 CLOPS,乃至面向纠错的逻辑比特基准)所补充,而非被任何单一数字取代。

测量流程逐步拆解

  1. 选定方形尺寸 n,随机生成一批深度为 n 的模型线路。
  2. 对每条线路,经典算出理想态矢量,确定其重输出集合。
  3. 在真机上对每条线路多次采样,统计落入重输出集合的频率。
  4. 对整批线路求平均重输出概率,做统计显著性检验。
  5. 取能稳定通过 2/3 阈值的最大 n,得 QV = 2n

生成模型线路

请对照上文原理来读下面的内核:它在 n 个比特上逐层施加作用于随机配对比特上的随机 SU(4) 门,正是 QV 协议所规定的随机方形线路。get_state 取出用于确定重输出集合的理想态矢量;sample 则模拟真机采样,其频率将与该理想分布比对,从而算出重输出概率。

import qalgora

@qalgora.kernel
def qv_circuit(n: int, perms: list[int], angles: list[float]):
    q = qalgora.qvector(n)
    # layers of random SU(4) gates on permuted qubit pairs ...
    mz(q)

# heavy-output probability is compared to the ideal statevector
ideal = qalgora.get_state(qv_circuit, n, perms, angles)
counts = qalgora.sample(qv_circuit, n, perms, angles, shots_count=10000)
这只是骨架,并非完整协议
上面的内核只是一个骨架。完整的 QV 实现还需要随机模型线路生成(随机配对加随机 SU(4) 门)、经典计算理想分布及其重输出集合、在大量 shots 上做重输出集合的归属判定,以及对一族线路做带置信区间的统计显著性检验。
动手试试
逐步增大 n,观察理想重输出概率如何稳定在约 0.846 附近;再为采样引入噪声,会看到该概率向 0.5 滑落——一旦跌破 2/3,这个尺寸便不再计入量子体积。读出误差缓解含噪模拟页面解释了拉低这一概率的误差来源。

参考文献

  • A. W. Cross, L. S. Bishop, S. Sheldon, P. D. Nation, J. M. Gambetta, "Validating quantum computers using randomized model circuits," Phys. Rev. A 100, 032328 (2019). arXiv:1811.12926