  
 


,  LLM -   .  ,   - ,   ,  ,   .     .

 .  .  .     .  -    :   ,    ,        HBM.  -      :  , , ,  ROI       .

  .   :   ,   ,   .

  .  - ,            .   ,    .

          -   .





 

  





 




  -   ,     .     ,  ,  TCO   RAG -  .  -  .



 



 1.     

 :  .

:     LLM.



 2.     

 :  ,  

:  : , , ROI, .    -   ,     .



 ,   ,  



 

 .   .   -   .  -  -     .



  ()

 ,   . :  .3 - ,    RAG  .5 - ,         .4 - ,      



  ( )

     .  2   ,    .



 ,     



1.  .  - .

  ,      ,   .   ,    .



2.  -  ,  .

       -  .    .



3.     Ȼ.

  ,      ,   .






   




        .      ,      ,            ,   .



  



       .    (LLM)    :      ,  ,     .     ,  ,  ,      .       .

   (    2   ,      ,   ,    ,  LLM  .        .



 



    ,   ,  , ,     .      ,     (TCO),       .



      



         ,  ,  ,     ,     ,   ,   .

 ,  ,      .             ,               .        -       .



    ,     ,         ,      ,           .    .

 ,  (  )    .      .  ,  .



    

 ,            (Qwen)   .



 



      Ȼ,        .



 

     .            .



 

     .       .

         .






 1.  LLM:    









   .                 .    .



 

  (     ).   : ,   ,  ,    .    ,   ,          .



 

  (  ).  ,         ,     .      MoE?     Sparse Attention? .  ,    .     -    .

    .      ,    .



 1

 :   LLM,   ,   ,     .       -  .



 2

   :  ,  AI-,    .      -  .



                  2,  1.

    ,     (attention, fine-tuning, inference) -     .     ,     .



    -  ,    ,  ,   ,  .   -     .    ,         ,   .      ,   .   . . . .   .  .      -    .     , ,   ,  ,    ,     .   -  ,    ,   -   .   -   .   .   ,   ,      ,      .      -     .











  -   ,   ,   "  ".   ,   ,    ,    :  ,    (   ),         .

      ,  ,        .    -      ,        ,     ,      .   -      ,   ,       .

 -  - . ,   ,     ,    .    .   .          .  ,     ,       ,  .



  -    .

             . ,    ,   .       ,   ,     ,   -     .      ,        ,     .



   

        .        .     ,     ,    ,   .

      -   ,    . ,    ,   .       .   -        ,      .



 

   -    ,      

         -  +  = 

     RoPE  ALiBi    

           LLM

     32      

  LSTM  ,   

          

         (:   )

           SFT  RLHF

      

      ,    

   -     ,    

              .



 

   ( ,  )    20242025 ,    -  ,         .






 1.     :    




 -   . ,    ,     -  , -,     






1.1 




-    ,     ,    .       .  ,        ,   ,    .



    ?

   ,     ,  .     ,    , ,  ()    (). ,   !  ?  : [], [!], [], [], [?].   -   ,    .



 :    - ,   ,   ()  .      ,     ,     .



,  -    ,    .        ?      - .



 (Tokenization)

    .    ,         .     (tokenizer) - ,      ,   (tokens).   : BPE (  GPT  RoBERTa), WordPiece (BERT)  SentencePiece (LLaMA, T5, XLNet).



BPE, WordPiece  SentencePiece -   ?



 -    .  ,    :     ,     ?    - BPE, WordPiece  SentencePiece.



BPE (Byte Pair Encoding)



 

      ,     . ,      .





    a b ?   ab.  ab c ?  abc.   .

+ , ,    .

     ( -   ).      (, , ).



 

GPT, RoBERTa.



WordPiece



 

   ,      ,  ,     ()  .



  BPE

BPE    . WordPiece -     (,      ).

+     ,  BPE.

     .   .



 

BERT.



SentencePiece



 

 ,  ,    :

     (      ).

    BPE,  Unigram ( ).



 

  SentencePiece -  ,    .     ,   .       (, , ).

+ ,    .

   -     (    ).



 










   



       

BPE  WordPiece    .     .



       /

  SentencePiece.     ,     -    .



SentencePiece  -   open-source LLM (LLaMA, Qwen, DeepSeek). BPE  WordPiece    (GPT-2, BERT -    ),          .



  :

   (, );

   (, );

   (!, ?).



  -  ,     ,  .



 

 ,       (),      ,      ( OOV - out of vocabulary).



  ()

 .    (32K256K),     ,     . :     ( +   ).



 

  (/ ),   OOV,        ,        .



      -  (BPE, SentencePiece, WordPiece).



   

          .       .      ( 32?000256?000 ) ,      .



     (   - )

 ,  ,   ,  .    .     ,     :    .



   



    .   - , ,   -   .   .           -      ,      .

      ( )        .

             .

   .       ,      .



    



: 

    -   ,   ,    .    ,       .         (   )   -   ,   -         .



: 

  (, ,  ) -      .      ,             (  ).       !     67,        .



  ?

 3245 -    ,  :      -     ,     ,      .   67 ( ) -  ,         .



     ,  ,            .   .










   -      ,      . ,        -.



  

     ,     .   :





    .   (  ) - 1.0-1.5.





?         .  - 1.5-2.0.



/

  .  - 2.0-3.0.



 

  ,        ,   .   -    .       .



 :   ,   .



   ,    : ,  -   ,       - .   .

   -   ,   .      ,   .     ,     . , ,         ,     .



     ,     ,   .   ,  90%  -  ,   BPE  SentencePiece  ,       ,   , ,    .   .



   .   (Qwen, DeepSeek)  ,      ,   .   (GigaChat, YandexGPT)     ,      .                    .



  



           - ,      .     ,    .    ,     ,   ( , GigaChat  Saiga ( LLaMA)),     -  .       .



  ,       .



  :    

   ,      .   ,     ?     -   ,       .    .



  



:    "" (,   "")

:   [] [] []      [] [] [] [] []   (  )

:  [1245] [7890] [3456]



     : 1245, 7890, 3456.   ,    .    ,     (   ) , ,     (     ).



 



 1:  



       , ,    ,    .         .     ,      .



 2:  



   (,    ),        .        ,    .       ,  ,   .

,  ,            ,    .        ,      .

    .        ,      .   -  .       -  .



   



  ,    ,  :

    ,    

        (, ),     -    

        ,      



 



:    " "

 1:     () ? " "

 2:    ? [] [] [] [] []



          .   -  ,     .



   



   

   API (Application Programming Interface)


;

    (         );

  .



,      -.       -  ,        .    ,    - .






1.2 




         - .       :      [3245, 67, 8902, ...]       .   3245  8902 -   


,     .    ,     -      ,     - ?     .

 (Embeddings) -          .



1. 



   



   -     .  ,    , -  .

 ,      -     :



 = 1

 = 2

 = 3

 = 4

 : 1, 2, 3, 4.



   ?



  ,     -   (),     -   ( ).

    1  2 -    ,    1  4.  .

   (1)      (2),     (3).  .

,        ,      ,       .



2. 



    

   .       ,    -    (  ).

    . ,     :



 X:   ( -1 ()  +1).

 Y:  .

 Z:  .



      :



: (: +0.9, : -1.0, : +0.8)

: (: +0.9, : -1.0, : +0.5)

: (: -1.0, : +0.9, : 0.0)

: (: -1.0, : +0.9, : 0.0)



:

 <->  = 0.3 (  )

 <->  =   2.3 (   )



(       ,     ,    ).



3.    ? 



     ,     :  :     .

       (   :  ).

    .





 ,     -   .



    .     ,       ,      . ,            -   ,   .              .



 

    .        ,          .   ,     .

       .      -      ,      .

 ( ):      .      ,       ,   ,    .



  :



 -  +  = .



 ( ):

     -> [0.8, 0.7, 0.3]

 -> [0.7, 0.6, 0.2]

 -> [0.2, 0.7, 0.8]

-------------------------------------------------

 <- [0.3, 0.8, 0.9] ( /)



    ,   .

 :    ,    ?





 ,    (   )       (        ).

 ,  , :

   -      .

   -  (    ).



  



  (, 4096)             ,  .

,         .   ,     -  .         ,    .               ,    .   ,    ?      -  .






1.3   (Positional Encoding)




    ,     ,      .         ,    .               ,    .     ,    .    ,    ?

            .      ,      -  .     ?     ,       ,       .

         -       .    .



RoPE 



RotaryPositionEmbedding /    (  LLaMA, DeepSeek);

     ,       . ,   -  ,     (  ).       ,     .   Rotary           .   - ,  -  ,  -  ...          .



      ?



   -   .       ( ),      ,    .      ,     (    ).      .

,  (Attention)     :    ,        .          .



  





 ( GPT)    .    ,            .



 

      ().  ,           .



RoPE ()

    , RoPE    .     ,       .



  ?





   ,     5- ,      .          (,      "",    - " ").





  ,          (    -         ).



RoPE -        ,      ,       ,     .



   



angle_diff = (pos2 - pos1) / (10000 ^ (2i / d)), 










ALiBi 



AttentionwithLinearBiases /    .

      ,      ,    RoPE.



  

ALiBi   ,     ,    .



  





 ()     .     (,   )  ,   .





       ,   , ALiBi       .

    -   ( ).

   10  -  .

   1000  -  ,  :   , .



  ?



 

ALiBi       ,    :      .





     (),   RoPE.        .



ALiBi -   ,             ,     .      (),   .



RoPE vs ALiBi



RoPE ( ):

   ,   = 

[]?  []??  []???

???????????????????

( ,   )

ALiBi ( ):

   

  = _ -  ? 

 ? :  0.9 - 1?0.1 = 0.8

 ? :  0.3 - 2?0.1 = 0.1



,        .   ,    .     ,      .     -     ,    ,   ,    .    ,  ,     -  .






1.4   (Self?Attention)




      ,      ,       ,       .    ?     ?             .   -     ,       .

       ,       .        ?     .        ,        :



Q - query () -   ?

K - key () -    ?

V - value () -    ?



Q, K, V -  ,     .            ,      -.



,     Netflix  ,   .    -  Q (  ?).      .      -  K ():     , ,  .   ,      .     ,       -  V (),    ,   .



 ,       .   (Q)  ,        (K).    (V)   .        -      ,   -  ,    -  .      ,    .



   ,        ,           (),   ( ),   ( ).



       ,       -   ,    -  ,       GPU (    5.4).

      ,      .



 



 ( Attention(Q, K, V) ) -     V,     Q  K.







Attention (Q, K, V) = softmax ((Q  K^T) / ?d?)  V



Q  K? ( )



     (Q)       (K),  .        .    *i*   *j*  :    *i*     *j*.



/ ?d? ()



      .  ,            .



softmax ()



    ,     1.       (,   ,   70%     ,  20%  ,   10%   ).



 V (  )



      (V).  ,    ,      .







      ,      .    (Decoder-only)      ,      .             (causal attention).

    -  ,      .         ?        .










 

 (>0.5) -  

 (0.2-0.5) -  

 (<0.2) -  



  :

""  "" -   (-)

""  "" -   (   )

""  "" -   (-)



,  ,       .        ,   -  32  128  .               .          .        -  ,    .      , ,  .



  -      .       ,          .            -    .






1.5   (Transformer Blocks)




    ,          .          ,   -       .  ,   :   ,    .      -      .      (  - ),       .

        /      .



1. Multi-Head Attention ( )



    ,     Q, K, V.      : , , , .



 

        ,      ( ).





    Q/K/V,   ,      (, 32 ).



  



   .      (   ),  -  (    ),  - .   ,  .

    ?   ,       .  - ,  - ,  - .    ,   . ,    ,   .   .



 -  ,        (, )         (, , ).

      .        .



 



"  .    ."

   -  (       ).

   -  (       ).



   ,  ,     .      ,  - ,     -   ,  - ,     .        .





    ,         .

,  ,  ,      .  ,   .   :          ,     .    ,      -  .



2. Add & Norm (  ) -  



 



Add ( )

  ,      Attention,      Attention.



Norm ( )

   ,       .



  



Add ( ?)

,    . Attention -    .   ,       .   -     .        ,    .       ,       ( ).       (32+ ),  


 .



  










Norm ( ?)

        .       ,      ,   .





     10 .   ,  ,   .       .  -         ,    ,    .



  










Add -     ,   ,       .     ,      . Norm -   ,         .

     ,     ,      - .     ,  ,      .      -   .



3. Feed-Forward Network (FFN) -   



 

  ,      .





    4  (,  4096  16384 ),   .  -   (, SwiGLU (Swish-Gated Linear Unit)  GeLU (Gaussian Error Linear Unit) -  ,  ) -   ,   ,   ).



  

