Sillok-LM 100M: Causal Language Model for the Annals of the Joseon Dynasty

조선왕조실록 인과적 언어모델 (Sillok-LM 100M)

License: Apache-2.0 GitHub Live Web Studio

🌐 English Model Card | 🇰🇷 한국어 모델 설명


🌐 English Model Card

1. Model Summary

Sillok-LM (100.7M parameters) is a decoder-only causal language model trained entirely from scratch on the complete digital corpus of the Annals of the Joseon Dynasty (Joseon Wangjo Sillok, 1392–1863).

Constructed with a modern Llama-3 architecture (RoPE, GQA, SwiGLU, RMSNorm), Sillok-LM is tailored for digital humanities research, historical text imputation, and stylistic generation of Classical Chinese historiography.

Model Architecture & Specs

  • Model Type: Llama-3 Style Decoder-only Transformer (LlamaForCausalLM compatible)
  • Parameters: 100,682,496 (100.7M)
  • Layers: 12 | Hidden Dim: 768 | Intermediate Dim: 2,048
  • Attention Heads: 12 | Key-Value Heads: 4 (Grouped-Query Attention)
  • Max Sequence Length: 1,024 tokens | RoPE Base Frequency (theta): 500,000.0
  • Tokenizer: 32,768 vocabulary custom Byte-Level BPE (specialized for Hanja & Hangul)
  • Training Steps: 4,400 steps (~12.1 epochs over 760M tokens)
  • Validation Loss: 2.9128 (Perplexity: 18.41, Top-1 Accuracy: 48.71%)
  • Precision: FP16 / BF16 safetensors
  • Author & Research: Gyungmin Jo (조경민 / Academy of Korean Studies AKS-DHLAB)

2. Historiographical Foundations & Innovations

① Cross-Lingual Bi-Directional Modeling

  • The Nature of Article Titles: The original woodblock prints of the Annals contained no headlines. All article titles (<mainTitle>) in the corpus were curated by modern historians at the National Institute of Korean History (NIKH) during national digitization projects.
  • Consequently, Sillok-LM functions as a neural cross-lingual bridge between 15th–19th century Classical Chinese annals and modern Korean scholarly briefing:
    • Forward Drafting (<|title|>... ➔ <|hanja|>...): Given a monarch, date, and modern title, generates an authentic Classical Chinese chronological entry.
    • Reverse Summarization (<|hanja|>... ➔ <|title|>...): Given raw Classical Chinese text, extracts a professional, archival-grade modern Korean title.

② Historiographer Editorial Commentary (Saron, 史論)

  • In traditional Confucian historiography (Chunqiu Chunqiu-pilbeop), royal chroniclers appended moral and political verdicts (【史臣曰: "..."】).
  • Exactly 5,873 instances of official <postScript type="史論"> tags were extracted from NIKH XML standards and trained using the <|postscript|> control token.

③ Chronological Date Context Hierarchy (Tree Inheritance)

  • Reflecting authentic Annals historiography (where the 60-Ganji cyclical day marker is stated only on the day's first entry), our parser implemented strict DOM tree context inheritance (level2(Year) ➔ level3(Month) ➔ level4(Day) ➔ level5(Article)), eliminating cross-day date contamination.

3. Quickstart with Hugging Face Transformers

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "darkstar-11e/sillok-100m"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.float16,
    device_map="auto"
)

# 1. Forward Annals Generation: King Sejong promulgating the Korean Alphabet (Hangul)
prompt = "<|bos|><|king|>세종실록(世宗實錄)<|date|>세종 28년 9월 29일 | 庚戌<|subject|>문화-출판/인쇄<|title|>어제 훈민정음 서책을 완성하여 인쇄하게 하다<|hanja|>"

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=60,
        temperature=0.6,
        repetition_penalty=1.15,
        do_sample=True,
    )

print(tokenizer.decode(outputs[0], skip_special_tokens=False))

4. Prompt Control Tokens

The model respects the structured bibliographic schema of the Annals:

<|bos|><|king|>King<|date|>Date<|subject|>Subject<|title|>Title<|hanja|>Body<|postscript|>Commentary<|eos|>
Token Description Example
`< king >`
`< date >`
`< subject >`
`< title >`
`< hanja >`
`< postscript >`

5. Interactive Web Studio (https://sillok.tsar.kr)

Experience the model directly in your browser:

  • Native <ruby> Phonetic Viewer: Renders phonetic Hangul readings above Classical Chinese characters with toggleable display modes.
  • 3-Line Modern Story Briefing: Automatic breakdown into historical context, court debate, and outcome.
  • Historiographical Verdict Card: Stylized Confucian commentary card.
  • Joseon Government Glossary: Instant definitions for historical government offices (Uijeongbu, Yukjo, Seungjeongwon).

🇰🇷 한국어 모델 설명

국사편찬위원회 조선왕조실록 원문 XML(30종 실록, 381,701개 기사, 한문 6,770만 자)을 전수 학습한 고문헌 특화 Decoder-only 언어모델입니다.

  • 아키텍처: LLaMA-3 Style Decoder-only Transformer (RoPE, GQA, SwiGLU, RMSNorm)
  • 파라미터 수: 100,682,496 (100.7M)
  • 학습 스텝: 4,400 steps (~12.1 epochs, 7.6억 토큰 완독)
  • 최적 검증 손실(Validation Loss): 2.9128 (Perplexity: 18.41, Top-1 Accuracy: 48.71%)
  • 토크나이저: 32,768 어휘의 고문헌 특화 한자·한글 Byte-Level BPE (SentencePiece)
  • 연구/개발: 조경민 (Gyungmin Jo / 한국학중앙연구원 디지털인문학연구소 AKS-DHLAB)

주요 연구 및 활용 목적

  1. 사료 결락 복원 (Historical Text Imputation): 훼손되거나 망실된 실록 기사의 원문 문맥 추정
  2. 연대·왕명별 양식 모사 (Stylistic Generation): 태조~순종 30대 국왕별 문체 및 시대별 간지(干支) 표기 생성
  3. 디지털 사관 사론 생성 (Historiographical Commentary): 실록 기사 말미 사관의 논평(<|postscript|>) 생성
  4. 역방향 국역 요약 (Reverse Title Extraction): 한문 사초 입력 시 국사편찬위원회 스타일의 한글 1줄 요약 제목 추출

📜 라이선스 및 데이터 출처 (License & Citation)

Downloads last month
746
Safetensors
Model size
0.1B params
Tensor type
F16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support