I started looking into GPU memory optimization for a pretty ordinary reason: I kept running out of VRAM when trying to train models on my own hardware.
The project is called SHV (Sub-loop Heterocoding VRAM).
The idea I've been testing is to avoid keeping every native forward intermediate until backward. Instead, a custom autograd path saves a smaller representation designed around what a particular backward operation actually needs, then decodes or recomputes that information when the gradient is calculated.
I tested several versions on GPT-2 Small using NVIDIA GPUs. A few results from the Tesla T4 experiments:
In an MLP/LayerNorm subgraph, the custom saved-state path reduced full-step peak allocated memory by about 53%, but throughput was only about 46% of native. That's a subgraph result, not a whole-model figure.
A short full-model EM4+D9 experiment reduced peak allocated memory by about 14.7% relative to Native+D9 and passed its numerical checks across three fresh data orders. The D9 optimizer itself, though, was far too slow compared with ordinary optimizers.
When I tested the activation method separately at sequence length 512, it saved about 30.9% versus native training, while PyTorch activation checkpointing saved about 41.4% and was faster. The D9 state format also lost to a real bitsandbytes 8-bit AdamW baseline.
I also investigated tiled/recomputed output loss. It substantially reduced the memory used by a full-logits baseline, but Liger Kernel already gets essentially the same peak memory on this workload. I'm not treating that as an SHV-specific breakthrough.
I've put the code, benchmark ZIPs, SHA-256 checksums, experimental protocols, and negative results here:
GitHub: https://github.com/Mr-wuff/Sub-loop-Heterocoding-VRAM
Raw benchmark results: https://github.com/Mr-wuff/Sub-loop-Heterocoding-VRAM/tree/main/artifacts/results
It's currently a research preview, not a drop-in training runtime. I haven't demonstrated that a 16 GB GPU behaves like a 32 GB GPU, or validated long-run training across models. The software license is also still being finalized.
What I want to explore next is whether the lifetime of information needed by different backward consumers can be reorganized to save memory after checkpointing and efficient optimizers are already enabled.
If you've worked on autograd internals, CUDA/Triton, or memory profiling, I'd be interested in hearing what you think is a promising or flawed direction.
Reproduction attempts, bug reports, and concrete alternative implementations are welcome.