MW
mwaaas/Category-Theory-for-AGI-UMass-CMPSCI-692CT
Sample Google Colab code to illustrate application of category theory to AGI
Category Theory for AGI — Colab Course Template
This bundle contains Colab-ready notebooks with a consistent Environment cell,
lightweight micro-demos, and exercises. Push this repo to GitHub and replace sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT
in each badge so students can launch directly in Colab.
Structure
notebooks/week01_backprop_as_functor.ipynbnotebooks/week01_sudoku_gt_db.ipynb(Sudoku GT vs Transformer + Diagrammatic Backprop)notebooks/week01_lm_gt_vs_transformer.ipynb(PTB language modeling: GT vs Transformer)notebooks/week01_coalgebra_demo.ipynb(Coalgebra: deterministic + MDP)notebooks/week02_yoneda_microdemo.ipynbnotebooks/week02_yoneda_self_attention_demo1.ipynb(Yoneda self-attention demo)notebooks/week03_limits_colimits_microdemo.ipynbnotebooks/week03_db_colimit_energy.ipynb(DB as (co)limit energy minimization)notebooks/week04_clustering_as_functor.ipynbnotebooks/week04_gt_full_node_labeling.ipynb(GT‑Full toy node labeling)notebooks/week05_mini_democritus.ipynb(Mini‑Democritus causal manifold)notebooks/week06_gt_full_ptb.ipynb(GT‑Full on PTB, tiny LM)notebooks/week07_sheaves_covers.ipynb(Sheaves via covers and gluing)notebooks/week08_topos_overlap_penalty.ipynb(Topos overlap consistency penalty)notebooks/week09_causal_discovery_toy.ipynb(Toy causal discovery)notebooks/week10_kan_do_rn.ipynb(Kan-Do calculus with RN ratios)notebooks/week11_subobject_classifier.ipynb(Subobject classifier in Sets)notebooks/week12_jstability_regimes.ipynb(j-stability across regimes)notebooks/week13_democritus_manifold.ipynb(Democritus causal manifold demo)notebooks/week13_open_games_attention_economy.ipynb(Open games: attention economy)data/democritus/manifold.npz(small topic manifold snapshot)
Usage
- Open the notebook link (or upload to Colab), run the Environment cell first.
- GPU is optional. All examples run on CPU in < 5 minutes.
- For local use, create a conda env via
environment.ymland run JupyterLab.
Colab Badge Template
[]
(https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week01_backprop_as_functor.ipynb)
Replace sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT once you publish the repo.
Local environment (optional)
conda env create -f environment.yml
conda activate ct4agi
jupyter lab
Direct Colab Links
- Week 1 — Backprop as a Functor
Functorial view of backprop with a small, runnable micro-demo.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week01_backprop_as_functor.ipynb - Week 1 — Sudoku GT + Diagrammatic Backprop
Compare Geometric Transformer vs. baseline Transformer on 4x4 Sudoku; optional DB curvature penalty.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week01_sudoku_gt_db.ipynb - Week 1 — Language Modeling (PTB): GT vs Transformer
Compare Geometric Transformer vs. baseline Transformer on a tiny PTB language model.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week01_lm_gt_vs_transformer.ipynb - Week 1 — Coalgebra Demo
Deterministic system + MDP as coalgebras.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week01_coalgebra_demo.ipynb - Week 2 — Yoneda Micro-Demo
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week02_yoneda_microdemo.ipynb - Week 2 — Yoneda Self-Attention Demo 1
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week02_yoneda_self_attention_demo1.ipynb - Week 3 — Limits & Colimits Micro-Demos
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week03_limits_colimits_microdemo.ipynb - Week 3 — DB as (Co)limit Energy
Minimize consistency/gluing energy to approximate limits and colimits.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week03_db_colimit_energy.ipynb - Week 4 — Clustering as a Functor
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week04_clustering_as_functor.ipynb - Week 4 — GT‑Full Toy Node Labeling
Relation‑aware GT‑Full message passing vs baseline MLP.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week04_gt_full_node_labeling.ipynb - Week 5 — Mini‑Democritus
Causal triples → GT‑Full embeddings → 2D manifold.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week05_mini_democritus.ipynb - Week 6 — GT‑Full on PTB (Tiny)
Relation‑aware GT‑Full LM vs baseline Transformer on PTB.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week06_gt_full_ptb.ipynb - Week 7 — Sheaves via Covers and Gluing
Local covers + overlap consistency on a toy interference example.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week07_sheaves_covers.ipynb - Week 8 — Topos Overlap Penalty
Sheaf-style overlap penalty prefers the true causal graph.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week08_topos_overlap_penalty.ipynb - Week 9 — Toy Causal Discovery
Recover edges from a linear SEM with simple regressions.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week09_causal_discovery_toy.ipynb - Week 10 — Kan-Do Calculus with RN Ratios
Conditioning vs intervention via Radon–Nikodym reweighting.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week10_kan_do_rn.ipynb - Week 11 — Subobject Classifier
Characteristic maps in Sets as a concrete subobject classifier.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week11_subobject_classifier.ipynb - Week 12 — j-Stability Across Regimes
Stable edges across environments from synthetic SEMs.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week12_jstability_regimes.ipynb - Week 13 — Democritus Causal Manifold
Visualize a topic manifold as a lightweight DB + GT example.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week13_democritus_manifold.ipynb - Week 13 — Open Games: Attention Economy
Simple open‑game play/co‑play demo for attention competition.
https://colab.research.google.com/github/sridharmahadevan/Category-Theory-for-AGI-UMass-CMPSCI-692CT/blob/main/notebooks/week13_open_games_attention_economy.ipynb
Colab Badges
- Week 1 — Backprop as a Functor
Functorial view of backprop with a small, runnable micro-demo.
- Week 1 — Sudoku GT + Diagrammatic Backprop
Compare Geometric Transformer vs. baseline Transformer on 4x4 Sudoku; optional DB curvature penalty.
- Week 1 — Language Modeling (PTB): GT vs Transformer
Compare Geometric Transformer vs. baseline Transformer on a tiny PTB language model.
- Week 1 — Coalgebra Demo
Deterministic system + MDP as coalgebras.
- Week 2 — Yoneda Micro-Demo
- Week 2 — Yoneda Self-Attention Demo 1
- Week 3 — Limits & Colimits Micro-Demos
- Week 3 — DB as (Co)limit Energy
Minimize consistency/gluing energy to approximate limits and colimits.
- Week 4 — Clustering as a Functor
- Week 4 — GT‑Full Toy Node Labeling
Relation‑aware GT‑Full message passing vs baseline MLP.
- Week 5 — Mini‑Democritus
Causal triples → GT‑Full embeddings → 2D manifold.
- Week 6 — GT‑Full on PTB (Tiny)
Relation‑aware GT‑Full LM vs baseline Transformer on PTB.
- Week 7 — Sheaves via Covers and Gluing
Local covers + overlap consistency on a toy interference example.
- Week 8 — Topos Overlap Penalty
Sheaf-style overlap penalty prefers the true causal graph.
- Week 9 — Toy Causal Discovery
Recover edges from a linear SEM with simple regressions.
- Week 10 — Kan-Do Calculus with RN Ratios
Conditioning vs intervention via Radon–Nikodym reweighting.
- Week 11 — Subobject Classifier
Characteristic maps in Sets as a concrete subobject classifier.
- Week 12 — j-Stability Across Regimes
Stable edges across environments from synthetic SEMs.
- Week 13 — Democritus Causal Manifold
Visualize a topic manifold as a lightweight DB + GT example.
- Week 13 — Open Games: Attention Economy
Simple open‑game play/co‑play demo for attention competition.
On this page
Languages
Jupyter Notebook100.0%
Contributors
Apache License 2.0
Created February 9, 2026
Updated February 9, 2026