« Cache clé-valeur » : différence entre les versions


(Page créée avec « ==en construction== == Définition == XXXXXXXXX == Français == ''' XXXXXXXXX ''' == Anglais == '''KV Cache''' a KV cache stores intermediate key (K) and value (V) computations for reuse during inference (after training), which results in a substantial speed-up when generating text. The downside of a KV cache is that it adds more complexity to the code, increases memory requirements (the main reason I initially didn't include it in the book), and can't be us... »)
 
m (Claude COULOMBE a déplacé la page KV Cache vers Cache clé-valeur)
 
(5 versions intermédiaires par 3 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
==en construction==
== Définition ==
Technique d'optimisation utilisée pour accélérer l''''[[inférence]]''' dans les '''[[Modèle|modèles]]''' d''''[[apprentissage automatique]]''', en particulier dans les '''[[Modèle autoattentif|modèles autoattentifs]]'''.
 
Elle consiste à cacher les clés et les valeurs antérieures afin d'éliminer le besoin de les recalculer pour chaque nouveau '''[[segment textuel]]'''. Ceci réduit considérablement la taille des '''[[Matrice|matrices]]''' et accélère les calculs.


== Définition ==
Autrement dit, le modèle utilisant cette technique réutilise les calculs passés pour obtenir des résultats plus rapides, ce qui lui permet de rester rapide même avec des textes plus longs et d'éviter les calculs répétitifs.
XXXXXXXXX


== Français ==
== Français ==
''' XXXXXXXXX '''
'''cache clé-valeur'''
 
'''cache KV'''


== Anglais ==
== Anglais ==
'''KV Cache'''
'''KV Cache'''


a KV cache stores intermediate key (K) and value (V) computations for reuse during inference (after training), which results in a substantial speed-up when generating text. The downside of a KV cache is that it adds more complexity to the code, increases memory requirements (the main reason I initially didn't include it in the book), and can't be used during training. However, the inference speed-ups are often well worth the trade-offs in code complexity and memory when using LLMs in production.
''A technique used to accelerate the inference process in machine learning models, particularly in autoregressive models. It involves caching the previous keys and values, so we don’t need to recalculate them for each new token, thus reducing the size of matrices used in calculations, making matrix multiplications faster. The model employing this technique reuses past calculations for faster results, so it stays fast even with longer texts by avoiding repeated work.''
KV cache is a technique used in transformer models to improve inference efficiency by storing key (K) and value (V) states of previously computed tokens. This allows the model to avoid redundant computations during the generation of new tokens, thereby reducing the time and resources required for inference


<!-- a KV cache stores intermediate key (K) and value (V) computations for reuse during inference (after training), which results in a substantial speed-up when generating text. The downside of a KV cache is that it adds more complexity to the code, increases memory requirements (the main reason I initially didn't include it in the book), and can't be used during training. However, the inference speed-ups are often well worth the trade-offs in code complexity and memory when using LLMs in production.
  KV cache is a technique used in transformer models to improve inference efficiency by storing key (K) and value (V) states of previously computed tokens. This allows the model to avoid redundant computations during the generation of new tokens, thereby reducing the time and resources required for inference-->
== Sources ==
[https://arxiv.org/html/2407.18003v1  Source : Arxiv]


== Source ==
[https://huggingface.co/blog/not-lain/kv-caching  Source : huggingface]
[https://huggingface.co/blog/not-lain/kv-caching  Source : huggingface]


[https://cyrilzakka.github.io/llm-playbook/nested/kv-cache.html  Source : The Large Language Model Playbook]


[[Catégorie:vocabulary]]
[[Catégorie:vocabulary]]
[[[[Catégorie:publication]]

Dernière version du 10 mars 2026 à 18:27

Définition

Technique d'optimisation utilisée pour accélérer l'inférence dans les modèles d'apprentissage automatique, en particulier dans les modèles autoattentifs.

Elle consiste à cacher les clés et les valeurs antérieures afin d'éliminer le besoin de les recalculer pour chaque nouveau segment textuel. Ceci réduit considérablement la taille des matrices et accélère les calculs.

Autrement dit, le modèle utilisant cette technique réutilise les calculs passés pour obtenir des résultats plus rapides, ce qui lui permet de rester rapide même avec des textes plus longs et d'éviter les calculs répétitifs.

Français

cache clé-valeur

cache KV

Anglais

KV Cache

A technique used to accelerate the inference process in machine learning models, particularly in autoregressive models. It involves caching the previous keys and values, so we don’t need to recalculate them for each new token, thus reducing the size of matrices used in calculations, making matrix multiplications faster. The model employing this technique reuses past calculations for faster results, so it stays fast even with longer texts by avoiding repeated work.

Sources

Source : Arxiv

Source : huggingface

Source : The Large Language Model Playbook

[[

Contributeurs: Arianne Arel, Claude Coulombe, wiki