HybriKo: Korean Hybrid Language Model
RNN๊ณผ Attention ๋ฉ์ปค๋์ฆ์ ๊ฒฐํฉํ Griffin ์ํคํ ์ฒ ๊ธฐ๋ฐ ํ๊ตญ์ด ํ์ด๋ธ๋ฆฌ๋ ์ธ์ด ๋ชจ๋ธ์ ๋๋ค.
๋ชจ๋ธ ์์ธ
- ํ๋ผ๋ฏธํฐ: 117.8M
- ์ํคํ ์ฒ: 2:1 RNN-to-Attention ๋น์จ (Griffin ๊ธฐ๋ฐ)
- ์ปจํ ์คํธ ๊ธธ์ด: 1024 ํ ํฐ
- ์ดํ ํฌ๊ธฐ: 32,000 (SentencePiece)
- ํ์ต ๋ฐ์ดํฐ: ํ๊ตญ์ด ์ํคํผ๋์
ํ์ต ๊ฒฐ๊ณผ (Exp3)
| Phase | Steps | Loss | PPL |
|---|---|---|---|
| Phase 1 | 0-10K | 1.80 | ~6.0 |
| Phase 2 | 10K-30K | 1.60 | ~4.95 |
์ํคํ ์ฒ
HybriKo (117.8M params)
โโโ Embedding (32000 โ 768)
โโโ Layers (12x)
โ โโโ Layer 1,2: GriffinBlock (RNN)
โ โโโ Layer 3: AttentionBlock
โ โโโ (ํจํด ๋ฐ๋ณต)
โโโ LM Head (weight-tied)
์ฃผ์ ํน์ง:
- RGLRU: Real-Gated Linear Recurrent Unit
- GQA: Grouped Query Attention (1:4 KV reduction)
- Flash Attention 2: ์ต์ ํ๋ ์ดํ ์ ์ฐ์ฐ
- GeGLU: FFN์ Gated activation
๋น ๋ฅธ ์์ (Google Colab)
import torch
from hybridko.model import HybriKoModel, HybriKoConfig
from hybridko.data import load_tokenizer
# ๋ชจ๋ธ ๋ก๋
config = HybriKoConfig.from_yaml("config.yaml")
model = HybriKoModel(config)
model.load_state_dict(torch.load("pytorch_model.pt"))
# ํ ํฌ๋์ด์ ๋ก๋
tokenizer = load_tokenizer("HybriKo_tok.model")
# ํ
์คํธ ์์ฑ
from hybridko.inference import generate_with_cache
output = generate_with_cache(model, tokenizer, "ํ๊ตญ์ ์๋๋", max_tokens=50)
print(output)
์ฌ๋ฌ ํ๋กฌํํธ ํ ์คํธ
prompts = ["ํ๊ตญ์ด", "๋ํ๋ฏผ๊ตญ", "์์ธ", "์ธ๊ณต์ง๋ฅ", "์ค๋ ๋ ์จ๊ฐ"]
for prompt in prompts:
input_ids = torch.tensor([[2] + sp.EncodeAsIds(prompt)]).to(device)
output = model.generate(input_ids, max_new_tokens=30, temperature=0.8, top_k=50)
generated = sp.DecodeIds(output[0].tolist())
print(f"๐ {prompt}")
print(f" โ {generated}")
print("-" * 50)
ํ์ผ ๋ชฉ๋ก
pytorch_model.pt: ๋ชจ๋ธ ๊ฐ์ค์น (450MB)config.yaml: ๋ชจ๋ธ ์ค์ HybriKo_tok.model: SentencePiece ํ ํฌ๋์ด์ HybriKo_tok.vocab: ํ ํฌ๋์ด์ ์ดํ
์ธ์ฉ
@misc{hybridko2026,
title={HybriKo: Korean Hybrid Language Model},
year={2026},
url={https://huggingface.co/gyunggyung/HybriKo-117M}
}
๋ผ์ด์ ์ค
Apache 2.0
- Downloads last month
- 55
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support
