Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Advanced NLP & LLM Systems Roadmap (Production-Focused)

A curated, production-first roadmap for advanced NLP/LLM topics—from GPU kernels and KV-cache internals to decoding tricks, quantization, MoE, long-context methods, RAG retrieval, serving stacks, and evaluation. Each topic includes a brief explainer, what you’ll learn, and free resources.

Who is this for? Senior ML/NLP engineers who want to ship fast, cheap, and reliable LLM systems in production.


Table of Contents

  1. Systems Foundations (CUDA, Triton, Memory)
  2. Attention & KV-Cache Internals
  3. Decoding for Throughput & Quality
  4. Quantization (Weights, Activations, KV Cache)
  5. Sparsity & Pruning
  6. Long-Context Methods
  7. Streaming & State Space Models
  8. PEFT: LoRA & Friends
  9. Training at Scale (FSDP, ZeRO, Checkpointing)
  10. Serving Stacks & Compilers
  11. Advanced Retrieval & RAG
  12. Evaluation & Benchmarking
  13. Production Tips & Checklists
  14. Suggested Learning Path

1) Systems Foundations (CUDA, Triton, Memory)

Brief: Master the GPU memory hierarchy, thread/block/wrap scheduling, and kernel fusion. Write custom kernels when PyTorch isn’t enough.

What you’ll learn

  • How shared/L2/global memory and registers affect throughput
  • Kernel fusion patterns (matmul+softmax+scale) and IO-aware designs
  • Writing kernels in Triton to accelerate bottlenecks

Free resources


2) Attention & KV-Cache Internals

Brief: Attention is memory-bound; learn IO-aware kernels and how to manage KV cache to keep batch sizes high under load.

Key topics

  • FlashAttention / FlashAttention-2 (IO-aware, tiled attention; better work partitioning)
  • PagedAttention (vLLM): virtual-memory-like KV pages; near-zero waste
  • KV Cache Quantization (FP8): reduce memory footprint, increase batch size and throughput

Free resources


3) Decoding for Throughput & Quality

Brief: Modern servers win with decoding algorithms, not just faster kernels. Draft-then-verify and multi-head drafting can 1.5–3× tokens/s depending on model and hardware.

Key topics

  • Speculative Decoding (draft with a small model; verify with the target model)
  • EAGLE / Lookahead / ReDrafter / Medusa (parallel heads / early exits / tree drafting)
  • Batching-aware decoding (continuous batching in vLLM/TRT-LLM)

Free resources


4) Quantization (Weights, Activations, KV Cache)

Brief: The fastest wins come from quantization—properly. Combine weight-only (W4/W8) with A8 and KV FP8 to keep accuracy while unlocking large batch sizes.

Key topics

  • LLM.int8() (vector-wise outlier handling for INT8 matmuls)
  • QLoRA (4-bit NF4 + LoRA; train 65B on 48GB GPUs)
  • GPTQ / AWQ / SmoothQuant (weight- or activation-aware post-training quantization)
  • KV FP8 (E4M3/E5M2) in vLLM/TensorRT-LLM

Free resources


5) Sparsity & Pruning

Brief: Prune for speed or capacity. Unstructured pruning (SparseGPT) is flexible; structured (2:4 on Ampere+) unlocks hardware speedups.

Key topics

  • SparseGPT (one-shot pruning for LLMs)
  • 2:4 structured sparsity (accelerated on Ampere Tensor Cores)
  • LoRAPrune (combine PEFT with structured pruning)

Free resources


6) Long-Context Methods

Brief: Train short, serve long using positional tricks and cache policies.

Key topics

  • ALiBi (train short, test long without extra params)
  • RoPE (rotary positions) and NTK/YaRN scaling (extend context without retraining)
  • Prefix/Sliding caches; Chunked context

Free resources


7) Streaming & State Space Models

Brief: For real-time or streaming, manage caches and consider SSMs as transformer complements.

Key topics

  • StreamingLLM (finite cache with token eviction)
  • Mamba / Mamba-2 (selective SSMs for long sequences; low-latency inference)

Free resources


8) PEFT: LoRA & Friends

Brief: Fine-tune cheaply without touching base weights; newer variants improve stability and quality.

Key topics

  • LoRA (low-rank adapters)
  • DoRA (weight decomposition for stability)
  • AdaLoRA / LoRA+ (dynamic rank, better scaling)

Free resources


9) Training at Scale (FSDP, ZeRO, Checkpointing)

Brief: Train beyond single-GPU memory with sharding and activation recomputation.

Key topics

  • FSDP (parameter/grad/optimizer sharding in PyTorch)
  • DeepSpeed ZeRO (+ offload; 3D parallelism with tensor/pipeline/data)
  • Gradient checkpointing (sublinear activation memory)

Free resources


10) Serving Stacks & Compilers

Brief: Choose your battle station. Pair a serving engine with compiler/runtime optimizations.

Stacks

Compilers & runtime


11) Advanced Retrieval & RAG

Brief: Go beyond naive dense retrieval.

Key topics

  • ColBERTv2 (late interaction, scalable reranking)
  • SPLADE (sparse lexical expansion; hybrid retrieval with dense)
  • ColPali / multi-modal retrievers (if you have images/PDFs)

Free resources


12) Evaluation & Benchmarking

Brief: Mix task metrics with human/LLM preference and risk metrics.

Key topics


13) Production Tips & Checklists

Throughput & latency

  • Turn on continuous batching; set max active requests per GPU engine
  • Prefer FlashAttention kernels and enable CUDA graphs for hot paths
  • Use KV cache paging and FP8 KV on Hopper/Ada/Blackwell for larger batches
  • Right-size prefill vs decode worker pools; prioritize long prompts differently

Stability & quality

  • Guard max_new_tokens, max_time, temperature/top-p defaults
  • Pin model & tokenizer versions; seed doesn’t guarantee determinism across compilers
  • Use A/B canaries and fallback routes (smaller model or cached answer)

Observability

  • Log tps, ttft, ttft_p95, batch size distribution, cache hit rate, OOMs
  • Emit decoding params per request; track eval scores (task + preference)

Cost control

  • Quantize weights (W4/W8), enable KV FP8, and use speculative decoding
  • Offload rarely-used models to CPU or cold GPUs; warmup on schedule
  • Add semantic caching (e.g., request/answer cache) to avoid re-compute

Safety

  • Add content filters and jailbreak detectors before model call if needed
  • Store minimal user data; rotate logs with PII scrubbing

14) Suggested Learning Path

Phase 1: Systems bedrock (1–2 weeks)

  • CUDA guide (memory, occupancy), Triton tutorials, FlashAttention-2

Phase 2: Serving & decoding (1–2 weeks)

  • vLLM / TensorRT-LLM end-to-end; enable continuous batching + speculative decoding

Phase 3: Compression (1–2 weeks)

  • QLoRA training; GPTQ/AWQ weight-only; KV FP8 in serving

Phase 4: Long context & streaming (1 week)

  • ALiBi/RoPE scaling; StreamingLLM cache policies

Phase 5: Eval & hardening (ongoing)

  • HELM-style metrics + MT-Bench preference; canary deploys & dashboards

Bonus: Tokenization Internals (for completeness)


Contributing

Issues/PRs welcome. Keep it vendor-agnostic, reproducible, and focused on free resources.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors