Small LLM1
์ฌ๋ฏธ๋ก ๋ง๋ ์ฝ 5M(4.98M) ํ๋ผ๋ฏธํฐ์ง๋ฆฌ ์ด์ํ ์ธ์ด ๋ชจ๋ธ์ ๋๋ค.
โ ๏ธ ์ฌ๋ฏธ๋ก ๋ง๋ ๋ชจ๋ธ์ด๋ผ ์ฑ๋ฅ์ ๋ฎ์ต๋๋ค. ์ค์ ์ฉ๋๋ก ์ฐ๊ธฐ์๋ ๋ถ์กฑํ๊ณ , ์งง์ ์์ด ๋ํ ๋ฌธ์ฅ์ ์ด์ด ์ฐ๋ ์ ๋๋ง ํ ์ ์์ต๋๋ค.
โ ๏ธ ํ์ธํ๋(instruction tuning / chat tuning)์ ํ์ง ์์์ต๋๋ค. ์ฌ์ ํ์ต๋ง ํ base ๋ชจ๋ธ์ด๋ผ ์ง๋ฌธ์ ๋ตํ๊ฑฐ๋ ๋ํํ์ง ๋ชปํ๊ณ , ์ฃผ์ด์ง ๋ฌธ์ฅ์ ์ด์ด์ ์ฐ๊ธฐ๋ง ํฉ๋๋ค.
๋ชจ๋ธ ์ ๋ณด
| ํญ๋ชฉ | ๊ฐ |
|---|---|
| ๊ตฌ์กฐ | Llama ์คํ์ผ decoder-only Transformer (์ฒ์๋ถํฐ ํ์ต) |
| ํ๋ผ๋ฏธํฐ | 4.98M |
| ๋ ์ด์ด / hidden / heads | 6 / 256 / 8 |
| FFN ํฌ๊ธฐ | 512 |
| ์ดํ ํฌ๊ธฐ | 4,096 (์ง์ ํ์ตํ byte-level BPE) |
| ์ปจํ ์คํธ ๊ธธ์ด | 256 ํ ํฐ |
| ํ์ต ๋ฐ์ดํฐ | TinyStories ์๋ถ๋ถ ์ฝ 40๋ง ๊ฐ ์ด์ผ๊ธฐ (์ฝ 92M ํ ํฐ) |
| ํ์ต | 6,000 step ร 64 ร 256 ํ ํฐ, RTX 5070 1์ฅ์์ ์ฝ 4๋ถ |
| ๊ฒ์ฆ loss | 1.77 (perplexity ์ฝ 5.9, TinyStories ๊ฒ์ฆ ๊ตฌ๊ฐ) |
์ฌ์ฉ๋ฒ
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("aaaaaaaieuyd/Small-LLM1")
tok = AutoTokenizer.from_pretrained("aaaaaaaieuyd/Small-LLM1")
x = tok("Once upon a time", return_tensors="pt")
out = model.generate(**x, max_new_tokens=80, do_sample=True, temperature=0.8, top_k=40)
print(tok.decode(out[0], skip_special_tokens=True))
์ถ๋ ฅ ์์:
Once upon a time, there was a little girl named Lily. She had a little tooth that was very important to her. The tooth was her special tooth, and she could always count on it to show it to her friends.
ํ๊ณ
- ์์ด ๋ํ์ฒด ๋ฌธ์ฅ๋ง ํ์ตํด์ ํ๊ตญ์ด๋ ๋ค๋ฅธ ์ฃผ์ ๋ ๊ฑฐ์ ๋ชป ๋ค๋ฃน๋๋ค.
- ์ฌ์ค ์ ๋ณด, ์ถ๋ก , ์ฝ๋ ๊ฐ์ ๊ฑด ๊ธฐ๋ํ๋ฉด ์ ๋ฉ๋๋ค.
- ์๋ค๊ฐ ์ ๋ง๋ ์ด์ผ๊ธฐ๋ฅผ ์์ฃผ ๋ง๋ญ๋๋ค.
- ํ์ธํ๋์ ํ์ง ์์์ ์ง์๋ฅผ ๋ฐ๋ฅด์ง ๋ชปํฉ๋๋ค.
English: Small LLM1 is a ~5M-parameter toy language model trained from scratch on TinyStories, just for fun. Performance is low, and it is a base model with no fine-tuning (no instruction or chat tuning). It can only continue short, simple English stories.