1

Review of Chapter 2 of Learning LLM from Scratch

힘센캥거루
2025년 10월 21일(수정됨)
1
1
29
Review of Chapter 2 of Learning LLM from Scratch-1

Already in the second week of the challenge.

I hadn't finished Chapter 2 until yesterday, but while attending a two-day retreat, I managed to catch up by coding until midnight.

1. Content

The main focus of Chapter 2 was tokenization, encoding, decoding, and embedding vectors.

I was familiar with others as I had made a one-hot encoder, but the concept of embedding vectors itself was new.

The one-hot encoder creates a three-dimensional matrix for each word, marking that part as 1, while embedding vectors are represented as vectors in a three-dimensional space like x, y, z.

Review of Chapter 2 of Learning LLM from Scratch-2

2. Questions

Questions arose when dealing with embedding vectors.

  • Why are embeddings initialized using seeds to create non-overlapping random numbers?

  • Why is the matrix itself called three-dimensional when it seems two-dimensional?

  • What is the reason for adding token embeddings and positional embeddings?

These questions were resolved using Chat-GPT.

Review of Chapter 2 of Learning LLM from Scratch-3

Embedding vectors act like a dictionary for finding words.

Giving a random function with a seed to the embedding initially scatters the word positions differently in the coordinate system.

Using the same seed to create an embedding results in an embedding identical to the initial one, making the word position the same.

Therefore, by adding token embeddings and positional embeddings, the characteristics and context of the word are simultaneously represented.

3. Review

Though I vaguely understood embedding vectors from the Vercel AI SDK, I now have a clear understanding.

Attempting to express it mathematically is quite challenging, but understanding the meaning makes it more accessible.

I plan to continue working on it steadily.

관련 글

Book Review and Challenge Review of Chapter 7 of *Building an LLM from Scratch*
Book Review and Challenge Review of Chapter 7 of *Building an LLM from Scratch*
Chapter 7 covers the process of fine-tuning a model to follow instructions.In other words, making it give the desired response to a given question.As...
Review of Chapter 6 of *Build an LLM from Scratch*
Review of Chapter 6 of *Build an LLM from Scratch*
Chapter 6 is about fine-tuning for classification.The example used is building a spam classifier.A spam classifier determines whether something is spa...
Review of Chapter 5 of *Building an LLM from Scratch*
Review of Chapter 5 of *Building an LLM from Scratch*
Today is December 14.The challenge period actually ended two weeks ago, but I couldn’t just give up on writing a review.Because these TILs I leave lik...
Impressions After Reading Chapter 4 of “LLM From Scratch”
Impressions After Reading Chapter 4 of “LLM From Scratch”
Today is November 26, so if I finish one chapter a day, I’ll complete the challenge.I’m not sure if I can do it with my first and second kids constant...
Review of Chapter 3 of Learning LLM from Scratch
Review of Chapter 3 of Learning LLM from Scratch
After spilling a bucket of water on my MacBook, I was in shock and wasted about 3-4 days. In retrospect, since my MacBook was already damaged, I should have thought of it as being sent for repair and done something. Anyway, although it's a bit late, I am determined to see it through and leave a review of Chapter 3. 1. Attention Mechanism Chapter 3...
Python OCR Recommendations for MacBook Users
Python OCR Recommendations for MacBook Users
It seems like I've tried every OCR available for recognizing students' medical certificates. I've used various OCRs such as Tesseract, EasyOCR, and PaddleOCR, but none had satisfactory performance with Korean. Recently, however, I discovered a Python library that wraps the Live Text functionality available on MacBook...

댓글을 불러오는 중...