 LLM  .  :   16 VRAM?
 


 -        .  LLM  16  VRAM: ,  , , -, RAG, OpenCode  tool calling.  , ,  . 12     .





 LLM   

   :   16  VRAM?



 



  GPT Image 2



  , 2026

  GPT Image 2, , 2026



ISBN 978-5-0071-7049-9

     Ridero




 I. :  16    





 1.  VRAM:  ,     


    14     Q5.         10 .   16  VRAM.      32 000        ,   3 /,        RAM.  ,   VRAM  .

    ,    .  ,  :     ,   ,         .        ,          16 .



1.1.     VRAM

      ,    ,  .     ,  .



  (weights).  ,   .        ,      .       ,        ,     10 .



KV-.  ,          attention    . KV-     .      .  32K128K      ,   .



  (activations  attention workspace).  ,      .      ,    batch size     .



    .  ,  CUDA  ROCm,  ,    .  16     0,51 ,       .

 .  Windows  VRAM   WDDM (Windows Display Driver Model),     .  Linux    ,       CUDA/ROCm.



           . ,      :   15% VRAM  (  ,   ).    ,      ,    .






. 1.1.  VRAM:      15%



1.2. :      

    ,      .



:   ? (  ?   ) / 8.

 7B  FP16: 7 ? 10? ? 16 / 8 ? 14 .  7B  Q4: 7 ? 10? ? 4 / 8 ? 3,5   ;   GGUF  4,04,5  -    .

     .       (Q, K-quants, IQ)    .

 | 7B | 12B | 14B | 24B | 27B | 32B

FP16 | ~14  | ~24  | ~28  | ~48  | ~54  | ~65 

Q8_0 | ~7  | ~12,8  | ~14,6  | ~23,7  | ~27  | ~34 

Q6_K | ~5,5  | ~9,8  | ~11,3  | ~18,3  | ~22  | ~26 

Q5_K_M | ~4,8  | ~8,5  | ~9,8  | ~15,9  | ~19  | ~23,1 

Q4_K_M | ~4  | ~7,3  | ~8,4  | ~13,6  | ~16  | ~19,5 

Q3_K_M | ~3,1  | ~5,8  | ~6,8  | ~10,5  | ~12  | ~15,9 

Q2_K | ~2,2  | ~4,5  | ~5,5  | ~8,5  | ~9,5  | ~12,3 



. 12B   Gemma 4 12B (Q4_K_M 7,3 , Q5_K_M 8,5 ; canitrun.dev). 14B   DeepSeek-R1-Distill-Qwen-14B (Q4_K_M 8,37 , Q5_K_M 9,79 ; modelfit.io). 24B   Mistral Small 3.x 24B (Q4_K_M 13,6 , Q5_K_M 15,9 , Q3_K_M 10,5 ; cooconsbit.com). 32B   Qwen2.532B (Q4_K_M 19,5 , Q5_K_M 23,1 ; gigagpu.com). 7B  27B  [ :    Llama-3.18B  Qwen3.827B].



   : 24B dense  Q4_K_M   ~13,6   .  16      ~23   KV-  .     ,    32K.






. 1.2.      



  MoE.  Mixture-of-Experts     :    ( )     (,       ).     ,  VRAM   ,      - . 30B MoE  3B    Q4  ~17     ,  27B dense.

 . K-quants (Q4_K_M, Q5_K_M)          :     . IQ- (IQ2_XS, IQ3_XXS)           ,      .



 .     MoE  ,     ,  dense-    .  VRAM   .



1.3. KV-:   

KV-     ,     .  -  ,      ,      8K  32K.

   KV-:    attention         (key)   (value)   KV- attention.  :

KV- ? 2 ?  ? KV- ? head_dim ?  ? __



 2      ,  . __    KV-: FP16  2 , Q8  1 , Q4  0,5 .

 Qwen3 8B: 36 , 8 KV- (GQA), head_dim 128.  8K   FP16:

2 ? 36 ? 8 ? 128 ? 8192 ? 2 ? 1,2 

 32K   ~4,8 .  128K  ~19 ,      16 .






. 1.3.  KV-    (Qwen3 8B: FP16  Q8)



 . GQA (Grouped-Query Attention)  MQA (Multi-Query Attention)   KV-,    KV-,   . , Qwen3 8B  8 KV-  bf16  144 KiB KV-  . MHA-  32 KV-    4  .



  :      .     KV-.   KV- (, Q8)   ,      .

 .   128K   ,     .      ,        .



1.4.     

 ,   ,     .



  (activations).  ,       .     batch size   .  batch size 1      .   batch   prefill (    )  .



Attention workspace.     attention. Flash-attention   ,   .      flash-attention workspace    .



 . ,  CUDA/ROCm,   , .    16     ~15,3  (;     ). [:     .]

 .  nvidia-smi ( rocm-smi)     .              .      .  : 0,51,5       .



