mirror of
https://github.com/saymrwulf/NTT-learning.git
synced 2026-09-04 19:14:00 +00:00
152 lines
6.5 KiB
Text
152 lines
6.5 KiB
Text
|
|
{
|
||
|
|
"cells": [
|
||
|
|
{
|
||
|
|
"cell_type": "markdown",
|
||
|
|
"metadata": {
|
||
|
|
"pedagogy": {
|
||
|
|
"role": "meta",
|
||
|
|
"difficulty": 1,
|
||
|
|
"kind": "orientation",
|
||
|
|
"title": "Lab Goals"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"source": "## META | difficulty 1 | Lab Goals\n\nThe lab asks you to match output fingerprints to the underlying bug.\n"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "markdown",
|
||
|
|
"metadata": {
|
||
|
|
"pedagogy": {
|
||
|
|
"role": "mandatory",
|
||
|
|
"difficulty": 3,
|
||
|
|
"kind": "exercise",
|
||
|
|
"title": "Exercise 1"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"source": "## MANDATORY | difficulty 3 | Exercise 1\n\nBefore running the next cell, predict which of these bug labels goes with each fingerprint:\n\n- shuffled but otherwise familiar values\n- values that look uniformly too large\n- values broken already in a local stage pair\n"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": null,
|
||
|
|
"metadata": {
|
||
|
|
"pedagogy": {
|
||
|
|
"role": "mandatory",
|
||
|
|
"difficulty": 3,
|
||
|
|
"kind": "exercise",
|
||
|
|
"title": "Prediction Check"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"outputs": [],
|
||
|
|
"source": "# MANDATORY | difficulty 3 | Prediction Check\n\nfingerprints = {\n \"wrong_order\": \"shuffled but same value set\",\n \"missing_scale\": \"same shape but uniformly off by a factor\",\n \"wrong_zeta\": \"local pair outputs go bad immediately\",\n}\nprint(fingerprints)\n"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "markdown",
|
||
|
|
"metadata": {
|
||
|
|
"pedagogy": {
|
||
|
|
"role": "mandatory",
|
||
|
|
"difficulty": 3,
|
||
|
|
"kind": "exercise",
|
||
|
|
"title": "Exercise 2"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"source": "## MANDATORY | difficulty 3 | Exercise 2\n\nExplain why \u201calmost right\u201d is a useless debugging description unless you also specify whether the issue is:\n\n- sign\n- order\n- zeta\n- scaling\n"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": null,
|
||
|
|
"metadata": {
|
||
|
|
"pedagogy": {
|
||
|
|
"role": "mandatory",
|
||
|
|
"difficulty": 3,
|
||
|
|
"kind": "exercise",
|
||
|
|
"title": "A Small Debugging Drill"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"outputs": [],
|
||
|
|
"source": "# MANDATORY | difficulty 3 | A Small Debugging Drill\n\nfrom ntt_learning.toy_ntt import fast_intt_psi_gs_trace, fast_ntt_psi_ct_trace\n\nforward_trace = fast_ntt_psi_ct_trace([5, 6, 7, 8], 7681, 1925)\ninverse_trace = fast_intt_psi_gs_trace(forward_trace.raw_output, 7681, 1925)\n\nprint(\"forward BO output:\", forward_trace.raw_output)\nprint(\"forward NO output:\", forward_trace.normal_order_output)\nprint(\"inverse unscaled:\", inverse_trace.raw_output)\nprint(\"inverse scaled:\", inverse_trace.scaled_output)\n"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "markdown",
|
||
|
|
"metadata": {
|
||
|
|
"pedagogy": {
|
||
|
|
"role": "mandatory",
|
||
|
|
"difficulty": 2,
|
||
|
|
"kind": "reflection",
|
||
|
|
"title": "Reflection"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"source": "## MANDATORY | difficulty 2 | Reflection\n\nReflection prompt:\n\n- Which bug fingerprint feels easiest to recognize now?\n- Which one still needs more repetition?\n- What is your debugging order of operations now?\n"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": null,
|
||
|
|
"metadata": {
|
||
|
|
"pedagogy": {
|
||
|
|
"role": "facultative",
|
||
|
|
"difficulty": 4,
|
||
|
|
"kind": "exploration",
|
||
|
|
"title": "Optional: Build Your Own Fingerprint Table"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"outputs": [],
|
||
|
|
"source": "# FACULTATIVE | difficulty 4 | Optional: Build Your Own Fingerprint Table\n\nimport ipywidgets as widgets\nfrom IPython.display import display\n\ndef note_bug(mode=\"wrong_order\"):\n print({\"mode\": mode, \"what_to_check_first\": {\"wrong_order\": \"bit reversal\", \"missing_scale\": \"n^-1\", \"wrong_zeta\": \"local pair twiddle\", \"wrong_sign\": \"negacyclic fold sign\"}[mode]})\n\ndisplay(widgets.interact(note_bug, mode=[\"wrong_order\", \"missing_scale\", \"wrong_zeta\", \"wrong_sign\"]))\n"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "markdown",
|
||
|
|
"metadata": {
|
||
|
|
"pedagogy": {
|
||
|
|
"role": "meta",
|
||
|
|
"difficulty": 1,
|
||
|
|
"kind": "handoff",
|
||
|
|
"title": "Next Notebook"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"source": "## META | difficulty 1 | Next Notebook\n\nNext notebook: `problems.ipynb`\n"
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"metadata": {
|
||
|
|
"kernelspec": {
|
||
|
|
"display_name": "Python 3",
|
||
|
|
"language": "python",
|
||
|
|
"name": "python3"
|
||
|
|
},
|
||
|
|
"language_info": {
|
||
|
|
"name": "python"
|
||
|
|
},
|
||
|
|
"ntt_learning": {
|
||
|
|
"title": "Lab: Debugging NTT Failures",
|
||
|
|
"contract_version": "0.2",
|
||
|
|
"sequence": [
|
||
|
|
"notebooks/START_HERE.ipynb",
|
||
|
|
"notebooks/COURSE_BLUEPRINT.ipynb",
|
||
|
|
"notebooks/foundations/01_convolution_to_toy_ntt/lecture.ipynb",
|
||
|
|
"notebooks/foundations/01_convolution_to_toy_ntt/lab.ipynb",
|
||
|
|
"notebooks/foundations/01_convolution_to_toy_ntt/problems.ipynb",
|
||
|
|
"notebooks/foundations/01_convolution_to_toy_ntt/studio.ipynb",
|
||
|
|
"notebooks/foundations/02_negative_wrapped_ntt/lecture.ipynb",
|
||
|
|
"notebooks/foundations/02_negative_wrapped_ntt/lab.ipynb",
|
||
|
|
"notebooks/foundations/02_negative_wrapped_ntt/problems.ipynb",
|
||
|
|
"notebooks/foundations/02_negative_wrapped_ntt/studio.ipynb",
|
||
|
|
"notebooks/butterfly_mechanics/03_fast_forward_ct/lecture.ipynb",
|
||
|
|
"notebooks/butterfly_mechanics/03_fast_forward_ct/lab.ipynb",
|
||
|
|
"notebooks/butterfly_mechanics/03_fast_forward_ct/problems.ipynb",
|
||
|
|
"notebooks/butterfly_mechanics/03_fast_forward_ct/studio.ipynb",
|
||
|
|
"notebooks/butterfly_mechanics/04_fast_inverse_gs/lecture.ipynb",
|
||
|
|
"notebooks/butterfly_mechanics/04_fast_inverse_gs/lab.ipynb",
|
||
|
|
"notebooks/butterfly_mechanics/04_fast_inverse_gs/problems.ipynb",
|
||
|
|
"notebooks/butterfly_mechanics/04_fast_inverse_gs/studio.ipynb",
|
||
|
|
"notebooks/kyber_mapping/05_kyber_ntt_and_base_multiplication/lecture.ipynb",
|
||
|
|
"notebooks/kyber_mapping/05_kyber_ntt_and_base_multiplication/lab.ipynb",
|
||
|
|
"notebooks/kyber_mapping/05_kyber_ntt_and_base_multiplication/problems.ipynb",
|
||
|
|
"notebooks/kyber_mapping/05_kyber_ntt_and_base_multiplication/studio.ipynb",
|
||
|
|
"notebooks/professional/06_debugging_ntt_failures/lecture.ipynb",
|
||
|
|
"notebooks/professional/06_debugging_ntt_failures/lab.ipynb",
|
||
|
|
"notebooks/professional/06_debugging_ntt_failures/problems.ipynb",
|
||
|
|
"notebooks/professional/06_debugging_ntt_failures/studio.ipynb",
|
||
|
|
"notebooks/COURSE_COMPLETE.ipynb"
|
||
|
|
]
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"nbformat": 4,
|
||
|
|
"nbformat_minor": 5
|
||
|
|
}
|