Attention     (   ). FFN      ().      ,            .





Attention -   (   ). FFN -   ,     ,      .  FFN       ,     .      : Attention -   ,    ,  . FFN -   ,   ,        .  FFN     :      ,         . FFN     ,  ,   .   ,       .



 FFN    ( )



  FFN:   ,   ,   4    .   .    -  -    .     .

     ,       :     ,   -   .   .     .

 ,       ,        .   :      .

       ,   .    .                .

   .  .  .    .



4. Add & Norm (  ) -  



 ,       FFN,    .     ?     ,    .      ,        .



 

  ,     2,       FFN    FFN.





 ,  FFN   ,   Attention.  FFN  ,        .

 ,    .        ,   -  32  128  .    ?   ?

  ,     ,    .       ,     ,        .    .



   


.



 1:   . ,   -   .

 2-5:  ( ).

 10-20:    ( ,   ).

 30+:   , , ,   .



      - ,   OpenAI (2019)   GPT-2,    ,         :         .

   -        .   ,      ,      (-   Add & Norm ).

               1.



,         ,        ,      ,    .  -   ,    .    -   ,   .         ?   -   .






1.6    




   .    ,  -  ,     ,        .        ,        .        ?     ?  -   .

            LM Head (language modeling head /    ) -          softmax.

 ,        .    (  -)     ,        -       .    .      .



