Build an end-to-end LLM inference and evaluation pipeline from scratch:
- Deploy a 7B model with vLLM
- Run OpenAI-compatible API server
- Evaluate on GSM8K
- Measure accuracy and latency
- Ubuntu 24.04
- NVIDIA Tesla T4 (16GB)
- Driver 590
- CUDA 13.1
- Python 3.10
Model: Qwen2-7B-Instruct
Framework: vLLM
Quantization: 4-bit
Attention backend: TRITON_ATTN
Key concepts learned:
- KV Cache
- PagedAttention
- Autotuning
- CUDA memory management
Dataset: GSM8K (Grade School Math 8K)
- Test subset: 50 samples
- Temperature: 0.0
- Metric: Accuracy
Result:
Accuracy: 0.68
Average latency: ~8.9s per question
- GPU memory analysis with nvidia-smi
- Dataset loading and split slicing
- tqdm progress interpretation
- Deterministic decoding for evaluation
- Handling CUDA backend issues
-
CUDA OOM during vLLM warmup → Solved by using AWQ quantized model
-
FlashInfer required nvcc → Switched attention backend to TRITON_ATTN
-
Conda TOS issue → Accepted channel terms manually
- Full 1319 test evaluation
- Few-shot prompting
- Compare multiple models
- Add latency profiling