you are
a developer trying to run GPT-3 locally
your GPU catches fire
your AWS bill looks like a phone number
decide to learn the dark arts of optimization
18 months later i can make a 70B model run on a gaming laptop
here's the forbidden speedrun guide
the problem:
LLMs are fat and slow
175B parameters = 700GB in FP32
one forward pass = your GPU crying
inference speed measured in geological time
but the nerds fixed it
quantization = the ultimate life hack
take your fancy 32-bit floats
crush them to 8-bit ints
model gets 75% smaller
still works fine
it's like JPEG for neural networks
"lossy compression but nobody notices"
4-bit quantization:
yes, FOUR bits
0-15, that's all you get
somehow still generates shakespeare
GGUF, AWQ, GPTQ formats
pick your poison
they all work, nobody knows why
KV-cache quantization:
the cache that stores your conversation
normally bloats like your node_modules
quantize it too
suddenly you can chat for hours
memory usage: "what memory usage?"
flash attention = GPU go brrrr
normal attention: O(n²) memory
flash attention: "what if we just... didn't?"
compute in tiny blocks
use SRAM like a speed demon
4x faster, uses 10x less memory
dao-aielab/flash-attention changed the game
sparse attention patterns:
not every token needs to see every token
local: "i only talk to my neighbors"
strided: "i check in every 8 tokens"
learned: "the model decides who's worth talking to"
attention budget: managed
paged attention:
virtual memory but for transformers
breaks KV-cache into pages
no more memory fragmentation
vLLM uses this
suddenly you can serve 100 users on one GPU
"MMU for AI" energy
speculative decoding = parallel universe speedrun:
small model: "i think it says 'the cat sat'"
big model: "let me verify... yep, 2/3 correct"
accept the good, regenerate the bad
2-3x speedup
free performance, no quality loss
LoRA = fine-tuning for broke people:
don't retrain 70B params
add tiny 1M param adapters
they modify the big model's behavior
switch them like cartridges
one base model, infinite personalities
PEFT library makes it trivial
pruning = marie kondo for weights:
structured: delete entire layers
unstructured: delete random connections
magnitude pruning: "if weight < 0.01, yeet"
90% sparsity still works
your model on a diet
knowledge distillation:
big model teaches small model
teacher: "here's my probability distribution"
student: "i'll mimic that"
10x smaller, 95% as good
how edge devices run "GPT"
dynamic batching:
GPUs hate single requests
batch them like a subway at rush hour
continuous batching: add/remove on the fly
orca/vllm pioneered this
throughput goes 10x
tensor parallelism:
split matrices across GPUs
GPU 1: "i'll do columns 0-1024"
GPU 2: "i'll take 1024-2048"
requires NVLink or you die waiting
how you run 175B models at all
pipeline parallelism:
assembly line for layers
GPU 1 does layers 1-10
GPU 2 does 11-20
microbatching keeps everyone busy
deepspeed makes this "easy"
mixed precision = have your cake:
compute in FP16
accumulate in FP32
store in INT8
tensor cores go brrr
2x speedup for free
early exit strategies:
easy tokens exit early
"the" doesn't need 80 layers
complex tokens get full computation
adaptive compute budgets
30-50% faster on average
model serving stack that actually works:
vLLM for throughput
TensorRT-LLM for latency
llama.cpp for edge
everyone else is marketing
pick one, tune it, ship it
the multiplication effect:
quantization: 4x smaller
flash attention: 4x faster
batching: 10x throughput
sparse attention: 2x faster
speculative decoding: 2x faster
compound them all: 320x better
secret sauce combinations:
INT4 quantization + flash attention + paged attention
= 70B model on consumer GPU
LoRA + pruning + distillation
= custom 7B that beats GPT-3.5
all the techniques stack
forbidden truth:
OpenAI uses all of these
Anthropic too
the "magic" is just good engineering
frontier models = same architecture + better optimization
scale is a compiler flag
what nobody tells you:
inference optimization > training optimization
most "breakthroughs" are engineering
the papers are public
the code is on github
you can build this
tools of the trade:
bitsandbytes for quantization
flash-attention (obviously)
vLLM for serving
PEFT for LoRA
tensorRT for nvidia supremacy
llama.cpp for running on your toaster
final boss wisdom:
you don't need a PhD
you don't need H100s
you need obsession and arxiv
start with llama.cpp
work your way up
in 6 months you'll be explaining speculative decoding at parties
the endgame:
gpt-4 class models on your laptop
real-time inference on phones
open source catching up monthly
optimization democratizing AI
the moat is evaporating
they said LLMs need datacenters
they lied
with these techniques
you run them on edge
build your own
ship to users
no API keys
no rate limits
just pure, optimized inference
now you know
the sacred techniques
the forbidden optimizations
stop asking for API access
start quantizing
welcome to the resistance
@TheAhmadOsman Killer guide. One speed trick worth mentioning: speculative decoding with a draft model can get you 2-3x faster inference on consumer GPUs - llama.cpp and vLLM both support it now. Huge for interactive use cases.
This research argues that the field should stop chasing ever-bigger models for logic. For reasoning, smaller can do better.
They built a Tiny Recursive Model, a deliberately small network with two layers and about seven million parameters. Instead of trying to solve a problem in one pass, it guesses, checks itself, and refines the answer through recursion. The design is intentionally simple: no heavy mathematical machinery and no biological analogies—just a compact loop that improves its own output step by step.
Why it matters: the tiny model outperforms much larger language models on hard logic tasks. It reaches state-of-the-art test accuracy on puzzle benchmarks, including around 87.4% on Sudoku-Extreme, and it beats large models on ARC-AGI-2 (about 7.8% versus 4.9% for a top LLM). The core reason is error control. Big language models generate text token by token; one early mistake can derail the entire chain of thought. The recursive model revisits and corrects its work, so errors don’t snowball. The study also finds that cutting depth to two layers improves generalization and reduces overfitting for these constrained logic problems. In short: for analytical, well-scoped reasoning, deep recursion with a tiny network can be more reliable and efficient than scaling up parameter counts.
New paper 📜: Tiny Recursion Model (TRM) is a recursive reasoning approach with a tiny 7M parameters neural network that obtains 45% on ARC-AGI-1 and 8% on ARC-AGI-2, beating most LLMs.
Blog: https://t.co/w5ZDsHDDPE
Code: https://t.co/7UgKuD9Yll
Paper: https://t.co/3m8ANhNMiw
@JustinLin610 Hi @JustinLin610 know of a company that uses Qwen-14, fine-tunes it, and now sells it as its own product. What do you think of this unauthorized use?
Why doesn't anyone include @Alibaba_Qwen in benchmarks? Is it because of the model's power, or are there other factors, perhaps political?
@JustinLin610
Introducing Command R7B: the smallest, fastest, and final model in our R series of enterprise-focused LLMs!
It delivers a powerful combination of state-of-the-art performance in its class and efficiency to lower the cost of building AI applications.
https://t.co/e2ah5c5x5J