mirror of
https://github.com/saymrwulf/QuantumLearning.git
synced 2026-07-20 19:12:38 +00:00
281 lines
12 KiB
Text
281 lines
12 KiB
Text
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Noise-Aware Verification and Mitigation Problems\n"
|
|
],
|
|
"id": "feee159a"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"These problems test whether your verification language has become sharp enough to survive small changes in wording and evidence context.\n"
|
|
],
|
|
"id": "abc59428"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## How To Use This Notebook\n",
|
|
"\n",
|
|
"\n",
|
|
" Prefer answers that separate mechanism, evidence, and conclusion. Reject answers that use the word noise or mitigation as if they explained themselves.\n"
|
|
],
|
|
"id": "3230e5b5"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from pathlib import Path\n",
|
|
"import sys\n",
|
|
"\n",
|
|
"project_root = Path.cwd().resolve()\n",
|
|
"while not (project_root / \"pyproject.toml\").exists():\n",
|
|
" if project_root.parent == project_root:\n",
|
|
" raise RuntimeError(\"Could not locate the project root from this notebook.\")\n",
|
|
" project_root = project_root.parent\n",
|
|
"\n",
|
|
"src_path = project_root / \"src\"\n",
|
|
"if str(src_path) not in sys.path:\n",
|
|
" sys.path.insert(0, str(src_path))\n"
|
|
],
|
|
"id": "3e7046de"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from quantum_learning import (\n",
|
|
" build_demo_noise_model,\n",
|
|
" counts_to_probabilities,\n",
|
|
" draw_circuit,\n",
|
|
" editable_circuit_lab,\n",
|
|
" evidence_checklist,\n",
|
|
" feedback_iteration_panel,\n",
|
|
" line_coupling_map,\n",
|
|
" load_assessment_blueprint,\n",
|
|
" plot_counts,\n",
|
|
" plot_probabilities,\n",
|
|
" quiz_block,\n",
|
|
" reflection_box,\n",
|
|
" rubric_scorecard,\n",
|
|
" simulate_counts,\n",
|
|
" statevector_probabilities,\n",
|
|
" step_reference_table,\n",
|
|
" transpile_summary,\n",
|
|
")\n",
|
|
"from qiskit import QuantumCircuit\n",
|
|
"from qiskit.providers.basic_provider import BasicSimulator\n"
|
|
],
|
|
"id": "2e8f1586"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Invariants\n",
|
|
"\n",
|
|
"Treat these questions as miniature review situations rather than as trivia. The correct answer should survive a serious engineering conversation.\n"
|
|
],
|
|
"id": "867166d5"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"quiz_block([{'prompt': 'Which invariant is useful for a Bell-style correctness check?', 'options': ['Support concentrated on correlated outcomes with limited imbalance between 00 and 11', 'Only total shot count', 'The number of markdown cells'], 'correct_index': 0, 'explanation': 'A good invariant captures the intended structure of the state.'}, {'prompt': \"Why is 'looks entangled' weak evidence?\", 'options': ['Because verification needs explicit criteria, not aesthetic impressions', 'Because entanglement can never be visualized', 'Because only hardware data matters'], 'correct_index': 0, 'explanation': 'A professional verifier states what will count as passing evidence.'}], heading='Invariants')\n"
|
|
],
|
|
"id": "c76c505a"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Bug Versus Noise\n",
|
|
"\n",
|
|
"Treat these questions as miniature review situations rather than as trivia. The correct answer should survive a serious engineering conversation.\n"
|
|
],
|
|
"id": "b11f4b35"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"quiz_block([{'prompt': 'What is the strongest sign that a result reflects a design bug rather than modest noise?', 'options': ['The ideal circuit already fails the intended invariant', 'The noisy histogram is not perfectly sharp', 'The transpiler changed gate names'], 'correct_index': 0, 'explanation': 'If the clean mechanism is broken, noise is not the primary story.'}, {'prompt': 'Why run both ideal and noisy variants of the same circuit?', 'options': ['To separate structural correctness from robustness', 'To avoid writing explanations', 'To guarantee mitigation works'], 'correct_index': 0, 'explanation': 'The comparison reveals which failure mode you are actually facing.'}], heading='Bug Versus Noise')\n"
|
|
],
|
|
"id": "0c3811de"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Mitigation Reasoning\n",
|
|
"\n",
|
|
"Treat these questions as miniature review situations rather than as trivia. The correct answer should survive a serious engineering conversation.\n"
|
|
],
|
|
"id": "39391e27"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"quiz_block([{'prompt': 'What is a strong mitigation sentence?', 'options': ['Postselection raised the correlated-support rate, which suggests leakage was a major issue, but it did not repair the underlying circuit if the ideal invariant already failed', 'Postselection fixed quantum computing', 'Filtering makes every circuit correct'], 'correct_index': 0, 'explanation': 'Mitigation claims should stay bounded and mechanism-aware.'}, {'prompt': 'Why keep mitigation local-first in this project?', 'options': ['Because diagnosis and repair habits should be learnable without cloud dependencies', 'Because real hardware never matters', 'Because noise cannot be simulated locally'], 'correct_index': 0, 'explanation': 'Local-first makes the reasoning loop short and reproducible.'}], heading='Mitigation Reasoning')\n"
|
|
],
|
|
"id": "31400172"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Review Language\n",
|
|
"\n",
|
|
"Treat these questions as miniature review situations rather than as trivia. The correct answer should survive a serious engineering conversation.\n"
|
|
],
|
|
"id": "f5bfa2b8"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"quiz_block([{'prompt': 'Which review note is strongest?', 'options': ['The notebook compares noisy data to no stated invariant, so the diagnosis is under-specified', 'The histogram is ugly', 'Please remove the baseline because it is redundant'], 'correct_index': 0, 'explanation': 'The real issue is the missing diagnostic standard.'}, {'prompt': 'What should support a final verification claim?', 'options': ['Ideal reference, noisy comparison, explicit invariant, and a reasoned distinction between defect and distortion', 'Only a single noisy run', 'Only intuition about what should happen'], 'correct_index': 0, 'explanation': 'Verification requires a multi-layer evidence chain.'}], heading='Review Language')\n"
|
|
],
|
|
"id": "673f3654"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Mini Case\n",
|
|
"\n",
|
|
"\n",
|
|
" Many weak notebooks reach for the word noise too quickly. Something went wrong, the histogram looks imperfect, therefore the explanation must be noise. That move is dangerous because it can hide design defects behind physical-sounding language. These problems are designed to slow you down and make you earn every diagnostic conclusion.\n"
|
|
],
|
|
"id": "68c8ba95"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## What These Questions Are Really Testing\n",
|
|
"\n",
|
|
"The multiple-choice format is only the surface. Underneath it, the notebook is testing whether you can preserve the right burdens while the wording shifts. If your understanding is strong, a changed phrase still points you back to the same structure, constraint, invariant, or recommendation logic. If your understanding is weak, the wording change will tempt you into vague or prestige-based answers. That is why these problem sets matter.\n"
|
|
],
|
|
"id": "992ecd47"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Common Failure Mode\n",
|
|
"\n",
|
|
"A common failure mode in advanced notebook work is broad correctness with local vagueness. A learner says something true at a high level, yet still fails to name what this particular workflow, redesign, diagnosis, or recommendation is actually doing. The problems notebook is meant to squeeze that vagueness out. It prefers circuit-specific or review-specific sentences over vague correctness.\n"
|
|
],
|
|
"id": "e62cbfe8"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Why Written Justification Matters\n",
|
|
"\n",
|
|
"The written prompts at the end of this notebook are not filler. They are where you prove that the right distinctions are surviving contact with your own prose. Multiple-choice blocks can tell you whether a distinction still feels recognizable. A written answer tells you whether you can actually deploy that distinction in a design note, verification memo, or review comment. Professional skill depends on that second ability.\n"
|
|
],
|
|
"id": "78179f06"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Written Checks\n",
|
|
"\n",
|
|
"Use the prompts below to practice full-sentence engineering judgement.\n"
|
|
],
|
|
"id": "1dfac3e9"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"reflection_box('Explain why a noisy result without an ideal comparison is diagnostically weak.')\n"
|
|
],
|
|
"id": "d81779e2"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"reflection_box('Describe one verification invariant you would want before trusting a more advanced circuit family.')\n"
|
|
],
|
|
"id": "f3a48d88"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"feedback_iteration_panel(title='Noise-Aware Verification and Mitigation Problem-Set Review Loop', prompt='After the quizzes, write the claim you now trust most, the evidence pattern behind it, the phrasing that still feels weak, and the next rewrite you owe yourself.')\n"
|
|
],
|
|
"id": "4635edc1"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"assessment_blueprint = load_assessment_blueprint()\n",
|
|
"rubric_scorecard(\n",
|
|
" assessment_blueprint.get_rubric('module_self_review'),\n",
|
|
" title='Noise-Aware Verification and Mitigation Problem Self-Grading',\n",
|
|
")\n"
|
|
],
|
|
"id": "f08e666f"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Exit Condition\n",
|
|
"\n",
|
|
"\n",
|
|
" Move on when you can write a short diagnosis that distinguishes defect, distortion, and bounded mitigation cleanly.\n"
|
|
],
|
|
"id": "8ea7b7bc"
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "QuantumLearning (.venv)",
|
|
"language": "python",
|
|
"name": "quantum-learning"
|
|
},
|
|
"language_info": {
|
|
"name": "python",
|
|
"version": "3.12"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|