1.   Softmax (  )



 -   ,      . ,  = 100,  = 90,  = 1.   ,     ( 1000,  -5).       .

  -   .    100, 90, 1, -5 -      ,      .    ,   .

Softmax -  ,        (),     100%. :  = 60%,  = 39%,  = 1%.



,     :  60%,  39%,  1%.  ,     -    .        .    ,  -  .      .

          .  :



2.  (Temperature)



     - .  ,    . T -> 0 ():           ().   ,    .



T = 1 ():     ( 60%,  39%).

T > 1 ():   .    35%,  34%,    31%.      ,    .



    :    ,    .      - P  K.



3. Top-P (, nucleussampling)



    .



 

            ,      P (, 0.9  90%).   .





   .    (60%) +  (39%) = 99% ( P=0.9 ).  (1%) ,    .       .



4. Top-K (K-)



Top-P     .     -  :   K ,  .     K .    K   ,   .

: K=2.   (60%)   (39%).  (1%) .    .





>  - .

> Softmax -     .

>  -      .

> Top-P -  ,      .

> Top-K -   K   .



   -        ,    .  ,            .

      .  , Top-P  Top-K,      ,   ,     .     .

  .             .   ,       -     .



      .    ,     :    ,   ,    .          ,    .

         ,  ,      .