1.5.  :  

   .    :

1. .     ,     (   ).

2. KV-.          KV-.

3.  .  0,51,5      prefill  batch.

4.  .  0,51     .

5. . ,   ? 85%  VRAM.

         16  ( ~15,3 ,    15%):

 |  |  |  | KV (FP16) |  +  |  | 

 | 8K | Gemma 4 12B Q4_K_M | ~7,3  | ~0,5  | ~1,5  | ~9,3  | 

RAG | 32K | DeepSeek-R114B Q4_K_M | ~8,4  | ~3,0  | ~2  | ~13,4  | 

RAG | 32K | Mistral Small 24B Q4_K_M | ~13,6  | ~5,0  | ~2  | ~20,6  |  

RAG | 32K | Mistral Small 24B Q3_K_M | ~10,5  | ~5,0  | ~2  | ~17,5  |  

 | 64K | gpt-oss 20B MXFP4 | ~12,1  | ~2,0  | ~2  | ~16,1  |  ;  Q8 KV






. 1.4.  VRAM     16 



.      (.  1.2). KV-  Mistral 24B: 16K ~2,5 , 32K ~5,0  (cooconsbit.com). gpt-oss 20B MXFP4: 12,1  (GitHub).



 .     ,  32K   . KV-  32K  24B-   ~5 ,       ,      .



 

1.  VRAM =  + KV- +   +  .

2.      ,   .

3. KV-    ;        ,   .

4. MoE-  VRAM     ,    .

5.  ~15% VRAM  ( ):      .





1.     14B  Q6_K  Q4_K_M.   .

2.  Mistral Small 24B  KV-  8K, 32K  128K  FP16  Q8.

3.  nvidia-smi/rocm-smi     .     .

4.   RAG  32K      ,     16    15%.



 

,      VRAM,           .   2  Ollama, LM Studio  llama. cpp:   ,      (offload)  KV-,        .




 2.  : Ollama, LM Studio, llama. cpp


               16  VRAM.   45 /   .   30 /   OOM.   12 /      RAM.  .  .    .

         LLM: Ollama, LM Studio  llama. cpp.  ,    ,   ,    ,    .



2.1.     



         GGUF (GPT-Generated Unified Format).  ,          : ,  ,  .      Hugging Face   GGUF,      .

       RAM,  VRAM  .  llama. cpp    n-gpu-layers,  Ollama   num_gpu  Modelfile,  LM Studio   GPU offload.  :     GPU,    RAM,   ,     RAM ,   VRAM.







. 2.1. Offload:   GPU   RAM



    OpenAI- endpoint.  ,   ,     OpenAI API ( OpenCode),        endpoint.

   ,   .      .






. 2.2.     OpenAI- 



2.2. Ollama:  

Ollama   ,       .       .



Modelfile.    Ollama  .    ,     ,     .    14B-  Q4_K_M:

		FROM deepseek-r1:14b-q4_K_M
		PARAMETER num_gpu 28
		PARAMETER num_ctx 16384
		PARAMETER temperature 0.7
		SYSTEM    .     .

num_gpu 28 ,  28    GPU,    RAM. num_ctx 16384   .         VRAM  Ollama.



 . Ollama  OpenAI- endpoint  localhost:11434.  ,  OpenCode, Continue, Cline           .



 .  ,  ,     .



.    KV-  flash-attention,   llama. cpp.    .

 . Ollama  ,      GPU,    VRAM.  ,   :     GPU  ,   .



2.3. LM Studio: GUI  

LM Studio      .       ,     .



GUI.     ,   ,      GPU,    VRAM   .



 . LM Studio  OpenAI- endpoint  localhost:1234.



 . ,  ,        .



.  ,   -.    GUI,     .



2.4. llama. cpp:  



llama. cpp    ,       .    ,         16  VRAM.



llama-server.   llama. cpp,   OpenAI- endpoint  localhost:8080.     14B-   32K   KV-:


llama-server \

 m deepseek-r1-14b-q4_K_M.gguf \

 n-gpu-layers 28 \

 ctx-size 32768 \

 flash-attn \

 cache-type-k q8_0 \

 cache-type-v q8_0 \

 host 0.0.0.0 \

 port 8080



  n-gpu-layers 28  28   GPU.  ctx-size 32768  .  flash-attn  flash-attention,      attention workspace.  cache-type-k q8_0   cache-type-v q8_0  KV-  8 ,         FP16.




  .


   .

   ,     (https://www.litres.ru/book/andrei-ladygin-34142017/lokal-nye-llm-na-potrebitel-skoi-videokarte-ot-kvantizatsii-74927617/)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


