5.3.18 · D1 · HinglishMLOps & Deployment

FoundationsLLM serving (vLLM, quantized inference)

1,871 words9 min read↑ Read in English

5.3.18 · D1 · AI-ML › MLOps & Deployment › LLM serving (vLLM, quantized inference)

Yeh page kuch bhi assume nahi karta. Agar parent note ne koi symbol, word, ya picture bina explain kiye use kiya, toh hum use pehle yahan banate hain. Isse parent topic se pehle padho.


1. "Token" kya hota hai?

Hum in letters ko tokens aur model size count karne ke liye use karenge — picture yaad karo, letter nahi:

Symbol Plain words Picture
sequence length = ab tak kitne tokens hain train carriages ki ginti
batch = ek saath kitni alag conversations parallel tracks pe kitni trains
model mein layers ki ginti kitni baar train "thinking machine" se guzarti hai
har token ke vector ki width ek dabba describe karne ke liye kitne numbers
bytes per number (FP16 = 2) ek number store karne ka "wajan"

2. "Vector" aur kya hota hai?

Figure dekho: ek token (ek dabba) numbers ka ek tall stack hai. Jab parent note likhta hai, iska matlab hai ke har ek token apne peechhe 5120 floating-point numbers ki ek list kheenchta hai.


3. "Byte" aur "precision" kya hota hai?


4. Attention — "KV cache" ki ZAROORAT kyun hai

Parent note baar baar Keys, Values, queries kehta rehta hai. Yeh yahan se shuru hota hai, zero se. (Poori detail Attention Mechanism mein hai — hum yahan sirf woh build karte hain jo is topic ko chahiye.)


5. "Head" kya hota hai (aur nahi, kyun)?


6. "Memory-bound" vs "compute-bound" ka kya matlab hai?


7. Number level pe "quantization" kya hai?

Yahan bits ki ginti hai, aur tick marks ke beech gaps ki ginti hai. INT4: , gaps.


8. "Batching" kya hota hai?


Prerequisite map

Token = numbered text chunk

Vector of d_model numbers

Query Key Value per token

KV cache stores past K and V

Byte and precision p

Quantization few ticks

Memory-bound decode

Batching reuse weights

LLM Serving vLLM and Quantized Inference

Arrows ko aise padho: "yeh pehle chahiye woh ke liye." Sab kuch parent topic node T mein funnel hota hai.


Equipment checklist

A token is
ek number jo text ke chunk (word ya word-piece) ko represent karta hai.
A vector is
numbers ki ek ordered list; har token length ka ek vector hai.
means
ek token describe karne ke liye kitne numbers use hote hain.
, , stand for
sequence length (tokens), batch (parallel conversations), number of layers.
(precision) means
bytes per number — FP16 = 2, INT8 = 1, INT4 = 0.5.
Query / Key / Value are
per-token lists: main kya dhundh raha hoon / main kya offer karta hoon / woh info jo main hand over karta hoon.
The KV cache exists to
har decode step pe past Keys aur Values ko dobara compute karne se bachna (memory ke badle compute trade karta hai).
KV-cache size formula
.
Why not
heads mein sum ho jaate hain, toh sabhi heads ki storage wapas full width mein add ho jaati hai.
Memory-bound vs compute-bound
slow part data move karna hai vs slow part arithmetic karna hai.
Prefill is
poora prompt ek saath padhna — compute-bound.
Decode is
ek token at a time likhna — memory-bound.
Quantization is
real numbers ko bytes bachane ke liye allowed levels ki chhoti set mein snap karna.
Scale formula
.
Why batching helps throughput
weights ek baar padhe jaate hain aur kaafi conversations mein reuse hote hain.