1.7 :    




 ,    :   ,      .       ,    .



  ?





    ,   ,    ,         .



 

           ,    .

              .

         ,       .

         API,    .



  ?

 ,      .     .     .

 -     :



 

    .    -          .     ,   ,   .     .



 

      .          (     RAG - Retrieval-Augmented Generation    ).     ,          .    ,      ,      -    .



 



 

      .    ,   .    ,    ( )  .       ,      -   .



 

  RLHF    .     ,     - ,    ,      .



     










 :   ,   

 -  ,      .     ,     .

  ,    :



 

        ,     .



RAG (Retrieval-Augmented Generation)

       ( , )  .





    ,    ,     -    .



  Top-P

  ( ? 0)    ,  ,   .





               -   .



    

   ,     (, , ),       LLM   .    :  , RAG,  -,  .



 -      .    -    ,          .






1.8 RAG:     




  1.7  ,   -    .    .    - RAG (Retrieval-Augmented Generation).  RAG     -        :         ,     .





   ,      ( 20242025).     ,    .



 RAG

   ,      ( ),         .      ,      .   : RAG    -        ,       .










    ?   (  )    - .   ,        .      ,         .     - (, intfloat/multilingual-e5-large),         .



 

   ,   .   ,     (  ,     ).      ( Ctrl+F),    .    RAG ,     ,      .



 

  (chunk size)       -     ,    .



   ()

,       .   RAG -  ,        .   RAG -  ,   ,        .            -     :         .        .



 RAG    



 RAG   .       -   .



 RAG   .     ,    .



 RAG  (   + ).    RAG-     :   ( ),    (- )   LLM ().



 RAG 



           (,  -)

         (,  )

       ,    (, )



   



RAG   ,        (,          5 ?) -        ,   .

  RAG      :  ,     ,      -          .



   , RAG -     LLM :    ,     ,   ,     (fine-tuning)       .

  (GDPR, HIPAA,  ) RAG  ,         -      ,    .



  



