Requential Coding <1 bit compression with better generalization Researchers introduced Requential Coding, a method that compresses generative models by coding a training process using self-generated data, achieving under 1 bit per parameter compression with better generalization. The technique's code length depends only on the cumulative teacher-student KL divergence, independent of parameter count or data entropy. The open-source implementation supports JAX-based training on GPUs and TPUs. Code for the paper "Requential Coding: Pushing the Limits of Model Compression with Self-Generated Training Data" . Requential coding compresses a generative model by coding a training process built from self-generated data. A student model samples its own training batches, a teacher training on real data selects them via relative entropy coding, and the code length is the cumulative teacher-student KL, independent of both parameter count and data entropy. train.py : the requential training loop teacher on real data, student on teacher-sampled data, per-step MC KL, optional iso-loss projection and PAC-Bayes bound logging model.py : GPT-2-style transformer flax NNX bounds.py : PAC-Bayes bound quantities data.py : dataset loaders ckpt.py : checkpoint save/resume configs/default.yaml : all hyperparameters with the paper defaults data prep/ : dataset preparation scripts sweeps/ : one wandb sweep per paper experiment notebooks/ : one self-contained notebook per paper figure conda create -n requential python=3.10 -y conda activate requential pip install -U "jax cuda12 " flax optax hydra-core omegaconf wandb tqdm numpy pip install pandas matplotlib seaborn jupyter huggingface hub datasets data prep + figures Everything runs on GPUs and, with jax tpu , on TPUs. The batch is sharded over all visible devices, and both single- and multi-GPU setups work. Use CUDA VISIBLE DEVICES to pick GPUs. The paper's experiments ran on TPU v6e-8 hosts, and the accumulation factors in the sweeps are calibrated for that memory. The FineWeb sweeps use A=8 , and only the largest width-2752 model needs A=16 . If you run out of memory, raise the gradient-accumulation factor A the per-step microbatch is B/A or set model.gradient checkpointing=true . Note that the FineWeb loader shuffles data in microbatch-sized blocks, so changing A changes the data order. The run is statistically equivalent but not step-for-step identical. python data prep/prepare fineweb.py 201 FineWeb, GPT-2 tokens 201 chunks = 20B python data prep/prepare open.py OpenWebText, character-level vocab 96 python data prep/prepare cifar5m.py '/path/to/cifar5m part{}.npz' CIFAR-5M pixels Datasets land under datasets/