Log inStart free
LESSON 33.29 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Serving many LoRA adapters

Watch one GPU serve 10 requests that ask for 4 different LoRA adapters.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 33.29 · ADAPTER BAYADAPTER 27.3 MB · BASE 16.06 GB
01
Stage 1 of 5 · One base model
All 10 requests share one base model. Each asks for one of 4 LoRA adapters of 27.3 MB.
Explain it simply

A LoRA adapter is a small add-on to a frozen model: two thin matrices called A and B. The big block is the base model, and every request uses it. Each adapter card holds 27.3 MB, under 1% of the 16.06 GB base. So one GPU keeps the base once and many adapters beside it.

A 16.06 GB base weight block. Four adapter cards on disk: sql, code, law and help, each 27.3 MB. Ten request lanes, each named with its adapter.

requests, prefillbase and adapterswaits, mergesoutput tokens
disk: 27.3 MB per adapterGPU memory for 4 fine-tunes025050075010001250time (ms)sqlcodelawhelpbase weights Wfrozen, 16.06 GB, on the GPU4 full copies: 64.24 GB1 base + 4 adapters: 16.17 GBR1 sqlR2 codeR3 lawR4 sqlR5 helpR6 codeR7 sqlR8 lawR9 codeR10 helpone base, many adaptersdisk: 27.3 MB per adapterGPU memory for 4 fine-tunes025050075010001250time (ms)sqlcodelawhelpbase weights Wfrozen, 16.06 GB, on the GPU4 full copies: 64.24 GB1 base + 4 adapters: 16.17 GBR1 sqlR2 codeR3 lawR4 sqlR5 helpR6 codeR7 sqlR8 lawR9 codeR10 helpone base, many adapters
Toy: the 29.C2 trace on one toy GPU; an 8B base with 4 adapters
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
h=W x+B (A x)\sy{h}{out}{h} = \sy{W}{param}{W}\,\sy{x}{data}{x} + \sy{ab}{param}{B\,(A\,x)}
adapter=16⋅851,968⋅2 B=27.3 MB\text{adapter} = 16 \cdot 851{,}968 \cdot 2\,\text{B} = 27.3\,\text{MB}

The output adds the frozen base product and the adapter's low-rank product.

Common mix-ups

MYTHEach fine-tune needs its own copy of the model on the GPU.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With mixed batching, do 4 adapter slots instead of 2 make R3 wait less or longer?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.