RAG     -                ,     fine-tuning.



 



 LLM  RAG -    .   ,   . RAG -   . ,  .     (RAG +   )   ,   .



-:  RAG  (  - )



RAG -  .  ,   ,  -  ,   -   .










 

RAG   .      ,       -     ,  .        .





RAG -    .  .       -     RAG.



 ,  RAG   (  )



  RAG,        .  ?



 1.   (   )



 RAG

  5 .   .   ?   -    ,     .



 ( )   ?    ,     .



   ?  ,     .



   / ?  multilingual-e5-large   .



 2. Reranking ( )



  2050    .     -- (,  ),     35  .     RAG- (, Cohere Rerank, BGE-reranker).



 3.    fallback



       (, 0.7) -     ,    .   :

         - : "  .  ".  .

     .   , ,    ,  .



 RAG:    

 RAG (  + LLM)  ,     -  .   ,       ,   .



  



       ?

  ,     ?

    X      ?

     .        ,         .



  (GraphRAG)





     -  (, , , )     (,  ,  ).       ,      .



:

  ,    ?



    .

     ?  .

      ?  .

      ?  .

LLM    ,    -    ,  .



GraphRAG      ,   (multi-hop)  5070%     RAG.        ( ,   ,  ).



    ( ,  )

     ,       -    RAG    .



 

 BM25 (   ,    )   ( ). BM25   A-457,  -    .            .





 ,    (, ,   ).    ,  :       ,     LLM.



 ()

    2050  (, ),   -- (, )    -35  .






  1




 -      (  ,    ),        .



       BPE  SentencePiece;    32K256K .



   -:  - 1.0-1.5   ,  - 1.5-2.0,  - 2.03.0,     .



   ()   -     ,       .



  -  ,    .   (, ,  , )   .      ,    ,        .     -    .

    ( 1.0-1.5,  1.5-2.0,  2.03.0) -    ,   .     .           .   (Qwen, DeepSeek)   (GigaChat, YandexGPT)  ,        ,  ,    .



  :  -  +  = ;     .



      ;   : RoPE ( )  ALiBi (  ).



  (Self-Attention)       Q (), K (), V ().



 : Attention = softmax(QK/?d)V,       (, , ,  ).



 - ,          (  .   );       .



Multi-HeadAttention -    ,      (, , ).



FFN (  )        ;  FFN     .



Add & Norm (  + )         -     .



 :      ,  -   ,  -  , , .



    Multi-Head Attention, Add&Norm, FFN   Add&Norm; 32128      .



 -    .   -   ,          .   ,   ,   ,    .  : RAG,  , , ,   -      .



RAG (Retrieval-Augmented Generation) -    :              .       -    ,     .   ,    (, ,   ). :    ,   .






  




1.          ,    ?



2.   ,        .



3.        RoPE  ALiBi?        ?



4. ,         Attention (Q, K, V) = softmax(QK/?d)V.



5.      ,     (Multi-Head Attention)?



6.     (Add)   (Norm)   ?



7.     ,   FFN-    Attention?



8.          ?



10.   RAG?      ?        ?






 2.   




   -     ,  ,      ,    -     

     ,      -  ,      -.      .      ,     ,                .  ,         ,    .          ,  ,      ,           .

  ,                ,    . Ÿ   -    ,     ,        .






2.1 CNN Convolutional Neural Network /         




   (convolution) -     .      : , ,  .    .

,      ,    ,    .     (convolution).

         -    .



1.   (  ?)



 

,   -   10x10 .   -    3x3  (   ,       ).



 

       ,   9  .     1  ,  .   -   .     .



2.   (  ?)



        -  (  ).  -  .      ,       .



    

       ()  (),    .   ,   .



   

   .



   

   .



 

       .         ,   ,     (,   ).

   , , .       ,    ?        -  .



3.   (  ?)



  

    .     , ,   .     ,  ,   .



  

   .       ( ),     (, ),        (, , ).



   (3 )



1.   ()

     1000x1000         3    ,       1000x1000,  3?10??  -   .



2.    (,  )

,    ,       - , , .   ,     .



3.  

       .

      (, ) - , .

      (, ).



    ?



      .       ,        .        ,    .      (),      ,   ,       .

,         ,       .    :       ,         .         -  .           .






2.2 RNN (Recurrent Neural Network /         )




   ,              .      -    ,  , ,     .     ,    . :   -       .

,    ,       -      ,     .     .  ,           .



