๐Transformers from Scratch-ํธ๋์คํฌ๋จธ ์๋ฒฝ ๊ฐ์ด๋
๋ฅ๋ฌ๋์ ๊ณต๋ถํ๋ค๋ณด๋ฉด Transformer์ ๋ํด ์ตํ๊ฒ ๋ฉ๋๋ค. ์ด ํธ๋์คํฌ๋จธ๋ฅผ ๊ตฌ์ฑํ๋ ์์์ ๋ํด ์๋ ค๋ฉด ์ด๋ค ์ง์์ด ํ์ํ ๊น์? Transformer๋ฅผ ์ดํดํ๊ธฐ ์ํด ํ์ํ ์ง์๋ค์ ์ ์ ๋ฆฌํ ๋ฌธ์๋ฅผ ๊ณต์ ๋๋ฆฝ๋๋ค. ์ด ๋ฌธ์๋ Scratch๋ก ๋ฐ๋ฅ๋ถํฐ ํ๋์ฉ ์ดํดํ ์ ์๋๋ก ๋ด์ฉ์ด ์ ๊ฐ๋ฉ๋๋ค. ์ด๋ฏธ์ง๊ฐ ์ ๋ง ์ ํํ๋์ด ์์ด์, ์ดํด๊ฐ ์ด๋ ค์ธ๋งํ ๋ถ๋ถ์ ์ด๋ฏธ์ง ๋ณด๊ณ ์ดํดํ๊ณค ํฉ๋๋ค! ๋ฅ๋ฌ๋์ ๊ณต๋ถํ์ ๋ค๋ฉด ์ผ๋จ ์ ์ฅํด๋์๊ณ ์ดํ์ ๊ผญ ๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์ :) ๋ด์ฉ์ด ์งง์ง ์๊ณ ๋ง์ง๋ง ํ๋์ฉ ๋ณด์๋ฉด ํ์ต์ ๋์๋ ๊ฒ ๊ฐ์ต๋๋ค! ์ ๋ ํ๋ฒ ๋ค์ ๋ณด๋ ค๊ณ ํฉ๋๋ค :) โจ๏ธ ์ถ์ฒ๋๋ฆฌ๊ณ ์ถ์ ๋ถ - ๋ฅ๋ฌ๋์ ๊ณต๋ถํ์๋ ๋ถ - Transfomer๋ฅผ ๋ฐ๋ฅ๋ถํฐ ์ดํดํ๊ณ ์ถ์ผ์ ๋ถ ๐ ์ค๋ช ํ๋ ํํธ โบ One-hot encoding โบ Dot product โบ Matrix multiplication โบ Matrix multiplication as a table lookup โบ First order sequence model โบ Second order sequence model โบ Second order sequence model with skips โบ Masking โบ Rest Stop and an Off Ramp โบ Attention as matrix multiplication โบ Second order sequence model as matrix multiplications โบ Sequence completion โบ Embeddings โบ Positional encoding โบ De-embeddings โบ Softmax โบ Multi-head attention โบ Single head attention revisited โบ Skip connection โบ Multiple layers โบ Decoder stack โบ Encoder stack โบ Cross-attention โบ Tokenizing โบ Byte pair encoding โบ Audio input