tiny-lm-v3.1-japanese-1b-sft
Instruction-tuned (SFT) version of tiny-lm-v3.1-japanese-1b-base, a Japanese language model with 1.0B parameters, pretrained from scratch on 32.5B tokens of Japanese, English and math text. It is trained on the same data as tiny-lm-v3.1-japanese-1.5b-a500m-sft.
Model details
| Parameters | 1.0B |
| Context length | 2048 |
| Vocab size | 99,574 |
| Tokenizer | llm-jp/llm-jp-3-440m |
Training
- Pretraining: 32.5B tokens, 21.5B from the sample-10BT subsets of hotchpotch/fineweb-2-edu-japanese and HuggingFaceFW/fineweb-edu, 10.0B from fineweb-2-edu-japanese documents outside sample-10BT and 1.0B from tokyotech-llm/swallow-math-v2 (stage3-textbook and stage3-qa)
- SFT data: llm-jp/magpie-sft-v1.0 + kanhatakeyama/AutoMultiTurnByCalm3-22B + 10k examples of cl-nagoya/auto-wiki-qa (198k conversations, loss on assistant spans only)
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "nagohachi/tiny-lm-v3.1-japanese-1b-sft"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype="bfloat16")
messages = [{"role": "user", "content": "日本の首都はどこですか?"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True)
out = model.generate(**inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.9)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Evaluation
llm-jp-eval v1.4.1, 4-shot without a chat template, 100 examples per dataset from the dev split. All models were evaluated with these settings. The average is the mean of the 10 categories (code generation is excluded).
| Model name | average | EL | FA | HE | MC | MR | MT | NLI | QA | RC | SUM |
|---|---|---|---|---|---|---|---|---|---|---|---|
| tiny-lm-v3.1-japanese-1.5b-a500m-sft | 0.257 | 0.192 | 0.040 | 0.260 | 0.273 | 0.030 | 0.567 | 0.390 | 0.303 | 0.415 | 0.098 |
| tiny-lm-v3.1-japanese-1b-sft | 0.314 | 0.168 | 0.065 | 0.290 | 0.327 | 0.040 | 0.690 | 0.522 | 0.321 | 0.619 | 0.098 |
| llm-jp/llm-jp-3-440m-instruct3 | 0.277 | 0.285 | 0.060 | 0.245 | 0.313 | 0.040 | 0.649 | 0.448 | 0.257 | 0.399 | 0.072 |