RNN     ,   .        .   .

  RNN     :      -  ,      .   ,        .



1.   (  )



 

 RNN    -    (hidden state).   ,         .





   ,      .



2.     ()



RNN      .      ,   .

     



  :



 1(): 

    +   ( ).   :  .



 2 (): 

    +   (  ). :  - .  :   .



 3 (): 

    +   (  ,  ). :   . .



  



  =  ( ,  )



3.  1:    ()



     ,      ,      .

   :      (),   .     ,   .      .

 ,         , RNN    -      ,      .     .



4.  2:    ()



    RNN.  :   1991 ,    ,      ,  ...   .

 ,     ,        .

 RNN              .     ,   ,         ( ).   ,     ,         -       .





RNN    5-10 ,  ,     .     .

    ,             (gradient clipping).      -    ,      RNN  .



   ?










RNN

  ,          .   ,      ,     .    ,           .



     .  ,    RNN,   ,  ,  ,   .   LSTM -   .   -   .






2.3 LSTM (Long Short?Term Memory /              )




         -   . RNN     ,  ,     ,  .         .    ,  ,  ,      .    LSTM.



LSTM -   RNN  : ,   .     ,      .



LSTM   Long Short-Term Memory -   .     :         ( RNN),        .  ,    .

 ,  LSTM    RNN, ,   RNN -  ,          ,   . LSTM      :      -    ,    ,  .

     ?  LSTM    ,           ,   .     ,     .



1. ,   LSTM



 RNN    .    ,    . LSTM    -   (cellstate)   (gates),  ,       .



2.    ( )



 LSTM    ,    .    :  (1) ... ( ) ... (2)   (3) .

   LSTM.    ,   ,      (    ).          .



 1:   (Forget Gate) -  ?



:

           ?

     ,  :    ,   .

     ,      ,   ,     .



 2:   (Input Gate) -   ?



:

     ()         ?

 :  ,   , .     .



 3:  (Output Gate) -   ?



:

     ( + ),        ?

       (    ),         .



3.  LSTM  RNN?



  , LSTM       .

:      . LSTM     ,  .  50    . LSTM   ,     ,     . RNN      ,   .



4.  (   )



LSTM   ,     RNN - :



 

  1000- ,     999 .    (GPU),     ,   .





        .   -      ,  LSTM      ,   RNN.



LSTM

 RNN   .      ,  ,     (forget gate),    (input gate)      (output gate).    ,     ,       .

LSTM   ,    -   .    ,       ,   .     - GRU,    .






2.4 GRU (Gated Recurrent Unit /    )




GRU

   LSTM,           (update gate).  GRU     ,      -   .     2530%       ,      ( ) LSTM   slightly better .



 LSTM,    .     GRU      . ,  ,     - -     .

,  LSTM -     :  ,   (forget gate),  -    (input gate),  -     (output gate). GRU   :



Reset gate - : ,          ( ).



Update gate - :     -           (  input  forget gate).



?   -   ()   . GRU  ,  LSTM,         .        , LSTM   .



 



         (Google Translate, .).

         (Siri, ).

         (  , -).

          (  , ).

         (   ).



   LSTM



LSTM      ,  GRU ,        ,    ,   .

RNN, LSTM, GRU -         ,         :    .     ,       .   2017   .   -    .






2.5  (Transformer)




 ,       - CNN, RNN, LSTM, GRU -     ,      . CNN    , RNN   , LSTM  GRU    -  .   .

  2017   Google      AttentionIsAllYouNeed.    - ,       .

        ,    .     ,     ,       .          ,   ,           .         ,    ,      .



  ?





 -   ,      (self-attention).              .          ,   ,       GPU.





,      ,      .              ,      .    .



 ,    



    ,    ,    :



1.  (Self-Attention)

       ,    .   ,    .



2.  (Parallelism)

   ,    .        ,    .



3.  (Multi-layer)

     :

 1:  ->  5:  ->  15:  ->  30: 



   Transformer

   ,      -  ,      -      .



  










1. Decoder-only ( )



 

   (causal attention) -      .    ,      .





 ,   .



 

  - - GPT, GigaChat, DeepSeek, LLaMA, Mistral, Grok.





 ,    ,   ,    .



2. Encoder-only ( )



 

   (bidirectional attention) -     ,   .  ,          .





  ,     . , ,  .



 

BERT, RoBERTa.





  ,    ,        ,     .



3. Encoder-Decoder (-)



 

   :     (),     ().





