Files

96 lines
2.9 KiB
Markdown
Raw Permalink Normal View History

---
license: apache-2.0
language:
- en
- ja
tags:
- olmo
- dpo
- rlhf
- alignment
- bilingual
pipeline_tag: text-generation
base_model: your_username/olmo2-300m-sft
---
# OLMo-2 300M — DPO (Final Model)
OLMo-2 ~300M のフルパイプライン最終モデルです。
Pretrain → CPT → SFT → DPO の 4 ステージを経て alignment 済み。
## Model Architecture
| 項目 | 値 |
|------|-----|
| Base config | allenai/OLMo-2-0425-1Bconfig のみ・重みは使用せず) |
| Parameters | ~300M |
| hidden_size | 1024 |
| num_hidden_layers | 16 |
| num_attention_heads | 16 |
| num_key_value_heads | 8 (GQA) |
| intermediate_size | 4096 |
| Tokenizer | allenai/OLMo-2-0425-1B |
## Training Pipeline
| Stage | モデル | データ | 概要 |
|-------|--------|--------|------|
| 1. Pretrain | ランダム初期化 | FineWeb ~1.5B tokens | 大規模コーパスで言語モデリング |
| 2. CPT | Stage 1 出力 | FineWeb-Edu + Wikipedia JA ~0.3B tokens | 英日バイリンガル継続学習 |
| 3. SFT | Stage 2 出力 | Tülu-3 SFT mixture 100K samples | 指示追従の習得 |
| 4. DPOこのモデル | Stage 3 出力 | UltraFeedback binarized | 人間の好みに合わせた alignment |
## DPO Training Details
| 項目 | 値 |
|------|-----|
| Dataset | allenai/ultrafeedback_binarized_cleaned |
| Loss | DPO (β=0.1) |
| Learning rate | 5e-7 (linear decay) |
| Warmup ratio | 0.1 |
| Epochs | 1 |
| Hardware | NVIDIA RTX 4090 24GB |
| Framework | TRL DPOTrainer |
## Usage
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "your_username/olmo2-300m-dpo"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
messages = [{"role": "user", "content": "機械学習を初心者向けに説明してください。"}]
input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=300, temperature=0.7, do_sample=True)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
```
## Intended Use
- 英日バイリンガルの質問応答・対話
- LLM フルパイプラインPretrain → DPOの研究・学習目的
## Limitations
- モデルサイズが小さく(~300M、大規模モデルと比較して品質は限定的
- 事実の正確性を保証しない
- 有害コンテンツの完全な排除は保証されない
## Training Data Attribution
| データセット | ライセンス |
|------------|-----------|
| FineWeb-Edu (HuggingFaceFW) | ODC-By |
| Wikipedia JA (Wikimedia) | CC BY-SA 4.0 |
| Tülu-3 SFT mixture (AllenAI) | 混合 |
| UltraFeedback binarized (AllenAI) | MIT |
## License
Apache 2.0