ONLINE COURSE
Sample Introductory Lab and Assignment Showcase
Hey Quantum Threat Analyst—welcome to your Introductory Level. Here you’ll learn the foundations of quantum security: qubit states and measurement bases, gate rotations and phase, and how interference statistics reveal tampering. The sample lab below shows the exact format used across this level. You’ll complete 20 labs. Each lab presents a realistic, level-appropriate problem, an ultra-detailed, step-by-step solution, and a Jupyter lab whose code cells mirror the solution steps one-to-one. Expect to think mathematically and implement small simulations. Progress is tracked via AI-proctored labs. Review the Math Primer and Python Quickstart as needed—and have fun. Remember, this is not a certificate mill—mastery is demonstrated through mathematically sound reasoning and working code.
This page gives you a hands-on preview of what it’s like to learn inside SpecterAI. You’ll see three parts: the problem scenario, the step-by-step solution, and the fully functional lab. The lab is interactive and AI proctored, where you see a “Enter Code Here” section, you can place your own code and run it. You can also ask the AI proctor for hints and help. This sample isn’t taken from our actual curriculum; it’s designed to give you a taste of our style, structure, and quality before you enroll. You’ll experience realistic scenarios, clear explanations, and working code you can test immediately.
Problem
Intro — First Harbor Bank: North Spur QBER Spike (Problem)
Mission Brief (Scenario)
Year: 2028. You’re on the night shift at SpecterAI Quantum Security, a vendor contracted to keep the metropolitan payments network of First Harbor Bank safe. The bank runs an all‑fiber quantum key distribution (QKD) ring that stitches together its data centers, ATM hubs, and an overnight clearing facility. Classical traffic—card authorizations, wire transfers, and vault telemetry—travels inside VPN tunnels whose keys are refreshed every few seconds from the QKD links. Your job is to be the “air‑traffic controller” for those keys.
At 02:41 a.m., a soft chime confirms an automatic switchover: the bank’s east loop has finished a key refresh. Seconds later your console flashes amber. A health daemon named Lighthouse flags a pattern on the north spur, the link that feeds the ATM aggregation switch near the waterfront. Tonight the harbor is gusty; cranes moan, ferries throw spray, and fiber trays near the pier are rumored to rattle when the wind is high. You inhale, sip lukewarm coffee, and look closer.
The screen overlays a trend of QBER—the quantum bit error rate. Normally it ticks along at ~2.5% on this spur, reflecting benign things like detector dark counts and imperfect alignment. For the last minute, however, the line has crept past 7%, then 8%, then held there. Three back‑to‑back one‑minute windows above the “yellow fence.” Is the wind pushing the pole? Is someone jiggling a patch panel? Or is this an active probe—a would‑be eavesdropper whose presence shows up first as extra errors?
You have minutes to decide. If you quarantine the spur, Lighthouse will pause key use on that path and the bank will route around it using cached keys and secondary circuits. That keeps transactions safe but reduces redundancy; do it too often and operations will push back. If you pass, keys continue to flow through potentially risky optics. Your decision must be defensible, simple, and fast—it must be something a tired analyst at 3 a.m. can do with pencil math and a couple of plots.
Lighthouse offers just the essentials: for each 60‑second window it shows: (i) the number of sifted bits \(N\) that made it through; (ii) the number of mismatches \(e\) (where Alice and Bob disagree); (iii) a running “benign range” band learned from past nights; and (iv) a simple rule: if the observed error rate is high and stays high across consecutive windows, quarantine.
You pull the latest 10 windows, check your watch, and get to work. Before the wind, before the cranes—and before any attacker—your job is to measure what the link is truly telling you, and to act.
Background (Technical, beginner‑friendly)
1) What is QKD (in one breath)?
Think of QKD as a way for two ends of a fiber—conventionally called Alice and Bob—to agree on a secret key by sending single‑photon‑level signals. Because of quantum physics, any eavesdropping attempt unavoidably disturbs those signals. That disturbance shows up to Alice and Bob as errors once they compare a small sample of their results over a public channel. If errors are low, they can mathematically “clean” their raw bits (information reconciliation and privacy amplification) and extract a secret key. If errors are high, they throw the data away because it isn’t safe.
2) The only number we’ll need: QBER
The quantum bit error rate is just a fraction \( \mathrm{QBER} = e/N \). For example, if \( e=300 \) and \( N=12{,}000 \), then \( \mathrm{QBER} = 300/12{,}000 = 2.5\% \).
QBER rises when the channel is noisy (bad alignment, vibration, temperature shifts), detectors are unhappy (dark counts, afterpulsing), or someone is poking the line (intercept‑resend, bright‑light tricks, timing games, etc.).
3) “How high is too high?”
Security proofs depend on the specific protocol and implementation. A common classroom figure you’ll see in BB84 discussions is about 11% as a theoretical no‑go line for infinite‑key, idealized conditions. Real systems are more conservative. For a production operator, the practical question isn’t “can I prove a theorem at 3 a.m.?” but “should I trust keys from the last few minutes?”
So Lighthouse uses operational triage thresholds learned from the link’s normal behavior:
- Green \( \mathrm{QBER} \le 3.5\% \) (normal overnight level for this spur).
- Yellow \( 3.5\% < \mathrm{QBER} \le 7.0\% \) (watch carefully).
- Red \( \mathrm{QBER} > 7.0\% \). One red window could be a blip; three red windows in a row means quarantine.
Why three? Because single minutes can spike—say a ferry horn shakes the rack—but sustained elevation is far more suspicious and degrades key quality.
4) A tiny bit of statistics you can do on a napkin
The QBER you measure is a sample. If you rewound time and measured again, you’d get slightly different numbers. It helps to attach a simple confidence interval to each QBER so you know the plausible range of the “true” error rate during that minute.
A robust, beginner‑friendly choice is the Wilson interval for a proportion. For a window with \(N\) bits and observed rate \(\hat p=e/N\), a 95% Wilson interval is:
\[ \hat p_{\mathrm{lo,hi}} = \frac{ \hat p + \dfrac{z^2}{2N} \;\pm\; z\sqrt{\dfrac{\hat p(1-\hat p)}{N} + \dfrac{z^2}{4N^2}} } { 1 + \dfrac{z^2}{N} }, \qquad z=1.96. \]
You don’t have to memorize the formula—your tool (or a tiny script) can compute it. The idea: if the entire interval sits above the red line (7%), that’s extra evidence the link is genuinely in trouble, not just jittering around.
5) The rule you’ll implement
- For each one‑minute window, compute \( \hat p = e/N \) (QBER).
- (Optional but recommended) Compute the Wilson 95% interval for context.
- Maintain a counter of consecutive red windows (\( \mathrm{QBER} > 7\% \)).
- Decision: If you see 3 red windows in a row, QUARANTINE (pause key use on this spur and raise an alert). Otherwise PASS, but annotate the ticket if you crossed yellow or red even briefly.
Why keep it this simple? Because operators need decisions they can trust when tired, busy, or under alarm storms. This rule is intentionally conservative (leaning toward safety).
6) What your data looks like
For each minute you’ll see a pair \((N,e)\). In this lab we’ll hand you a small series of 10 windows captured around the event:
- \(N\) (sifted bits) per window is roughly stable (network load is steady).
- \(e\) (error counts) is usually in the low hundreds—but spikes during the anomaly.
You’ll compute the QBER series, apply the rule, and make the call.
Problem (what the student sees & does)
Bank link: North spur, harbor segment.
Window size: 60 seconds.
Triage thresholds: Yellow \(=3.5\%\), Red \(=7.0\%\).
Rule: 3 consecutive Red windows \(\Rightarrow\) QUARANTINE.
Data (10 consecutive windows, oldest → newest)
| Window | \(N\) (sifted bits) | \(e\) (errors) |
|---|---|---|
| 1 | 12,000 | 310 |
| 2 | 12,000 | 325 |
| 3 | 12,000 | 315 |
| 4 | 12,000 | 320 |
| 5 | 12,000 | 910 |
| 6 | 12,000 | 945 |
| 7 | 12,000 | 930 |
| 8 | 12,000 | 340 |
| 9 | 12,000 | 335 |
| 10 | 12,000 | 332 |
Tasks
- For each window compute QBER \( \hat p = e/N \) (express as %).
- (Optional but encouraged) Compute the Wilson 95% confidence interval for each \( \hat p \).
- Mark each window Green, Yellow, or Red using the thresholds.
- Apply the rule “3 Reds in a row \(\Rightarrow\) QUARANTINE.”
- In one sentence, write your operator decision and a short justification an on‑call manager can understand.
Deliverables
- A 10‑line table of QBERs (and intervals, if computed).
- The final call: PASS or QUARANTINE, plus a one‑paragraph rationale.
Student Edition
QBER Triage for the Bank’s North Spur
1.0 Historical Background & Conceptual Deep Dive
Quantum key distribution (QKD) is a way for two endpoints—conventionally called Alice and Bob—to agree on a shared secret key by sending weak optical signals and then comparing a small sample of their measurement outcomes. Because quantum measurements disturb unknown states, any eavesdropper who tries to peek at the quantum traffic leaves footprints that appear as errors when Alice and Bob compare notes. If those errors are low, a classical cleanup step (information reconciliation and privacy amplification) carves out a secret key; if they are high, the data are discarded. That single operational distinction—keep or throw away—is the reason that the error fraction of sifted bits, the quantum bit‑error rate (QBER), sits at the center of real deployments.
Early field trials taught operators that QBER behaves like a thermometer for a link: it rises when alignment drifts, when fog or vibration shakes optics, when detectors misbehave (afterpulsing, dark counts, saturation), and when an adversary interferes with the quantum states. Unlike a complicated model, QBER is a simple proportion—count the disagreements, divide by the total. That simplicity makes it auditable and easy to brief; it also makes it honest about what it does not say: QBER alone does not diagnose cause; it triages risk.
In production, decisions must be fast and consistent—especially after midnight when staffing is thin. For that reason, modern programs commit to minute‑scale windows and to explicit thresholds written in a commissioning document. A single minute provides enough sifted bits for a stable estimate while remaining responsive; ten minutes provide a useful strip of context. Policy then translates numbers into rules. In this splash lab, the attached problem defines three bands—green ≤ 3.5%, yellow 3.5–7.0%, red > 7.0%—and a simple run detector: three consecutive red minutes ⇒ quarantine. Your task is to compute the numbers faithfully and apply the rule consistently to produce a one‑line console brief. The goal is not to prove security but to keep degraded keys out of the pool while operations investigate.
Students often ask, “Why a run and not a single red?” Because windows are samples, not truth. Real‑world systems jitter, maintenance lights pulse, and racks get nudged. A single burst can spike QBER without signaling persistent trouble. By requiring a run of three, policy prefers quarantining only sustained elevations. The conservative tilt is intentional—better to pause a spur briefly than to mint keys during a bad patch. As you work, you will see how uncertainty quantification (confidence intervals) aligns with that conservative posture: when the entire interval for a minute sits above the red line, it strengthens the claim that the elevation is genuine rather than sampling wobble.
The narrative scenario—an overnight shift at a bank, a harbor segment exposed to gusty conditions, and a health daemon named Lighthouse—adds color but also realism. Subsea trays rattle when cranes move; ferries throw spray; industrial HVAC produces rhythmic vibration. Against that background, the discipline you practice here—clear denominators, explicit thresholds, and one‑line decisions—gives a repeatable way to separate “weather” from “weird.” The same discipline will reappear across the rest of the series (timing skew, basis bias, guardband monitors, decoy‑state ratios): define a proportion, quantify uncertainty, apply a written rule, and brief succinctly.
2.0 Extended Historical & Operational Context
QKD grew out of a simple but powerful idea in the 1980s: if you encode information in quantum states that cannot be measured without disturbance, then tampering announces itself as errors. In lecture halls, that principle is illustrated with carefully chosen thought experiments and idealized channels. In operations, the same principle survives—but only after you translate it into procedures that fit a messy reality. Harbor fog beads on housings; ferries roll bow waves into pylons; HVAC cycles introduce diurnal signatures; and security cameras share conduits with patch fibers that nobody has touched in years. The operating system of a genuine QKD deployment is therefore not a theorem; it is a culture of measurement, thresholds, and discipline: measure the right proportion, attach an interval, compare to a published band, and only then interpret. QBER triage is the front door to that culture.
Historically, the first wave of field tests ran on benches: meters of fiber, benchtop sources, and lab notebooks. Operators were physicists who could switch bases by rotating a half‑wave plate and then scribble down counts. As systems scaled into cities, bench gestures turned into fiber maps, sealed modules, service windows, and audit trails. QBER remained—precisely because it is agnostic to mechanism. You do not need to know every polarization crank or photonic path to say, “the fraction of disagreements just rose and stayed high.” And when you treat that fraction with respect—printing denominators, intervals, and rules—you get decisions that are defensible to non‑physicists who control budgets and risk.
The conservative three‑red run is a product of that maturation. You will find pages of debate about the “right” number of reds in a row. The choice is not mystical; it is an engineering compromise between sensitivity (catch trouble early) and specificity (avoid needless pauses). Two reds may catch more anomalies but will also stop keys for gusts and forklifts; four reds might be safer for throughput but slower to protect secrets. Three sits in the middle: easy to remember at 2 a.m., and strong enough to resist random blips with the denominators used here. If a different spur runs at 3,000 sifted bits per minute instead of 12,000, you would keep the rule but reconsider the bands; the same 7% line has wider uncertainty at lower counts. That is why commissioning documents tie gates to expected denominators and include a plan for seasonal re‑validation.
What about “intelligent” detectors or machine‑learned thresholds? They can add value, but they can also hide reasoning. Seasoned operations teams insist that the first decision layer be something a human can brief: a proportion, an interval, and a band. Sophisticated diagnostics and forensics can live downstream—pattern recognition in phase telemetry, Bayesian filters, anomaly detection in coincidence rates—but the console call that pauses keys should always be explainable in a paragraph. That is the spirit of this splash lab.
Finally, QBER triage teaches an ethical stance. A quarantine is not an accusation. It is a pause: “we do not trust fresh keys from that path right now.” The pause protects confidentiality while inviting evidence to accumulate—a technician’s photo of a loose tray, a wind log, a maintenance change submitted late. Treat quarantines as opportunities to learn, not to blame. When the line recovers and the green run holds, closing the ticket becomes a small lecture about discipline that trains the next analyst.
3.0 Executive Overview (Student Chapter)
You will analyze ten consecutive one‑minute windows on a single QKD spur. For each window, compute QBER = e/N, optionally attach a 95% Wilson confidence interval, color each minute using policy bands (green/yellow/red), and scan for a run of three reds. Your deliverables are a ten‑line table (fractions + decimals, denominators printed), a short paragraph that states the relevant comparisons, and a one‑line console brief. This chapter explains the physics intuition in plain language, derives the math you need, and gives you a briefing template so your final line reads like an operations call and not a homework proof. The instructor solution follows the exact same structure but carries the formal decision; in the student edition you compute and state the inequalities without issuing the verdict.
4.0 Conceptual Foundations
4.1 What is QBER (and why does it “mean” anything)?
QBER is the proportion of sifted bits that disagree between Alice and Bob in a given window. In BB84‑style links, bits are kept only from moments when Alice and Bob used the same basis; those are the sifted bits. Because any eavesdropper necessarily disturbs quantum states, an elevated QBER often accompanies probing. But QBER also rises for benign reasons: mis‑alignment, temperature drift, or stressed detectors. This is why QBER is best used as a triage statistic—not a courtroom verdict. It tells you when to pause, look closer, and protect key material.
4.2 Windows are samples (uncertainty matters)
If you re‑ran the same minute under the same conditions, you would not get exactly the same error count. The measured fraction p̂ is a random variable with sampling spread that scales like √(p̂(1−p̂)/n) where n is the denominator. Larger denominators yield smaller spreads. Reporting a confidence interval next to each p̂ gives a sense of how sure you can be about the color. At the denominators used in this lab (~12,000 per minute) even a 2–3 point change in QBER is many standard errors—big enough to be “felt” by the statistics and not mere jitter.
4.3 Policy, not improvisation
Thresholds and run lengths live in a policy document; analysts do not change them mid‑incident. The splash problem sets the bands and the run rule for you. Your job is to compute and to compare. If the environment changes materially (seasonal weather, topology, optics), leadership revises the bands later with version control and a short rationale. This separation of roles keeps the console honest and auditable.
4.4 Denominator discipline
Comparing raw error counts across windows can mislead when denominators change with load. Always show the reduced fraction and the
decimal (e.g., “910/12000 = 0.0758 = 7.58%”). Printing denominators inoculates your brief against the most common source of confusion
in incident reports—percentages without context.
5.0 Given (Window‑Scale Inputs)
The splash problem provides the inputs below. Treat them as fixed; your task is to compute and to compare.
| Symbol | Description | Value / Notes |
|---|---|---|
| N | Sifted bits per minute (denominator) | ≈ 12,000 in each window |
| e | Error count per minute (numerator) | Varies; spikes during anomaly |
| Bands | Policy thresholds (commissioned) | Green ≤ 3.5%; Yellow 3.5–7.0%; Red > 7.0% |
| Run rule | Operations control | Three consecutive red minutes ⇒ quarantine |
| Dataset | Ten consecutive windows (oldest → newest) | e = [310, 325, 315, 320, 910, 945, 930, 340, 335, 332]; N=12,000 each |
6.0 Estimators & Uncertainty (Math, with English Gloss)
6.1 QBER per window
6.2 Standard error (normal approximation)
6.3 Wilson 95% confidence interval
6.4 Policy coloring (bands)
After computing p̂, convert to a percentage with two decimals for display (retain full precision internally). Color minutes using the three bands defined in the splash problem; do not move gates mid‑incident.
7.0 Screening Rule (No Verdict Yet)
The screening rule is deliberately simple: if you see three consecutive red minutes, quarantine the spur; otherwise pass but annotate any red or yellow minutes for the watchlist. In the student edition, you will compute all quantities and state the relevant comparisons (“p̂k vs 7%,” “run length vs 3”) without announcing the final call. The instructor edition carries the official decision using the same denominators and thresholds.
8.0 Student Tasks (What You Must Produce)
- Compute QBER p̂ = e/N for each of the ten minutes; publish reduced fractions and decimals to two places.
- (Optional but recommended) Compute Wilson 95% intervals for each p̂; list the method you used.
- Color the minutes using policy bands; include a “run length” column showing the current count of consecutive reds.
- Draft a one‑paragraph brief that lists denominators, bands, any runs, and the implications (what you would do—pause or continue—with a clear note that this is a student brief, not a production verdict).
- Log an audit line per minute:
{'window': k, 'e': e, 'N': N, 'p_hat': 0.0xx, 'band': 'G/Y/R', 'wilson': [lo, hi]}.
9.0 Worked Pattern (Without Making the Call)
Below is a pattern you may follow in your notebook. It shows how to compute and present the numbers while leaving the final verdict to the instructor solution.
9.1 Compute proportions
For each window, compute p̂ and multiply by 100 for a percent (display only). Keep full‑precision p̂ for comparisons to thresholds.
| Window | Errors e | Denominator N | p̂ = e/N | p̂ (%) | Band | Run length |
|---|---|---|---|---|---|---|
| W1 | 310 | 12,000 | 0.02583 | 2.58% | Green | 0 |
| W2 | 325 | 12,000 | 0.02708 | 2.71% | Green | 0 |
| W3 | 315 | 12,000 | 0.02625 | 2.63% | Green | 0 |
| W4 | 320 | 12,000 | 0.02667 | 2.67% | Green | 0 |
| W5 | 910 | 12,000 | 0.07583 | 7.58% | Red | 1 |
| W6 | 945 | 12,000 | 0.07875 | 7.88% | Red | 2 |
| W7 | 930 | 12,000 | 0.07750 | 7.75% | Red | 3 |
| W8 | 340 | 12,000 | 0.02833 | 2.83% | Green | 0 |
| W9 | 335 | 12,000 | 0.02792 | 2.79% | Green | 0 |
| W10 | 332 | 12,000 | 0.02767 | 2.77% | Green | 0 |
9.2 Add intervals for context
Optionally, compute Wilson 95% intervals for each p̂. Use the formula in §5.3 or a helper function. Intervals make it obvious when a minute sits comfortably above (or below) a band edge and provide a numeric story for your brief.
9.3 Draft your brief (no verdict)
Counts: all windows N=12,000; errors e=[310, 325, 315, 320, 910, 945, 930, 340, 335, 332]. QBER: p̂[%]=[2.58, 2.71, 2.63, 2.67, 7.58, 7.88, 7.75, 2.83, 2.79, 2.77]. Coloring: G,G,G,G,R,R,R,G,G,G. Intervals: (optional) 95% Wilson around each p̂. Comparison: state whether any run of three reds exists and note the band edges; do not state the final operational call in the student edition.
10.0 Sanity Checks & Edge Cases
- Single spikes. One red can be a sneeze; runs indicate persistence.
- Denominator drift. If N varies by window, report it next to p̂ and comment on uncertainty.
- Seasonal effects. Harbor segments often show diurnal patterns; exporting the strip with timestamps helps auditors match wind logs.
- Counter faults. A stuck error counter can depress p̂; corroborate with other telemetry if a long green flatline looks “too perfect.”
- Policy versioning. Note the band document and revision date in your brief; do not improvise thresholds.
11.0 What‑If Analysis (Sensitivity Thought Experiments)
Thinking in “what‑ifs” builds judgment. For each scenario below, recompute p̂ or intervals and describe how your brief would change.
| Scenario | How to think about it |
|---|---|
| Denominator halves to 6,000 | p̂ stays the same; SE doubles; Wilson intervals widen. You would emphasize uncertainty but keep the same coloring if p̂ is far from edges. |
| Bands tightened (red > 6.5%) | More minutes color red; runs appear sooner. You would note the policy change and its effect on action sensitivity. |
| Only W6 is red (W5/W7 yellow) | No run of three; you would annotate the blip but refrain from escalation in the student brief. |
| Maintenance marker at W5 | Intervals may still be above 7%. You would document the marker and explain whether that context alters an ops decision (instructor solution handles the call). |
| Green recovery persists for 30 minutes | Stability argues for resuming normal operations after checks. In a student brief, you’d describe the clean run without issuing the release. |
12.0 Reporting Template (Copy/Paste)
Counts: N=…, errors e=[…]. QBER: p̂[%]=[…]. Intervals (95% Wilson): […]. Coloring: […]. Run check: max run of reds = …. Student brief: One sentence that states the comparisons (p̂ vs 3.5%/7.0%; presence/absence of a 3‑red run) and refers to policy bands by revision number. Do not declare PASS/QUARANTINE in the student edition.
13.0 Notebook Pattern (Minimal, Reproducible)
- Read the ten (N,e) pairs into arrays.
- Compute p̂ for each minute and percentages for display.
- (Optional) Compute Wilson intervals with a helper
wilson(p_hat, n, z=1.96). - Color by bands and track a
red_runcounter. - Print the audit line per minute and the final student brief (no verdict).
14.0 Educational Takeaway
This splash lab is intentionally compact, but the habits it trains are universal: show denominators, use confidence language, separate policy from analysis, and brief in one line. Those habits travel with you to harder problems: timing skew, basis bias, guardband probes, and decoy‑state estimation. Mastering them is what turns a bright student into a dependable night‑shift analyst.
15.0 Field Casebook (Patterns You Will See)
15.1 Harbor Gusts (benign, repeatable)
Coastal spurs breathe with the weather. A late squall arrives; wind rises over 20 knots; a crane turns; trays sing. QBER jumps a few points for a minute or two, then falls. On a long strip, you see green, yellow, a red or two, then green. Intervals straddle thresholds. The run rule ignores the episode, but you still annotate it: “gust‑linked blips.” Learning: not every peak is a plot twist. Many are weather.
15.2 HVAC Steps (diurnal rhythm)
Big buildings breathe too. Industrial cooling plants kick on after the night setback; racks expel hot air into cold mornings; thermal expansion nudges alignments. The signature: A slow rise in QBER around the same time each day, rarely red, often yellow. A plot over weeks shows a comb‑tooth fringe aligned to time of day. Your brief nods to the rhythm but stays in policy: “no run of reds; monitor.” A ticket requesting HVAC coordination turns anecdotes into engineering, and sometimes brings a small miracle: a fan replaced, a duct redirected, a flat strip.
15.3 Maintenance Pings (documented, sharp)
When a maintenance laser fires down a tray for tracing, QBER can spike red for a minute. The crucial difference from gusts is context: maintenance was booked, a change record exists, and instrumentation can link the moment to the pulse. Here your student brief models restraint: describe the spike, cite the record, and avoid inflating language. If the run rule triggers because of three consecutive maintenance minutes, the instructor’s call may still quarantine temporarily, but the narrative in the ticket will read, “documented maintenance; expected elevation; resuming after checks.”
15.4 Adversarial Bright‑Light Probe (rare, structured)
In training datasets, you sometimes see a plateau of elevated QBER that correlates with other telltales: power‑tap asymmetry, polarization rotation abnormalities, or timing skew at odd hours. The signature differs from gusts: intervals sit cleanly in red, denominators are steady, and there may be harmonics in side metrics. As a student you still do the same thing—compute, color, check the run—but you also learn to write neutrally: “sustained elevation; corroborations pending.” This neutrality keeps your analysis useful even if forensics later find a benign cause (mis‑patched optics) or a genuine attempt to pry.
15.5 Fiber Moves (human factors)
A relocation team enters a tray farm; jumpers move; labels lag reality. QBER might drift over tens of minutes and then settle at a new level. The run detector may or may not fire, but your discipline does not change: fractions, intervals, bands, runs, and a short note: “relabeling, light moved; watchlist.” Mature programs pair such notes with weekly audits of label hygiene. You cannot fix every human factor, but you can teach yourself to spot their fingerprints without drama.
16.0 Mathematical Appendix (Deeper Dive for the Curious)
The QBER estimator for a single minute is a binomial proportion with denominator N and parameter p (the “true” but unknown error probability in that minute). The point estimate p̂ is unbiased and has variance p(1−p)/N. Because p is unknown, we plug in p̂ to approximate the standard error. That normal approximation behaves well when N is large and p is not too close to 0 or 1. At N=12,000 and p around 0.03–0.08, it is excellent. Why, then, do we recommend the Wilson interval? Because it handles edge cases gracefully and, unlike the naïve p̂±1.96·SE band, it never produces limits below 0 or above 1. Wilson also recenters the interval to account for finite‑sample bias of the normal method, leading to better coverage—the fraction of times the interval actually contains the truth.
If you want an intuition for the algebra without memorizing it: start from the score test for the binomial. The score statistic compares p̂ to a hypothesized p0 using the binomial standard error evaluated at p0. Solving the inequality |score| ≤ z for p0 yields exactly the Wilson interval. That is why the Wilson band has the same spirit as a test: it includes exactly those p0 values that would not be rejected at level 5%. If this paragraph felt fast, that’s fine—the lab does not require it—but it tells you the method has a backbone, not just a heuristic.
Another useful lens is effect size. Suppose policy changes the red line from 7% to 6.5%. With N=12,000, the binomial SE at 7% is √(0.07·0.93/12000) ≈ 0.00233 (0.233 percentage points). A minute at 7.75% is roughly (7.75−7.00)/0.233 ≈ 3.2 SE above the 7% line and (7.75−6.5)/0.236 ≈ 5.3 SE above a 6.5% line—both clearly red. Thinking in SEs protects you from arguments about tiny changes to bands: if the SEs are large, small tweaks to thresholds will not flip your coloring; if SEs are small, even a tenth of a percent may be meaningful.
You may also hear about “exact” (Clopper–Pearson) intervals. They invert the binomial test using the discrete distribution and guarantee at least nominal coverage. The price is conservatism: intervals can be wider than they need to be, especially at moderate denominators. For dashboards and quick briefs, Wilson is a balanced default. In forensic reports or when denominators are tiny (say, a hardware fault drops a minute to a few hundred sifted bits), an exact interval can be part of a cautious analysis.
Finally, a Bayesian aside: if you place a Beta(α,β) prior on p, observing e errors in N trials yields a Beta(α+e, β+N−e) posterior. The center of mass is (α+e)/(α+β+N), which with a flat prior (α=β=1) equals (1+e)/(2+N)—a smoothed version of p̂. Posterior credible intervals are then straightforward to compute. Bayesian intervals and Wilson often agree numerically at these denominators. What matters operationally is that you choose one method in policy and stick to it; mixing methods mid‑incident breeds confusion.
17.0 Glossary & Abbreviations (Student Quick Reference)
- QBER — Quantum bit‑error rate; disagreements divided by sifted bits in a window.
- Sifted bits (N) — Bits kept after Alice and Bob reveal and discard measurements taken in different bases.
- Error count (e) — Number of sifted bits that disagree in a window.
- Window — A fixed time bucket (here 60 s) over which counts are tallied.
- Band — Policy color for p̂%: green ≤ 3.5; yellow 3.5–7.0; red > 7.0.
- Run — Number of consecutive red windows; the rule fires at run ≥ 3.
- SE — Standard error; the sampling spread of an estimator.
- Wilson interval — A binomial proportion confidence interval with good finite‑sample properties.
- Commissioning document — The signed policy that defines bands, runs, and procedures for a spur.
- Quarantine — Pause in key usage for a path while diagnostics run; not an accusation, a safety valve.
- Lighthouse — Health daemon in the scenario that packages counts and guides triage.
18.0 Practice Drills & Reflections (Optional, For Mastery)
- Drill A—Explain it to a manager. In 60 words, write a paragraph that explains why runs, not single minutes, drive quarantines. Avoid jargon. Trade places with a classmate and see if your explanations match.
- Drill B—Effect of denominators. Recompute the Wilson interval for W5 if N=6,000 and again if N=24,000. What changes? How would your brief differ in caution or confidence?
- Drill C—Alternate bands. Suppose a policy revision sets yellow at 3.0–6.5 and red at >6.5. Recolor the strip. Did the run logic change? Would the operations decision change? Write a note explaining why or why not.
- Drill D—Plot with denominators. Produce a two‑panel plot: p̂% with bands on top, denominators below. Annotate any windows with maintenance markers. Export the figure as an audit artifact.
- Reflection—Ethics and tone. Read your brief aloud. Does it accuse a person or describe a pattern? Edit toward neutrality and clarity.
References
Agresti, A., & Coull, B. A. (1998). Approximate is better than “exact” for interval estimation of binomial proportions. The American Statistician, 52(2), 119–126. https://doi.org/10.1080/00031305.1998.10480550
Bennett, C. H., & Brassard, G. (1984). Quantum cryptography: Public key distribution and coin tossing. In Proceedings of the IEEE International Conference on Computers, Systems, and Signal Processing (pp. 175–179). IEEE. https://arxiv.org/abs/2003.06557
Brown, L. D., Cai, T. T., & DasGupta, A. (2001). Interval estimation for a binomial proportion. Statistical Science, 16(2), 101–133. https://doi.org/10.1214/ss/1009213286
Nielsen, M. A., & Chuang, I. L. (2010). Quantum computation and quantum information (10th anniversary ed.). Cambridge University Press. https://doi.org/10.1017/CBO9780511976663
Scarani, V., Bechmann‑Pasquinucci, H., Cerf, N. J., Dušek, M., Lütkenhaus, N., & Peev, M. (2009). The security of practical quantum key distribution. Reviews of Modern Physics, 81(3), 1301–1350. https://doi.org/10.1103/RevModPhys.81.1301
Wald, A. (1945). Sequential tests of statistical hypotheses. Annals of Mathematical Statistics, 16(2), 117–186. https://doi.org/10.1214/aoms/1177731118
Solution
I‑06 — Solution: QBER Triage for the Bank’s North Spur
Goal. Given ten 60‑second windows of sifted bits and errors for one QKD spur, make a simple, defensible PASS/QUARANTINE decision any analyst can execute quickly and justify.
What you’re deciding (in one sentence)
Given ten one‑minute windows of sifted bits \(N\) and error counts \(e\) from the north spur of the bank’s QKD ring, decide whether to PASS (continue using keys) or QUARANTINE (pause key use on this spur) using a simple, defensible rule: three consecutive red windows ⇒ QUARANTINE.
A. Quick model recap (more detail)
1) QBER is the one number you need.
For a 60‑second window the quantum bit error rate is the fraction of disagreements: \[ \hat p \;=\; \frac{e}{N}. \] It rises if the channel jitters (alignment/temperature/vibration), detectors misbehave (dark counts/afterpulsing), or an adversary perturbs signals (intercept‑resend, bright‑light tricks, timing games).
2) Windows are samples, not truth.
If you re‑ran the same minute, you’d get slightly different \(e\) and thus a slightly different \(\hat p\). Attach a 95% Wilson interval to each \(\hat p\) to show a plausible range for the “true” error rate in that minute:
\[ \hat p_{\mathrm{lo,hi}} = \frac{\hat p + \frac{z^2}{2N} \;\pm\; z\sqrt{\frac{\hat p(1-\hat p)}{N} + \frac{z^2}{4N^2}}}{\,1+\frac{z^2}{N}\,},\qquad z=1.96. \]
You don’t have to memorize the algebra—your script computes it. Intuition: if the whole interval is above the red line, that minute is very likely truly “red,” not a fluke.
3) Operational thresholds (triage bands).
- Green: \(\mathrm{QBER}\le 3.5\%\) (normal overnight behavior on this spur).
- Yellow: \(3.5\% < \mathrm{QBER} \le 7.0\%\) (watch closely).
- Red: \(\mathrm{QBER}>7.0\%\). One red can be a blip; three in a row means sustained elevation ⇒ QUARANTINE.
4) Why “three reds in a row”?
Single minutes spike (wind shakes a pole; a ferry horn nudges a rack). A run of three indicates a persistent condition that degrades key quality and is consistent with probing or mis‑alignment. The rule is intentionally conservative so a tired analyst can execute it quickly and defend the choice.
B. Step‑by‑step triage (operator playbook)
Inputs
- Ten consecutive windows \((N,e)\) for the north spur (oldest → newest).
- Window size: 60 s.
- Bands: Green \(\le 3.5\%\), Yellow \(3.5\%\ldots 7.0\%\), Red \(>7.0\%\).
Procedure
- Compute QBER for each window: \(\hat p=e/N\). Record as a percentage with two decimals.
- (Optional but recommended) Compute Wilson 95% intervals to gauge certainty.
- Color each window (Green/Yellow/Red) using the bands above.
- Scan for three Reds in a row. Maintain a running counter; reset the counter if a non‑red appears.
- Decide: If any run of length 3 occurs, QUARANTINE. Otherwise PASS, but annotate if any Yellow/Red was seen.
Outputs
- A 10‑line table of QBERs (and intervals, if computed).
- A one‑paragraph ticket rationale in plain English.
- The final call: PASS or QUARANTINE.
C. Worked example (with your dataset)
Errors \(e=\)[310, 325, 315, 320, 910, 945, 930, 340, 335, 332].
Compute \(\hat p=e/N\) and multiply by 100 for a %. Compare to bands; keep a “red‑run” counter. You’ll see a quiet start, a 3‑minute red plateau, then recovery—exactly the kind of pattern we want the rule to catch.
D. Implementation notes (for the student notebook that accompanies this solution)
- Clarity over cleverness. Keep the code explicit: compute percentages, then a separate pass to color/flag.
- Numerics. Use floats and round to two decimals for display; keep full precision for the rule.
- Intervals. A tiny function wilson(p_hat, N, z=1.96) keeps the statistics self‑contained.
- Plots (optional). A line plot of QBER with shaded green/yellow/red bands helps “see” the event.
E. Operator checklist (what you’d literally do at 02:41)
- Pull the last ten 60‑s windows.
- Compute QBERs and colors.
- If three reds in a row, QUARANTINE and open a ticket.
- Route traffic via cached keys/alternate spurs (automated).
- Ask field ops to inspect the windy harbor trays; correlate with wind/temperature logs; resume after a clean, stable run.
F. Fully worked numbers (added section)
Idea first: We’re just counting how often bits disagree. That fraction is the error rate (QBER). If it’s high and stays high, we don’t trust keys from that path right now.
1) Compute QBER for each window
\(\hat p=e/N\).
W1: \(310/12000=0.02583 \Rightarrow 2.58\%\) (Green).
W2: \(325/12000=2.71\%\) (Green).
W3: \(315/12000=2.63\%\) (Green).
W4: \(320/12000=2.67\%\) (Green).
W5: \(910/12000=7.58\%\) (Red).
W6: \(945/12000=7.88\%\) (Red).
W7: \(930/12000=7.75\%\) (Red).
W8: \(340/12000=2.83\%\) (Green).
W9: \(335/12000=2.79\%\) (Green).
W10: \(332/12000=2.77\%\) (Green).
Colors in order: G, G, G, G, R, R, R, G, G, G.
2) (Optional) Confidence interval to see how “sure” we are
Take Window 5 as an example: \(\hat p=0.0758\), \(N=12{,}000\), \(z=1.96\). Wilson 95% interval \(\approx[7.08\%,\,8.12\%]\). Because the entire interval is above the 7.0% red threshold, W5 is very likely truly red. Windows 6–7 behave similarly.
3) Apply the “three reds in a row” rule
We have three consecutive Reds at windows 5–6–7. That triggers QUARANTINE. Even though 8–10 return to green, the correct action is to pause key usage on this spur now, raise an alert, and let operations check optics, weather racks, and recent changes.
4) One‑paragraph rationale (what goes in the ticket)
Decision: QUARANTINE. QBER on the north spur exceeded the red threshold (7.0%) for three consecutive one‑minute windows (7.58%, 7.88%, 7.75%), which by policy indicates sustained degradation or probing. 95% Wilson intervals for the red minutes sit above 7%, supporting that the elevation is not sampling noise. Keys from this spur are paused; traffic continues via alternate paths. Recommend on‑site check of waterfront trays/patches and correlation with wind sensor logs.
5) Why this is safe and sensible
- One red can be a sneeze; three in a row is a pattern.
- The rule is simple enough to run at 3 a.m. and strong enough to keep degraded keys out of VPNs.
- When the link recovers (as in windows 8–10), ops can clear quarantine after inspection and a clean 10–15‑minute green run.
Instructor Edition
QBER Triage for the Bank’s North Spur
1.0 Historical Background & Conceptual Deep Dive
Quantum key distribution (QKD) lives at an unusual intersection: physics that promises provable secrecy and operational realities that must route keys under pressure at 02:41 in the morning. At that intersection, the most actionable statistic is the quantum bit‑error rate (QBER)—the fraction of sifted bits that disagree between the two ends of a link. QBER is not just a generic quality score. It is a composite health indicator that responds to alignment drift, detector behavior, temperature and vibration, and to adversarial mischief, while being simple enough for analysts to compute and brief in a few lines. The enduring lesson from two decades of fielded systems is this: the most robust operations playbooks reduce to counting rules that can be audited, not black‑box models that are hard to defend when things go wrong.
In early BB84 trials, small teams would inspect long time series of QBER, squint at the pattern, and decide. That did not scale, nor did it handle fatigue. Modern operations specify thresholds and windowed statistics in policy. A minute‑scale window offers a pragmatic trade: enough counts for stable estimates; short enough to be responsive. Because each minute is only a sample, not an oracle, the statistical discipline is to accompany the observed fraction with an uncertainty band (a confidence interval) and to look for runs rather than single spikes. The run length matters because random blips are common—wind shakes a pole; a ferry horn nudges a rack; a scheduled scan pulses a maintenance laser. Consecutive minutes beyond the red line point to sustained conditions, whether mis‑alignment or probing.
The splash‑lab you are holding distills that operational wisdom into one small, teachable path. Students compute QBER in ten consecutive one‑minute windows; color them using three policy bands (green/yellow/red); then scan for a run of three reds. The instructor solution you are about to read expands that into a fully auditable chapter you can brief to a skeptical executive: careful definitions, reduced fractions and decimals, uncertainty quantification, and a crisp, console‑ready call (PASS or QUARANTINE) with actions. The tone is deliberately practical: this is not a proof of security, it is a safety valve that keeps degraded keys out of production while the team investigates.
Why do we emphasize proportions and intervals? Because proportions are the natural language of errors, and intervals discipline our storytelling. For a binomial proportion with probability p and denominator n, the sampling spread scales like √(p(1−p)/n), so doubling the denominator roughly halves the standard error as long as p is stable. This gives operations a quantitative handle: at 12,000 sifted bits per minute (our dataset), even a two‑point rise in QBER is many standard errors and thus not a fluke. For added stability, we recommend the Wilson interval, which behaves better than the naïve normal interval when proportions are near 0 or 1 or when denominators vary.
Thresholds are a policy artifact. They must be set in commissioning documents, with rationales. For a bank’s overnight spur that has lived quietly for months, “green ≤ 3.5%, yellow 3.5–7.0%, red > 7.0%” is a plausible triage band. The absolute numbers are less important than the discipline: do not move gates in the heat of a shift; if the environment changes materially, revise the policy in daylight with version control and a short memo. Students will see that the three‑red rule acts like an integrator that ignores single blips, while politely forcing action on sustained elevation. When we quarantine, we are not accusing anyone of malice; we are protecting key material until optics, weather, racks, and recent changes can be inspected.
The specific scenario—“north spur” of a bank’s QKD ring—was chosen because it resembles real deployments: multiple spurs feeding a hub, diverse environments (harbor, urban canyon, hills), and the need to route around trouble without interrupting business. The test data intentionally include a three‑minute red plateau nestled within a green run; this lets you teach why runs are meaningful and why “back to green” does not retroactively absolve minutes that were genuinely bad. It also lets you model ticket hygiene: how to state the decision in one paragraph an auditor can read without the notebook.
As an instructor, you should also emphasize denominator hygiene. Analysts sometimes compare raw error counts across windows; that is misleading when denominators vary, which they do in the wild. Always normalize to a fraction and show both the reduced fraction and the decimal. Publish the denominators alongside your bars. Doing so inoculates the team against “percentage float,” a pernicious habit in incident reports that confuses levels with counts.
Finally, a word on scope. QBER triage does not accuse; it triages. It gets bad windows out of the key pool quickly and buys time for deeper diagnostics that may point to mis‑alignment, weather, or probing. That layered approach—simple screeners at the front, rich forensics at the back—keeps systems both accountable and resilient. The rest of this chapter walks through the numbers and the call with enough detail to grade rigorously and to teach young analysts how to brief with confidence.
2.0 Executive Summary
We compute minute‑scale QBER for ten windows on the bank’s north spur, color each window using policy bands (≤3.5% green, 3.5–7.0% yellow, >7.0% red), and scan for a run of three reds. Using the provided counts (12,000 sifted bits per minute; errors [310, 325, 315, 320, 910, 945, 930, 340, 335, 332]), we obtain a three‑minute red plateau (windows 5–7) bounded by green. Wilson intervals around each estimate place the red windows safely above 7%. Per policy, three consecutive reds ⇒ QUARANTINE. We pause key use from this spur, route traffic via cached keys/alternate paths, and open a ticket requesting inspection of waterfront trays, weather racks, and recent changes. The call is numerically defensible, simple enough to run at a bad hour, and conservative in that it requires a sustained pattern, not a single blip.
3.0 Learning Objectives
- Compute QBER per window with careful denominators; publish both the reduced fraction and the decimal percentage.
- Attach a Wilson 95% confidence interval (and understand why Wilson behaves better than the naïve normal band in practice).
- Apply triage bands consistently; implement a three‑red run detector; and explain why runs, not single spikes, drive decisions.
- Draft a one‑paragraph ticket rationale that a non‑specialist can read; include denominators, bands, and the run logic.
- Describe immediate operational actions and optional corroborations (logs, weather, alignment) that follow from the call.
4.0 Givens, Model, and Decision Rule
Each window delivers a denominator N and an error count e. The minute’s QBER estimate is:
To quantify uncertainty we attach a 95% Wilson interval for a binomial proportion:
Policy bands (example). Green ≤ 3.5%; Yellow 3.5–7.0%; Red > 7.0%. Decision rule. If any run of length three (red, red, red) appears in the ten‑minute strip, declare QUARANTINE; otherwise PASS and annotate any yellow/red minutes for watchlists.
5.0 Step‑by‑Step Computation (with the Provided Dataset)
The bank has supplied ten one‑minute windows, each with N=12,000 sifted bits. Errors are e = [310, 325, 315, 320, 910, 945, 930, 340, 335, 332]. We compute QBER as e/N and multiply by 100 to present percentages with two decimals for display (retain full precision internally for rules).
| Window | Errors e | Denominator N | QBER p̂ (fraction) | QBER (%) | Band |
|---|---|---|---|---|---|
| W1 | 310 | 12,000 | 0.02583 | 2.58% | Green |
| W2 | 325 | 12,000 | 0.02708 | 2.71% | Green |
| W3 | 315 | 12,000 | 0.02625 | 2.63% | Green |
| W4 | 320 | 12,000 | 0.02667 | 2.67% | Green |
| W5 | 910 | 12,000 | 0.07583 | 7.58% | Red |
| W6 | 945 | 12,000 | 0.07875 | 7.88% | Red |
| W7 | 930 | 12,000 | 0.07750 | 7.75% | Red |
| W8 | 340 | 12,000 | 0.02833 | 2.83% | Green |
| W9 | 335 | 12,000 | 0.02792 | 2.79% | Green |
| W10 | 332 | 12,000 | 0.02767 | 2.77% | Green |
Add Wilson intervals to gauge certainty. For W5 (p̂≈0.07583, n=12,000), the 95% Wilson interval is approximately [0.0708, 0.0812] (7.08%–8.12%); W6 and W7 yield similar bands entirely above 7%. For a quick cross‑check, the simpler normal interval p̂ ± 1.96√(p̂(1−p̂)/n) gives a slightly narrower but consistent band; Wilson is preferred in production because it behaves well across regimes.
5.1 Run detection
Scan the banded series from oldest to newest and maintain a counter of consecutive reds. Increment on red; reset on any non‑red. At W5 the counter becomes 1; at W6 it becomes 2; at W7 it becomes 3—threshold met. Even though the series returns to green at W8–W10, the three‑red run indicates a sustained condition and triggers the quarantine action. The operator’s mental model should be “a sneeze versus a pattern”: one red can be a sneeze; three in a row is a pattern.
5.2 Ticket rationale (what goes in the record)
Decision: QUARANTINE. Why: W5–W7 exceed the red threshold; 95% Wilson intervals sit above 7%, so the elevation is not sampling noise. Action: Pause keys on this spur; route traffic via cached keys or alternate spurs; open a ticket; request inspection of waterfront trays, weather racks, and recent changes. Recovery: After a clean 10–15‑minute green run and checks, release quarantine.
6.0 Hypothesis Tests and Uncertainty (Audit‑Ready)
Some teams prefer an explicit hypothesis test to accompany the colored bands. For a single window with denominator n and observed p̂, the null “green” hypothesis can be phrased as p ≤ 0.035 and the “red” hypothesis as p ≥ 0.070. In practice we simply check whether the 95% Wilson interval lies entirely above 0.07; if so, red is not a sampling fluke. If you prefer a z‑score against an operational target pt, compute:
For W5 with pt=0.07, the z–value is roughly (0.07583−0.07)/√(0.07·0.93/12000) ≈ 4.17, well beyond 1.96. The point is not to split hairs about a tenth of a percent; it is to show that at these denominators a seven‑to‑eight percent QBER is unambiguously red.
When denominators vary by window, intervals and z‑scores will reflect that. This is another reason to display denominators alongside percentages in dashboards and tickets.
7.0 Briefable Decision (Console‑Ready)
Numbers: p̂[%]=[2.58, 2.71, 2.63, 2.67, 7.58, 7.88, 7.75, 2.83, 2.79, 2.77]; red run at W5–W7; 95% Wilson CIs for W5–W7 above 7%. Policy: Green ≤3.5%; Yellow 3.5–7.0%; Red >7.0%; three consecutive reds ⇒ quarantine. Call: QUARANTINE. Action: Pause keys on north spur; route via cached keys/alternates; ticket + inspection of trays/weather/racks; release after clean green run.
8.0 Sanity Checks, Edge Cases, and Pitfalls
- Single spikes. One red can be a sneeze; your rule intentionally ignores it. Runs matter.
- Drifting denominators. If N drops by half, the same error count implies a higher QBER and a larger standard error. Plot N next to p̂.
- Threshold drift. Never adjust triage bands mid‑incident. Revise policy later with version control and a short rationale.
- Multiple comparisons. If you scan dozens of windows or many spurs, track your false‑alarm budget explicitly.
- Quiet failures. A stuck counter or desynchronization can suppress errors; corroborate with auxiliary metrics when behavior looks “too good.”
- Seasonality. Harbor links often show diurnal patterns. Keep commissioning baselines per spur and per season.
- Interpretation creep. QBER is agnostic to cause. After quarantine, run a playbook: optics check, weather cross‑correlation, recent changes, and logs.
- Visualization bias. Color maps are persuasive; pair them with numbers and denominators so analysts can defend decisions in text.
- Unequal windows. If windows differ in length, normalize both counts and bands appropriately or resample to a common cadence.
- Policy asymmetry. You can require fewer reds to resume than to quarantine. Write that asymmetry down so it is enforceable.
9.0 What‑Ifs (Sensitivity & Scenario Variations)
| Scenario | Effect on numbers | Likely outcome | Instructor talking point |
|---|---|---|---|
| Denominator halves to 6,000 for all windows | SE doubles; Wilson bands widen; p̂ unchanged | Red run remains but CIs broaden; still quarantine | Denominators change confidence, not point estimates—show both. |
| Bands tightened (red > 6.5%) | More windows flagged red; run may lengthen | Quarantine sooner | Policy sensitivity—justify bands in commissioning. |
| Only W6 is red; W5 and W7 yellow | Run length < 3 | PASS with annotation | Rule resists single blips; schedule investigation but keep keys. |
| Red windows coincide with known maintenance | Ancillary logs show activity | Quarantine may be waived with documentation | Change‑control hooks should auto‑annotate windows. |
| Green recovery persists for 30 minutes | Stable p̂ ≈ 2.6–2.9% | Release quarantine after checks | Require a clean run before resuming keys. |
10.0 Grading Rubric (10 points)
- (3) Correct QBER computations with denominators and two‑decimal percentages; present a 10‑row table.
- (2) Correct Wilson 95% intervals for W5–W7; intervals entirely above 7% are identified.
- (2) Proper application of triage bands and three‑red run detection; decision consistent with policy.
- (1) Clean, one‑paragraph ticket rationale with actions and watchlist notes.
- (2) Clarity: reduced fractions + decimals; denominators shown; no hidden steps.
11.0 Fully Worked Arithmetic (Answer Key)
QBER per window. W1: 310/12000 = 0.02583 = 2.58% (Green). W2: 325/12000 = 0.02708 = 2.71% (Green). W3: 315/12000 = 0.02625 = 2.63% (Green). W4: 320/12000 = 0.02667 = 2.67% (Green). W5: 910/12000 = 0.07583 = 7.58% (Red). W6: 945/12000 = 0.07875 = 7.88% (Red). W7: 930/12000 = 0.07750 = 7.75% (Red). W8: 340/12000 = 0.02833 = 2.83% (Green). W9: 335/12000 = 0.02792 = 2.79% (Green). W10: 332/12000 = 0.02767 = 2.77% (Green).
Wilson 95% intervals. Using z=1.96 and n=12,000: W5: center ≈ 0.0758; interval ≈ [0.0708, 0.0812] → [7.08%, 8.12%]. W6: p̂=0.0788 → Wilson ≈ [0.0738, 0.0839]. W7: p̂=0.0775 → Wilson ≈ [0.0726, 0.0824]. Green windows sit far below 7%.
Run logic. Reds at W5–W7 create a run of length 3 ⇒ QUARANTINE. Even with recovery at W8–W10, the earlier run stands; keys from those minutes are quarantined.
12.0 Implementation Quality (Autograders & Dashboards)
- Print an audit line per run:
{'window': k, 'e': e, 'N': N, 'p_hat': 0.0xx, 'band': 'G/Y/R', 'wilson': [lo, hi]}. - Keep reduced fractions in the table (e/N) and three‑place decimals internally; avoid premature rounding in logic.
- Store the policy (bands, run length) with a configuration hash; emit the hash in the audit line.
- Optional: line plot of p̂ with shaded bands; annotate the three‑red segment; include denominators as a second panel.
- Regression tests: feed historical telemetry into the same code and verify that known red episodes reproduce the quarantine call.
13.0 Alignment with the Student Notebook
The student notebook accompanying this splash lab mirrors the flow: compute p̂ per minute, place Wilson bands, color by policy, detect runs, and draft the one‑paragraph brief. Your grading key here uses the same denominators and thresholds to avoid off‑by‑policy errors. Encourage students to print both reduced fractions and decimals; it trains denominator discipline and makes their plots briefable.
References
Agresti, A., & Coull, B. A. (1998). Approximate is better than “exact” for interval estimation of binomial proportions. The American Statistician, 52(2), 119–126. https://doi.org/10.1080/00031305.1998.10480550
Bennett, C. H., & Brassard, G. (1984). Quantum cryptography: Public key distribution and coin tossing. In Proceedings of the IEEE International Conference on Computers, Systems, and Signal Processing (pp. 175–179). IEEE. https://arxiv.org/abs/2003.06557
Brown, L. D., Cai, T. T., & DasGupta, A. (2001). Interval estimation for a binomial proportion. Statistical Science, 16(2), 101–133. https://doi.org/10.1214/ss/1009213286
Nielsen, M. A., & Chuang, I. L. (2010). Quantum computation and quantum information (10th anniversary ed.). Cambridge University Press. https://doi.org/10.1017/CBO9780511976663
Scarani, V., Bechmann‑Pasquinucci, H., Cerf, N. J., Dušek, M., Lütkenhaus, N., & Peev, M. (2009). The security of practical quantum key distribution. Reviews of Modern Physics, 81(3), 1301–1350. https://doi.org/10.1103/RevModPhys.81.1301
Wald, A. (1945). Sequential tests of statistical hypotheses. Annals of Mathematical Statistics, 16(2), 117–186. https://doi.org/10.1214/aoms/1177731118
Lab
Intro — Bank QKD Triage — QBER Rule-of-Three¶
Objectives¶
- Compute QBER per one-minute window using inline math: ( e/N ).
- (Optional) Add a Wilson 95% confidence interval.
- Color each window using bands: Green ((≤) 3.5%), Yellow (3.5%–7.0%), Red (> 7.0%).
- Apply the rule: three Reds in a row ⇒ QUARANTINE; otherwise PASS.
Inputs¶
- Ten consecutive 60-second windows ((N, e)) for the bank's north spur (oldest → newest).
- Threshold bands: Green (≤) 3.5%, Yellow 3.5%–7.0%, Red > 7.0%.
- Rule: any run of 3 Red windows ⇒ QUARANTINE.
# ===== Your Code Starts Here =====
import math
import numpy as np
import pandas as pd
# Dataset (10 consecutive one-minute windows)
N_list = [12000] * 10
e_list = [310, 325, 315, 320, 910, 945, 930, 340, 335, 332]
def wilson_interval(e: int, N: int, z: float = 1.96):
"""Wilson score 95% interval for a proportion.
Returns (lo, hi) as fractions (0..1).
"""
p_hat = e / N
denom = 1 + (z**2) / N
center = p_hat + (z**2) / (2 * N)
spread = z * math.sqrt(p_hat * (1 - p_hat) / N + (z**2) / (4 * N**2))
lo = (center - spread) / denom
hi = (center + spread) / denom
return lo, hi
# Triage bands
GREEN_MAX = 0.035
RED_MIN = 0.070
rows = []
red_run = 0
max_red_run = 0
for i, (N, e) in enumerate(zip(N_list, e_list), start=1):
qber = e / N
lo, hi = wilson_interval(e, N)
if qber <= GREEN_MAX:
band = "Green"
red_run = 0
elif qber <= RED_MIN:
band = "Yellow"
red_run = 0
else:
band = "Red"
red_run += 1
max_red_run = max(max_red_run, red_run)
rows.append({
"Window": i,
"N": N,
"e": e,
"QBER_%": round(100 * qber, 2),
"Wilson_lo_%": round(100 * lo, 2),
"Wilson_hi_%": round(100 * hi, 2),
"Band": band,
"RedRun": red_run
})
df = pd.DataFrame(rows)
decision = "QUARANTINE" if max_red_run >= 3 else "PASS"
rationale = (
"Decision: {}. "
"Applied rule 'three Reds in a row ⇒ QUARANTINE'. Max red run = {}."
).format(decision, max_red_run)
print("QBER table (percent):\n")
print(df.to_string(index=False))
print("\n" + rationale)
# ===== Your Code Ends Here =====
Notes for the student¶
- QBER as a fraction is ( e/N ); in percent it is ( 100 \times (e/N) ).
- The Wilson interval helps separate true elevation from sampling jitter; we used (z=1.96) for 95%.
- The triage rule is conservative by design so a tired analyst can execute it quickly and defend the choice.
Ready to Start Your Quantum Journey?
Don’t just preview—unlock the full SpecterAI experience. Enroll today and gain access to our complete Quantum Computing curriculum with guided labs, real-world projects, and AI-powered support.
👉 Join now and take the first step into the future of computing.