,       : , , .





T5 (Text-to-Text Transfer Transformer), BART (Bidirectional and Auto-Regressive Transformer).





 :      (),    ().



 :   



      -.     ,  - ,  -     .     .



BERT:  



BERT (Bidirectional Encoder Representations from Transformers) -    Google,    2018      NLP.





        : MLM  NSP.





  .





 ,    ( ),   ,  .

  BERT      ,    -  . BERT  ,    ,      .                    .



  BERT










BERT:   



:  BERT  RoBERTa



BERT   ,    ,    .  ,  ,   -     .

RoBERTa (Robustly optimized BERT approach) -   BERT  Facebook.



 



   NSP (  )

   (160GB  16GB)

   ( )

   (   )





RoBERTa   BERT   .



T5:   



T5 (Text-to-Text Transfer Transformer) -   Google,    .



 

  NLP-       -   .



  T5










BART:    



BART (Bidirectional and Auto-Regressive Transformer) -   Facebook,     BERT  GPT.



 

   BERT () -  

   GPT () -  



 BART  ,       -         :       .   BART        ,       - ,         .



 

 ,     (,  , ),     .



 :    










   .



  :    

           .       ,        .



 1:    



        .    O(n?)     -      .    10     ,   100    ,    -       (      4).       ,   .



 2:   



         ,          .    -        .   ,   ,      ,      .



 3:     



  KV Cache     .   ( ),     ( ),   -         .  ,      ( ,  ),     .

 -   LLM,     ,        RNN/LSTM/GRU     (Mamba, RWKV)   .      



,    



    .   ,           ,   .



State Space Models (SSM) -  



     (, Mamba)    :      ,      .  - O(n)  O(n?).           . Mamba  ,   ,     ,       .    -     ,     .



RWKV (Receptance Weighted Key Value) -  RNN



RWKV -  ,      .  RNN,         .  ,   ,   ,       GPU. RWKV         ,         .



RetNet (Retentive Network)- 



RetNet  Microsoft    ( )      ( ).              .



 

         ,        .



            -  ,  ,   ,     .  Mamba, RWKV  RetNet    .           : loss    ,  - ,   -     .     ,   - ,     .



      : .



    , ,    .  Mamba  RWKV       ,  ,     .          -   .         -     .



   ?



 , .    -,      ,    .   ,        ,     .  ,  -   ,      .



   ,      :



        -  .

           -   Mamba  RWKV.

          -    SSM-,   .



   -  ,       .   ,     .   ,      .         ,    ?

  ,        -   (MixtureofExperts, MoE).        .






2.6 MoE (Mixture of Experts /  )




     ,       . GPT-3   175       .    .      :        ,    ,     ?    MoE -  .

,    FFN      (experts).       ,    ,   (router).       ( ),         .

MoE -  ,         ,    ,      .



 ()

 ,      100  : , ,   ..    (),  ()  ,     - ,     .  98     .

    100  ( ),        ( ).      ,        .

      MoE:    ()   ,       .        .



   



            FFN.  MoE   FFN    FFN -    .   -       softmax,             K  ( K=1  2).   -     .

 ,        :     -        .  ,   ,   - .

 :     ,   K   ( K=1  2).      ,    .



  



  MoE



    .       (  ),          .        .





 Mixtral 8x7B    - 47 ,       13  (2   8).    ,  -   .



 



LLM-

GPT-4 ( 16 ), Mixtral (8 ), DeepSeek-V3 (256 ,    6), Grok.





    ,  ,   -      .



    





   -       .   ,     -  ,  .



  

           ,   .    (DeepSeek)    ,   .        (auxiliary load-balancing loss)     ,          12 .      ,      .



 

        (auxiliary loss)   .  -     ,  .       ,         -   ,   .



MoE -     ,      .   =  ,   =  . ,        ,     .

      .      ,      -  .      (    ),   .   -   .






2.7 Diffusion Models ( )




    ,    -   RNN   MoE-.      ,     , -  .      GAN-


 (Generative Adversarial Networks),       .      -  ,     Midjourney, Stable Diffusion  Kandinsky.

       ,     ,  .    .

    ,    -      . ,        ,       ,     .



1.   (  )



    ().       ,       -     ( ? ).

   :   ()     .



    

    .

 ,   ,      (    ).

          -  .



          :     ,  .



2.     ()



   










  



,       (   ).      : ,   ,   ,   -  .      ,   .



