Spaces:
Sleeping
Sleeping
Yuchen Yuan commited on
Commit ·
dca9772
1
Parent(s): a33a7c5
Qshot UX polish: flag GNN-fallback results, drop meaningless -1s
Browse filesObserved on HF after first end-to-end run: bell_state (2q) was out of
Qshot's 5-8q training distribution, so it took the GNN fallback path.
The UI then showed the user 'Cluster: -1 / Tier: -1 / PF-matched
neighbours: 0' — correct Qshot internals but unintelligible to a user
who doesn't know that -1 is the outlier sentinel.
* When method==='gnn_fallback', suppress the cluster/tier/neighbours
line entirely and surface a warn-toned banner that says 'extrapolated
via GNN because the circuit is outside the validated 5-8 qubit
range — treat as a best guess'.
* Update the Qshot preset tagline to 'try ry_chain_6q' so new users
load a 5-8q circuit by default instead of hitting bell_state and
getting surprised by the fallback warning.
frontend/src/components/results/cards.tsx
CHANGED
|
@@ -190,8 +190,11 @@ function QshotCard({ s }: { s: Record<string, unknown> }) {
|
|
| 190 |
.sort((a, b) => a[0] - b[0]);
|
| 191 |
|
| 192 |
// GNN fallback gets its own label so users can tell whether the main
|
| 193 |
-
// regression path was used or not.
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
| 195 |
|
| 196 |
return (
|
| 197 |
<div className="mt-2 space-y-2">
|
|
@@ -217,6 +220,18 @@ function QshotCard({ s }: { s: Record<string, unknown> }) {
|
|
| 217 |
<Stat label="method" value={methodLabel} />
|
| 218 |
</div>
|
| 219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
{/* Target-fidelity formula line — replicates the author's notation
|
| 221 |
"α × converged F (F_inf=…) = target". Only render if all the
|
| 222 |
numbers are real so we don't emit a half-filled sentence. */}
|
|
@@ -228,28 +243,38 @@ function QshotCard({ s }: { s: Record<string, unknown> }) {
|
|
| 228 |
</div>
|
| 229 |
)}
|
| 230 |
|
| 231 |
-
{/* Cluster / tier / neighbors line — compact, tabular.
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
<
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
<
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
|
| 254 |
{/* Pilot-measurement sparkline — shows the shots vs. observed PF
|
| 255 |
points Qshot collected. Small, decorative, so keep it collapsed
|
|
|
|
| 190 |
.sort((a, b) => a[0] - b[0]);
|
| 191 |
|
| 192 |
// GNN fallback gets its own label so users can tell whether the main
|
| 193 |
+
// regression path was used or not. When the fallback is active, Qshot
|
| 194 |
+
// couldn't match the query to any cluster (cluster_label = -1) and is
|
| 195 |
+
// extrapolating via the dual-graph network — worth flagging.
|
| 196 |
+
const isFallback = method === "gnn_fallback";
|
| 197 |
+
const methodLabel = isFallback ? "GNN fallback" : "regression";
|
| 198 |
|
| 199 |
return (
|
| 200 |
<div className="mt-2 space-y-2">
|
|
|
|
| 220 |
<Stat label="method" value={methodLabel} />
|
| 221 |
</div>
|
| 222 |
|
| 223 |
+
{/* Flag fallback path so users know the number comes from a neural-
|
| 224 |
+
network extrapolation, not a cluster match. Qshot's training
|
| 225 |
+
distribution is 5-8 qubits; anything smaller/larger tends to
|
| 226 |
+
fall through to fallback. */}
|
| 227 |
+
{isFallback && (
|
| 228 |
+
<div className="text-[11px] leading-relaxed rounded-md border border-warn/40 bg-warn/10 px-2 py-1.5 text-ink">
|
| 229 |
+
Circuit didn't match any cluster in the training set (out of the
|
| 230 |
+
validated 5–8 qubit range), so Qshot extrapolated with the dual-
|
| 231 |
+
graph GNN fallback. Treat the prediction as a best guess.
|
| 232 |
+
</div>
|
| 233 |
+
)}
|
| 234 |
+
|
| 235 |
{/* Target-fidelity formula line — replicates the author's notation
|
| 236 |
"α × converged F (F_inf=…) = target". Only render if all the
|
| 237 |
numbers are real so we don't emit a half-filled sentence. */}
|
|
|
|
| 243 |
</div>
|
| 244 |
)}
|
| 245 |
|
| 246 |
+
{/* Cluster / tier / neighbors line — compact, tabular. The
|
| 247 |
+
regression path reports these; the GNN fallback returns -1 / -1
|
| 248 |
+
/ 0, which is meaningless to a user, so suppress the whole line
|
| 249 |
+
when the fallback path produced the result. */}
|
| 250 |
+
{!isFallback && (
|
| 251 |
+
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-mute">
|
| 252 |
+
{cluster !== undefined && cluster !== null && (
|
| 253 |
+
<span>
|
| 254 |
+
<span className="text-ink">Cluster</span>: {String(cluster)}
|
| 255 |
+
</span>
|
| 256 |
+
)}
|
| 257 |
+
{tier !== undefined && tier !== null && (
|
| 258 |
+
<span>
|
| 259 |
+
<span className="text-ink">Tier</span>: {String(tier)}
|
| 260 |
+
</span>
|
| 261 |
+
)}
|
| 262 |
+
{nMatched !== undefined && nMatched !== null && (
|
| 263 |
+
<span>
|
| 264 |
+
<span className="text-ink">PF-matched neighbours</span>:{" "}
|
| 265 |
+
{String(nMatched)}
|
| 266 |
+
</span>
|
| 267 |
+
)}
|
| 268 |
+
{snapshot && (
|
| 269 |
+
<span className="font-mono text-edge">· {snapshot}</span>
|
| 270 |
+
)}
|
| 271 |
+
</div>
|
| 272 |
+
)}
|
| 273 |
+
{isFallback && snapshot && (
|
| 274 |
+
<div className="text-[11px] text-mute font-mono">
|
| 275 |
+
· {snapshot}
|
| 276 |
+
</div>
|
| 277 |
+
)}
|
| 278 |
|
| 279 |
{/* Pilot-measurement sparkline — shows the shots vs. observed PF
|
| 280 |
points Qshot collected. Small, decorative, so keep it collapsed
|
frontend/src/lib/presets.ts
CHANGED
|
@@ -87,7 +87,10 @@ export const PIPELINE_PRESETS: PipelinePreset[] = [
|
|
| 87 |
{
|
| 88 |
key: "qshot",
|
| 89 |
label: "Qshot",
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
| 91 |
nodes: [
|
| 92 |
{ id: "n1", kind: "input_circuit" },
|
| 93 |
{ id: "n2", kind: "qshot" },
|
|
|
|
| 87 |
{
|
| 88 |
key: "qshot",
|
| 89 |
label: "Qshot",
|
| 90 |
+
// Nudge users toward the 5-8 qubit range the model was trained on;
|
| 91 |
+
// otherwise they'll get GNN-fallback extrapolations for toy samples
|
| 92 |
+
// like bell_state without realising the result is a best-guess.
|
| 93 |
+
tagline: "Recommend a shot count for a 5-8 qubit circuit (try ry_chain_6q)",
|
| 94 |
nodes: [
|
| 95 |
{ id: "n1", kind: "input_circuit" },
|
| 96 |
{ id: "n2", kind: "qshot" },
|