How google-deepmind/alphatensor works
Project type and purpose
• This is an open-source research codebase accompanying the “AlphaTensor” paper.
• It bundles four independent pipelines (no single monolithic service):
• algorithms – precomputed matrix multiplication factorizations + a Colab notebook for exploration
• benchmarking – scripts to measure GPU performance of those algorithms
• nonequivalence – dataset of 14 236 distinct factorizations + a Colab notebook to verify nonequivalence
• recombination – a Python module that recombines smaller factorizations to tackle larger problems
File-structure analysis
• Top level: README.md, LICENSE, CONTRIBUTING.md, plus four directories.
• algorithms/
• Data: factorizations_r.npz, factorizations_f2.npz
• Notebook: explore_factorizations.ipynb
• benchmarking/
• requirements.txt, benchmarking scripts (run_gpu_benchmark.py, test_correctness.py, utils.py)
• nonequivalence/
• Data: alphatensor_14236_factorizations.npz
• Notebook: inspect_factorizations_notebook.ipynb
• recombination/
• Python modules: recombination.py, sota.py, example.py, recombination_test.py
• requirements.txt
README insights
• Each subfolder has its own README or instructions.
• Usage styles:
• algorithms/nonequivalence via Google Colab (user uploads .npz)
• benchmarking via local command-line on an NVIDIA V100 GPU
• recombination via python3 -m alphatensor.recombination.example
a. Main components
• Data stores (NumPy .npz files)
• Jupyter notebooks (exploration & verification)
• Python scripts/modules (benchmarking & recombination)
• External environments: Google Colab, local GPU setup
• Dependencies: numpy, absl-py, CUDA runtime
b. Relationships & data flow
• .npz files → notebooks (for exploration or nonequivalence checks)
• .npz files → benchmarking scripts → GPU kernels → timing outputs
• .npz files → recombination module → new factorizations (in memory or written out)
• User ↔ Colab (notebooks); CLI → benchmarking/recombination
c. Architectural patterns
• Modular separation: each pipeline lives in its own folder with isolated deps
• Data-driven workflows: centralized factorizations exploited by all components
• Plugin-style: recombination can be imported into other codebases
d. Key technologies
• Python 3, NumPy, absl-py
• Jupyter/Colab for interactive analysis
• NVIDIA CUDA (via Python bindings)