Skip to content

Commit be71a40

Browse files
committed
mod
1 parent cad6d18 commit be71a40

84 files changed

Lines changed: 370 additions & 195 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Fast Statistical Models for Python
2+
3+
This repository contains the PyCon US 2026 deck and reproducibility artifacts for **Breaking the Speed Limit: Python 3.14, Numba, and Codex in Statistical Computing**.
4+
5+
Core thesis:
6+
7+
- simulation is how statisticians write tests;
8+
- speed only counts after the statistic is preserved;
9+
- Python remains the scientific interface;
10+
- Numba, JAX, Python 3.14, threads, processes, and A100 solve different bottlenecks.
11+
12+
## View the slides
13+
14+
Use the project conda environment by default:
15+
16+
```bash
17+
conda activate py312
18+
python -m http.server 8000
19+
```
20+
21+
Open:
22+
23+
```text
24+
http://localhost:8000/slides/index.html
25+
```
26+
27+
PDF/print mode:
28+
29+
```text
30+
http://localhost:8000/slides/index.html?print-pdf
31+
```
32+
33+
The canonical deck is [`slides/index.html`](slides/index.html). Current structure is 32 slides total: 27 main-path slides and 5 backup slides.
34+
35+
## Results layout
36+
37+
- MacBook/local trust tier: [`experiments/results/macbook_air_long/latest/`](experiments/results/macbook_air_long/latest/)
38+
- Linux server CPU scale tier: [`experiments/results/linux_server_cpu/long_safe_20260503_190133/`](experiments/results/linux_server_cpu/long_safe_20260503_190133/)
39+
- Historical A100 long-safe tier: [`experiments/results/linux_server_a100/long_safe_20260503_190133/`](experiments/results/linux_server_a100/long_safe_20260503_190133/)
40+
- A100 permutation follow-up notes and figures: [`experiments/results/linux_server_a100/permutation_followup/`](experiments/results/linux_server_a100/permutation_followup/)
41+
- A100 permutation break-even notes: [`experiments/results/linux_server_a100/permutation_break_even/`](experiments/results/linux_server_a100/permutation_break_even/)
42+
- Slide-ready figures: [`experiments/results/presentation_figures/`](experiments/results/presentation_figures/)
43+
44+
## Current result status
45+
46+
- MacBook k-means and permutation correctness/calibration results are the trust tier used in the main talk.
47+
- Linux server CPU and k-means A100 results are scale evidence used in the main talk.
48+
- The old A100 permutation matched slice is historical negative evidence: `n=5,000`, `p=50,000`, `batch_R=512`, before streamed reduction and the broader shape sweep.
49+
- The current A100 permutation break-even narrative uses `a100_streamed_reduction`, larger `batch_R`, and a measured shape sweep. Speedup is scoped to the matched CPU matrix baseline divided by A100 streamed full end-to-end. Compile is excluded, transfer is included, and kernel-only rows are not used for CPU/A100 decisions.
50+
- A100 permutation correctness wording is intentionally scoped: historical rows marked `check` are not exact `pass` rows; new accepted GPU rows should be emitted as `pass_gpu_tolerance`.
51+
52+
## Regenerate figures
53+
54+
MacBook figures:
55+
56+
```bash
57+
python -m experiments.visualization.plot_macbook_air_evidence \
58+
--results-dir experiments/results/macbook_air_long/latest
59+
```
60+
61+
Server CPU and k-means/A100 presentation figures:
62+
63+
```bash
64+
python -m experiments.visualization.plot_server_talk_evidence
65+
```
66+
67+
A100 permutation break-even figures, when the experiment CSVs are available:
68+
69+
```bash
70+
python -m experiments.server.a100_permutation_break_even plot \
71+
--out-dir experiments/results/linux_server_a100/permutation_break_even \
72+
--presentation-dir experiments/results/presentation_figures
73+
```
74+
75+
## Deck QA
76+
77+
Latest screenshot and render QA artifacts are written under [`slides/qa/latest/`](slides/qa/latest/). The QA pass checks browser mode, print/PDF mode, video poster fallbacks, broken media URLs, clipping, overlap, console errors, and A100 pending/experimental wording.

