Skip to content

Instantly share code, notes, and snippets.

View lukaszsamson's full-sized avatar

Łukasz Samson lukaszsamson

View GitHub Profile
@lukaszsamson
lukaszsamson / gist:43b77a944e6a1f88a17aad992efb53c0
Created February 16, 2026 14:14
Port of microgpt.py to elixir
# microgpt_atomics_inline.exs
# Port of microgpt.py by @karpathy
#
# Storage: :atomics array (7 slots per node) in place of Python dicts.
# Refs threaded: both data ref and counter ref passed as args, zero
# :persistent_term.get calls during training/inference.
# @compile inline on all hot V and MicroGPT functions.
#
# Optimizations that diverge from the Python original:
#