3.   (  )



   (Text-to-Image)

       ,  :



 ? 

     (   ).



 

    .            :   ,    ,  ""?.   - .





, , 50  ,     .



 

 Stable Diffusion, Kandinsky, Midjourney:   .

 Inpainting ():    -    ,   .

 Super-resolution:     (  ,   ).

   3D:         .



4.     GAN-?



    GAN,    :  ,  .  ,    ( ,       ).



 



 

   -    (MSE, Mean Squared Error -   ),  .





    ,       .





   (, ,  )    .



 

GAN-   .  ,           , GAN-      (, StyleGAN3).     -  (Midjourney, Stable Diffusion)     ,     GAN-  .



 

 ,       ,     .        ,   .  ,     ( 2050  ),      .






2.8   :    




 ,     .     -    -   ,    .    :  -  ,   .



     (VisionTransformer, ViT)



,             - , 16?16 .   () -   .    ,      .

   :   -   16?16?3 = 768  ( ,      ).         .      ,   -        :    ?     ?  ?

      ,   768       (, 4096).   ,  .      4096  ,        : , ,   .             (, , ),  4096  -     ,  .



 -     



       (  ,     -        ).

     :     ,   -  ,     .

    :   (, )   (, , ).



   



    .  .  ,       (),   .    ,            .

  -    .   -    - .   -  .

       :     ,    .   -     ,   .  -  ,    .





 -   .   ,     : ,   .     ,       ,    - ,       .   -      ,        -.



,      -      ,      ,  ,       .   ,        .   -    .   ,   .     -       ,   .   -   .






  2




CNN ( )      ;   ,     -   .



RNN ( )   ,  -,        .



LSTM    (, , )    (cell state),    ,   .



GRU -  LSTM    (reset  update),  2530%  ,  ,      .



       .      :    (O(n?)),           .



Decoder-only (GPT, LLaMA) -  ,     ;    -.



Encoder-only (BERT, RoBERTa) -    ( ),   ;     .



Encoder-Decoder (T5, BART) -     ;     .



MoE ( )   FFN  ,   12  ;         .



       ;  GAN-  text-to-image     (Midjourney, Stable Diffusion).



  - State Space Models (Mamba)   (RWKV, RetNet)    O(n)       .  -         .



  .   -   ,   .     :     ,       .     ,   - .



   .    (Jamba, S4)       SSM:           .  ,    .



  

    .      - .        - Mamba  RWKV.        - .   ,      .



 :      .      (),        ,     -      .    ,      ,     :  -     ,  ;  - ,    .      Vision Transformer (ViT)     Stable Diffusion.






  




1.  CNN,    ,     ?



2.      RNN   LSTM    ?



3.   LSTM  GRU   ?



4.   : decoder-only, encoder-only, encoder-decoder.     .



5.           (SSM, RWKV)   ?



6.          MoE.



7.       GAN?     text-to-image?



8.    ?           ?     ,     ?






 3.  




      -   ,    .   -   .   ,   ,    .

     :     -    ,   .



  



1. Pre?training ( ) -        .  ,      .



2. SFT (SupervisedFine?Tuning,   ) -      ?  .    .



3. RLHF (ReinforcementLearningfromHumanFeedback,         ) -   ,   .     .










      . ,   ,    ,   RLHF    ,      .






3.1 Pre?training ( )




,       .          -  , , .    ,      ,   ,   , , .     .

 :          .       ,   .  ,     .

      ( ).  -    (next token prediction).     (self?supervised learning) -      . :   , ,  .

Pre-training -    " ".   ,     .



   :   



    ,      .  .    -        ,    .   100  ,    30% -  , 20% -    ,  10% -   ,       ,    .



  ,    





           (,   ).     ,   ,   .



 

   ,   ,   -        .



 

     ,      . ,    ,   - ,     -     .



    

   ,    ,   ,    . RLHF   ,      ?



      





   (  ,    ).



  

 ,   ,  ,  .



 

   ,   ,      .



   

     ,         .



Safety-

      (     -).



 



    ,   ,     .   ,    ,      . ,        10  ,   :      ?    - ?    ?          ,   .

      ,     ,    .    GPU  ,    .  ,  ,   -      ,    .    -  :       ,   ""   .

       ?        -   GPU,       -.




  .


   .

   ,     (https://www.litres.ru/book/sergey-degtev/inzhiniring-iskusstvennogo-intellekta-73943993/)  .

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