experiments/results/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,25 @@ plot_and_summarize(
3030

3131
The root-level quick-run server outputs were removed after validation. Only the timestamped long-safe directories are curated for GitHub.
3232

33+
## A100 Permutation Follow-up
34+
35+
The long-safe A100 permutation chart is historical matched-slice evidence: `n=5,000`, `p=50,000`, `batch_R=512`, before streamed reduction and before the broader break-even sweep. It remains useful because it shows that a GPU logo does not guarantee a win.
36+
37+
The current permutation GPU narrative uses:
38+
39+
- [`linux_server_a100/permutation_followup/`](linux_server_a100/permutation_followup/) for streamed-reduction pipeline/decomposition notes and figures.
40+
- [`linux_server_a100/permutation_break_even/`](linux_server_a100/permutation_break_even/) for the CPU/A100 break-even summary.
41+
42+
Speedup in the break-even map is scoped to the matched CPU matrix baseline divided by A100 streamed full end-to-end. Compile is excluded, transfer is included, and kernel-only rows are not used for CPU/A100 speedup decisions.
43+
3344
## Presentation Figures
3445

3546
Slides and the poster should use the normalized 16:9 summaries in
3647
[`presentation_figures/`](presentation_figures/) when citing server/A100
3748
results. These figures are regenerated by:
3849

3950
```bash
40-
/Users/lucajiang/anaconda3/envs/py312/bin/python -m experiments.visualization.plot_server_talk_evidence
51+
python -m experiments.visualization.plot_server_talk_evidence
4152
```
4253

4354
The MacBook correctness and local evidence tier lives in

experiments/results/linux_server_a100/long_safe_20260503_190133/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Inputs and transformation:
114114

115115
Conclusion supported by this figure:
116116

117-
For the matched `R=1,000` and `R=10,000` points, CPU is faster than A100 in this implementation. This is an important negative result: the current JAX GPU permutation path has enough overhead that it does not beat the CPU baseline on the matched slice, even though it validates the matrix reformulation.
117+
For the old matched `R=1,000` and `R=10,000` points at `n=5,000`, `p=50,000`, and `batch_R=512`, CPU is faster than A100 in this implementation. This is historical pre-break-even evidence: it predates the streamed-reduction follow-up, larger `batch_R` sweep, and broader shape sweep. It should not be read as the final A100 permutation conclusion.
118118

119119
### `figures/permutation_matrix_reformulation.png`
120120

experiments/results/linux_server_a100/permutation_break_even/QA_NOTE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Generated: 2026-05-05
66
- Compile time: excluded from warm end-to-end comparisons; compile is recorded separately in the decomposition CSV.
77
- Transfer: included for A100 end-to-end and streamed-reduction rows.
88
- Stage sums: named decomposition stages do not exhaust `total_end_to_end_time_s`; the figure adds an explicit `other overhead` segment so stacked bars reconcile to the recorded total.
9-
- CPU comparison: full end-to-end CPU matrix baseline, not per-batch and not kernel-only.
9+
- CPU comparison: matched full end-to-end CPU matrix baseline, not per-batch, not kernel-only, and not an exhaustive best-of-all-CPU search.
1010
- Kernel-only rows: labeled separately as `kernel-only hypothesis, not end-to-end permutation test` and excluded from speedup decisions.
11-
- Correctness: new rows are marked `check`; no speedup plot uses failed rows.
11+
- Correctness: historical rows are marked `check`; future accepted GPU-tolerance rows should be marked `pass_gpu_tolerance`; no speedup plot uses failed rows.
1212
- Visual check: updated decision and decomposition slides were exported to PDF and screenshotted at 1280x720.

experiments/results/linux_server_a100/permutation_break_even/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
Generated/updated: 2026-05-05T21:23:58+0800
44

55
## CPU baseline
6-
- Best trusted CPU implementation used here: `numpy_matrix_same_stream` batched matrix path.
6+
- Matched CPU matrix baseline used here: `numpy_matrix_same_stream` batched matrix path.
7+
- Scope: this is not an exhaustive best-of-all-CPU search; speedup means matched CPU matrix baseline divided by A100 streamed full end-to-end.
78
- CPU rows recorded: 27.
89

910
## Break-even
@@ -29,6 +30,9 @@ Generated/updated: 2026-05-05T21:23:58+0800
2930
## Correctness
3031
- Correctness check rows: 97.
3132
- check: 97
33+
- Historical `check` rows mean accepted bounded CPU/JAX comparisons under the then-current status vocabulary; they are not exact `pass` rows.
34+
- New accepted GPU rows should be emitted as `pass_gpu_tolerance`.
35+
- The result CSVs with `max_abs_p_diff` and `max_abs_stat_diff` are generated on the experiment server but are not committed in this repository snapshot.
3236

3337
## OOM / memory-risk / timeout
3438
- `batch_R_sweep.csv`: 0 timeout/skipped/memory-risk/fail rows.

experiments/results/linux_server_a100/permutation_followup/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ This suite preserves the feature-wise two-group mean-difference statistic and us
1717
- check: 2
1818

1919
## Correctness
20-
- Rows passing or checking the small matched CPU/JAX subset: 74.
21-
- Exact `pass` rows: 0; `check` rows: 74. The A100 float32 subset is kept as `check` because tiny statistic differences can flip about one permutation count in p-values.
20+
- Accepted small matched CPU/JAX subset rows: 74.
21+
- Exact `pass` rows: 0; historical `check` rows: 74. These are accepted bounded checks under the then-current status vocabulary, not exact pass rows.
22+
- New accepted A100 float32 rows should be emitted as `pass_gpu_tolerance`; tiny statistic differences can flip about one permutation count in p-values.
2223
- `max_abs_p_diff` and `max_abs_stat_diff` are from a bounded small matched subset for each benchmark row; large rows are timed without changing the statistic or permutation stream.
2324

2425
## End-to-end vs kernel-only
2526
- End-to-end rows include W construction, host-to-device transfer, `W @ X`, p-value reduction, and collection of reduced results.
2627
- Kernel-only rows are labeled `kernel-only hypothesis, not end-to-end permutation test`; they time only device-resident `W_batch @ X_device`.
2728

2829
## Bottleneck summary
29-
- Dominant measured A100 end-to-end stage: `permutation_generation_time_s`.
30+
- Largest recorded named A100 end-to-end stage in this run: `permutation_generation_time_s`.
3031
- A100 becomes faster at n=5000, p=50000, R=10000, batch_R=4096.
3132

3233
## Unavailable / OOM / timeout rows

experiments/results/macbook_air_long/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ Older quick-validation outputs, the incomplete long run, and the pre-x64 full ru
1818
## Reproduce current curated figures
1919

2020
```bash
21-
/Users/lucajiang/anaconda3/envs/py312/bin/python -m experiments.run_macbook_evidence_extra \
21+
python -m experiments.run_macbook_evidence_extra \
2222
--output-dir experiments/results/macbook_air_long/latest \
2323
--checkpoint-every 20 --max-iter 15
2424

25-
/Users/lucajiang/anaconda3/envs/py312/bin/python -m experiments.visualization.plot_macbook_air_evidence \
25+
python -m experiments.visualization.plot_macbook_air_evidence \
2626
--results-dir experiments/results/macbook_air_long/latest
2727
```
2828

experiments/results/macbook_air_long/latest/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ Figure metadata:
5252
Use the project default local environment:
5353

5454
```bash
55-
/Users/lucajiang/anaconda3/envs/py312/bin/python -m experiments.run_macbook_evidence_extra \
55+
python -m experiments.run_macbook_evidence_extra \
5656
--output-dir experiments/results/macbook_air_long/latest \
5757
--checkpoint-every 20 --max-iter 15
5858

59-
/Users/lucajiang/anaconda3/envs/py312/bin/python -m experiments.visualization.plot_macbook_air_evidence \
59+
python -m experiments.visualization.plot_macbook_air_evidence \
6060
--results-dir experiments/results/macbook_air_long/latest
6161
```
6262

experiments/results/presentation_figures/cpu_vs_a100_break_even_map.svg

Lines changed: 1 addition & 1 deletion
Loading

experiments/results/presentation_figures/kernel_only_vs_end_to_end.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)