mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-11-26 06:58:23 +00:00
Add alternative attention structure (#880)
This commit is contained in:
parent
6eb6adfa33
commit
bf039ff3dc
@ -168,9 +168,10 @@ Several folders contain optional materials as a bonus for interested readers:
|
||||
- **Chapter 4: Implementing a GPT model from scratch**
|
||||
- [FLOPS Analysis](ch04/02_performance-analysis/flops-analysis.ipynb)
|
||||
- [KV Cache](ch04/03_kv-cache)
|
||||
- [Grouped-Query Attention](ch04/04_gqa)
|
||||
- [Multi-Head Latent Attention](ch04/05_mla)
|
||||
- [Sliding Window Attention](ch04/06_swa)
|
||||
- [Attention alternatives](ch04/#attention-alternatives)
|
||||
- [Grouped-Query Attention](ch04/04_gqa)
|
||||
- [Multi-Head Latent Attention](ch04/05_mla)
|
||||
- [Sliding Window Attention](ch04/06_swa)
|
||||
- **Chapter 5: Pretraining on unlabeled data:**
|
||||
- [Alternative Weight Loading Methods](ch05/02_alternative_weight_loading/)
|
||||
- [Pretraining GPT on the Project Gutenberg Dataset](ch05/03_bonus_pretraining_on_gutenberg)
|
||||
|
||||
@ -11,11 +11,24 @@
|
||||
- [02_performance-analysis](02_performance-analysis) contains optional code analyzing the performance of the GPT model(s) implemented in the main chapter
|
||||
- [03_kv-cache](03_kv-cache) implements a KV cache to speed up the text generation during inference
|
||||
- [ch05/07_gpt_to_llama](../ch05/07_gpt_to_llama) contains a step-by-step guide for converting a GPT architecture implementation to Llama 3.2 and loads pretrained weights from Meta AI (it might be interesting to look at alternative architectures after completing chapter 4, but you can also save that for after reading chapter 5)
|
||||
|
||||
|
||||
|
||||
## Attention Alternatives
|
||||
|
||||
|
||||
|
||||
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/bonus/attention-alternatives/attention-alternatives.webp">
|
||||
|
||||
|
||||
|
||||
- [04_gqa](04_gqa) contains an introduction to Grouped-Query Attention (GQA), which is used by most modern LLMs (Llama 4, gpt-oss, Qwen3, Gemma 3, and many more) as alternative to regular Multi-Head Attention (MHA)
|
||||
- [05_mla](05_mla) contains an introduction to Multi-Head Latent Attention (MLA), which is used by DeepSeek V3, as alternative to regular Multi-Head Attention (MHA)
|
||||
- [06_swa](06_swa) contains an introduction to Sliding Window Attention (SWA), which is used by Gemma 3 and others
|
||||
|
||||
|
||||
|
||||
## More
|
||||
|
||||
In the video below, I provide a code-along session that covers some of the chapter contents as supplementary material.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user