← Back
Home › Systems › AI and ML infrastructure

self-play-training

self-play RL training loop

AlphaZero, Leela

SystemTechniques · 8Primitives · 37 self-play-training Batched MCTS inferencegame-ai · medium: Feed an accelerator from tree search driven by a learned evaluator: virtual loss gathers leaves within a tree, parallel searches fill batches, an async queue overlaps CPU and GPU.›Monte Carlo tree searchgame-ai · medium: Grows a search tree one simulation at a time, picking visits by a bandit rule (UCT or PUCT) and backing up averages; the search behind AlphaZero.›AlphaZero self-playmachine-learning · medium: A policy-value net guides PUCT search; search visit counts and game results become its training targets, so it learns from its own improved play.›Data loading pipelinesmachine-learning · medium: Turn files on disk into shuffled, sharded, resumable GPU batches fast enough that the accelerator never waits.›Distributed checkpointingml-training · medium: Sharded, asynchronous checkpoint save/load of model and optimizer state, with resharding to new world sizesSequential probability ratio teststatistics · medium: Add up the log-likelihood ratio per observation and stop when it crosses a fixed bound; the least data of any test with the same error rates (for two point hypotheses).›Multi-armed banditsmachine-learning · medium: Choose among K options repeatedly while learning their payoffs: epsilon-greedy, UCB1 and Thompson sampling keep total regret low where a fixed split or a fixed exploration rate pays forever.›Transposition tablegame-ai · low: A fixed-size, lossy hash table of search results keyed by a state hash; gives ordering and cutoffs for repeated states, shared lock-free between threads.›Experience replaymachine-learning · low: Ring-buffer replay memory with uniform or prioritized sampling for off-policy and self-play trainingConvolutional networksml-training · low: Layers that slide a small shared kernel over a grid, giving translation equivariance and few parameters; still the most compute-efficient choice for many vision tasks.›SGD with momentumml-training · low: Gradient descent plus a decaying velocity buffer that averages minibatch noise and speeds up progress along shallow, consistent directions.›Compact state encodingdata-structures · low: Pack a game position into a few fixed bytes (24 for chess: occupancy bitboard plus nibbles) for training data and dedupeBitboardsgame-ai · low: One 64-bit word per set of up to 64 items, so set algebra becomes shifts, ANDs and table lookups; magic bitboards give ray queries in one multiply.›Zobrist hashinggame-ai · low: A state's hash is the XOR of one random 64-bit key per (item, slot) fact that holds in it, updated in a few XORs per change.›Elo ratinggame-networking · low: One number per competitor, moved by K × (actual − expected score) after each pairwise result; expected score is logistic in the rating difference.›Loss functionsmachine-learning · low: The scalar a model minimizes: cross-entropy for classes and tokens, MSE or Huber for values, each with a stable form and simple gradient.›Mixed-precision trainingml-training · low: Run matmuls in bf16/fp16/fp8 on tensor cores while keeping master weights, optimizer state and reductions in fp32; about 2x speed, half the activation memory.›Transformer blockml-training · low: The decoder-only pre-norm block (attention plus MLP on a residual stream) behind every modern LLM, with exact shapes, parameter, FLOP and KV-cache counts.›Weight quantizationml-training · low: Store weights as 8/4-bit integers with per-group scales; decode is memory-bound, so 4-bit weights give about 3-4x tokens/s and fit 4x larger models.›Weight synchronizationml-training · low: Pushing updated policy weights from trainers to inference/actor workers (NCCL broadcast, sharded resharding)MPMC bounded queueconcurrency · low: Vyukov's array queue for many producers and consumers: each slot carries a sequence number, so one CAS per operation claims a slot without locks.›PRNGs (PCG, xoshiro)numerics · low: Small, fast, statistically strong non-cryptographic generators: PCG32 and xoshiro256**, with seeding, parallel streams and unbiased ranges.›Symmetry data augmentationmachine-learning · low: Augment board-game training data with the board's symmetry group (8 dihedral transforms)+ 1 more techniques+ 21 more primitives

Similar systems

Share the most building blocks with this one.