29/31
Part 6 of 6 · What interviewers ask nextLearn

Serving systems batch the adapters with their own kernels

The gather, A_all[ids], copies an adapter for every row of the batch, so serving systems write their own kernels for this step:

  • Punica has a CUDA kernel that batches GPU operations for different LoRA models. So one GPU holds a single copy of the base model while it serves many different LoRA models.
  • S-LoRA keeps all adapters in main memory and fetches the ones the running queries use to GPU memory. It pages adapter weights and the KV cache from one shared pool, and it reports serving thousands of adapters on one GPU or across several, with a small overhead.
  • By 2025 this was mainstream. The Thinking Machines post notes that vLLM and SGLang implement it.

The storage side is why it's worth it.

Predict

100 fine-tuned GPT-3 variants: one 350GB base plus 100 adapters of 35MB each. About how much is that in all?

Pick an answer above to see the rest