mirror of
https://github.com/saymrwulf/NTT-learning.git
synced 2026-07-27 19:51:29 +00:00
151 lines
6.5 KiB
Text
151 lines
6.5 KiB
Text
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"pedagogy": {
|
|
"role": "meta",
|
|
"difficulty": 1,
|
|
"kind": "orientation",
|
|
"title": "Studio Goals"
|
|
}
|
|
},
|
|
"source": "## META | difficulty 1 | Studio Goals\n\nThe last studio compresses the whole course into one debugging mindset.\n"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"pedagogy": {
|
|
"role": "mandatory",
|
|
"difficulty": 3,
|
|
"kind": "explanation",
|
|
"title": "The Whole Course Is A Debugging Ladder"
|
|
}
|
|
},
|
|
"source": "## MANDATORY | difficulty 3 | The Whole Course Is A Debugging Ladder\n\nEvery earlier bundle built one layer of the debugging stack:\n\n- schoolbook grid and wraparound\n- direct transform algebra\n- CT stage schedule\n- GS inverse schedule\n- bit-reversal and scaling\n- Kyber modulus constraints and base multiplication\n"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"pedagogy": {
|
|
"role": "mandatory",
|
|
"difficulty": 3,
|
|
"kind": "demo",
|
|
"title": "Print The Whole Debugging Ladder"
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": "# MANDATORY | difficulty 3 | Print The Whole Debugging Ladder\n\nladder = [\n \"Can I see the raw schoolbook product grid?\",\n \"Can I explain the negacyclic wraparound sign?\",\n \"Can I reproduce the direct NTT_psi / INTT_psi round trip?\",\n \"Can I trace CT stages with the right zetas?\",\n \"Can I trace GS stages with the right order and scaling?\",\n \"Can I explain why Kyber v3 does not inherit the full toy psi story unchanged?\",\n]\nfor item in ladder:\n print(\"-\", item)\n"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"pedagogy": {
|
|
"role": "mandatory",
|
|
"difficulty": 2,
|
|
"kind": "exercise",
|
|
"title": "Final Debug Checklist"
|
|
}
|
|
},
|
|
"source": "## MANDATORY | difficulty 2 | Final Debug Checklist\n\nKeep this order:\n\n1. ring rule and wraparound\n2. root existence and root choice\n3. stage pairings and zetas\n4. BO vs NO comparison\n5. final `n^-1` scaling\n6. Kyber-specific modulus / base-multiplication assumptions\n"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"pedagogy": {
|
|
"role": "mandatory",
|
|
"difficulty": 2,
|
|
"kind": "exercise",
|
|
"title": "One Last Round Trip"
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": "# MANDATORY | difficulty 2 | One Last Round Trip\n\nfrom ntt_learning.toy_ntt import fast_intt_psi_gs_trace, fast_ntt_psi_ct_trace\n\nsignal = [3, 1, 4, 1]\nforward_trace = fast_ntt_psi_ct_trace(signal, 17, 2)\ninverse_trace = fast_intt_psi_gs_trace(forward_trace.raw_output, 17, 2)\n\nprint(\"signal:\", signal)\nprint(\"forward BO:\", forward_trace.raw_output)\nprint(\"inverse scaled:\", inverse_trace.scaled_output)\n"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"pedagogy": {
|
|
"role": "mandatory",
|
|
"difficulty": 2,
|
|
"kind": "reflection",
|
|
"title": "Final Reflection"
|
|
}
|
|
},
|
|
"source": "## MANDATORY | difficulty 2 | Final Reflection\n\nFinal prompt:\n\n- Which image now anchors your understanding of NTT best: the schoolbook grid, the fold arrows, the CT stage view, the GS stage view, or the bit-reversal map?\n- Why that one?\n"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"pedagogy": {
|
|
"role": "facultative",
|
|
"difficulty": 4,
|
|
"kind": "exploration",
|
|
"title": "Optional: Personal Debug Rule"
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": "# FACULTATIVE | difficulty 4 | Optional: Personal Debug Rule\n\npersonal_rule = \"Never trust a final vector until I have checked the stage trace, the order, and the scaling.\"\nprint(personal_rule)\n"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"pedagogy": {
|
|
"role": "meta",
|
|
"difficulty": 1,
|
|
"kind": "handoff",
|
|
"title": "Next Notebook"
|
|
}
|
|
},
|
|
"source": "## META | difficulty 1 | Next Notebook\n\nNext notebook: `../../../COURSE_COMPLETE.ipynb`\n"
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"name": "python"
|
|
},
|
|
"ntt_learning": {
|
|
"title": "Studio: 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
|
|
}
|