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 Architecture

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