Kanbun Kundoku — Qwen3.5-0.8B (paragraph + punctuation restoration)

Translates Classical Chinese (漢文 / kanbun) into Japanese kundoku (訓読 / 書き下し文, yomikudashi) at the paragraph level, and restores Japanese punctuation (。、『』…) even when the Chinese input has none.

What it's for:

  • Kundoku reading of unmarked texts — give it raw, unpunctuated Classical Chinese and it returns a fluent Japanese kundoku (yomikudashi) reading.
  • Punctuation restoration — it inserts Japanese sentence/clause punctuation (。、『』) that the source lacks, so it doubles as a punctuator/segmenter for bare kanbun.
  • Robust to whether the input already has punctuation or not.

It is a continued finetune of Qwen/Qwen3.5-0.8B, starting from a sentence-level kundoku model and further trained on punctuation-stripped paragraphs so the model learns to (a) produce fluent kundoku and (b) insert sentence/clause boundaries itself.

  • Task: Classical Chinese → Japanese kundoku, with punctuation restoration
  • Base model: Qwen/Qwen3.5-0.8B
  • Training data: Taishō-canon Classical-Chinese ↔ Japanese-kokuyaku aligned pairs, quality-filtered (kanji-containment + in-order coverage + length-ratio) and packed into ≤100-character paragraphs of consecutive sentences; the Chinese input has all punctuation stripped, the Japanese target keeps it.
  • Held-out quality: chrF++ ≈ 42

Prompt format

The model is trained with this instruction (apply via the chat template):

次の漢文(古典中国語)を日本語に訓読・翻訳してください。

{source}

Example

IN  (no punctuation): 爾時世尊告諸比丘我與汝等說微妙法義味清淨能令梵行清淨所謂三聚法汝等諦聽善思念之
OUT (kundoku)       : 爾の時世尊、諸の比丘に告げたまはく、『我れ汝等と、微妙の法義を説く。
                      味清淨にして、能く梵行をして清淨ならしむ。所謂、三聚の法なり。
                      汝等諦かに聴き、善く之を思念せよ』と。

Usage — vLLM (recommended)

This repo ships the Qwen3_5ForConditionalGeneration form for direct serving.

vllm serve buddhist-nlp/kanbun-kundoku-qwen35-0.8b \
  --served-model-name kundoku --trust-remote-code --max-model-len 4096
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="none")
src = "爾時世尊告諸比丘我與汝等說微妙法義味清淨能令梵行清淨所謂三聚法汝等諦聽善思念之"
r = client.chat.completions.create(
    model="kundoku", temperature=0,
    messages=[{"role": "user",
               "content": f"次の漢文(古典中国語)を日本語に訓読・翻訳してください。\n\n{src}"}],
)
print(r.choices[0].message.content)

Usage — transformers

from transformers import AutoTokenizer, AutoModelForImageTextToText
import torch

m = "buddhist-nlp/kanbun-kundoku-qwen35-0.8b"
tok = AutoTokenizer.from_pretrained(m)
model = AutoModelForImageTextToText.from_pretrained(m, dtype=torch.bfloat16).cuda().eval()

src = "如是我聞佛在舍衛國"
msgs = [{"role": "user",
         "content": f"次の漢文(古典中国語)を日本語に訓読・翻訳してください。\n\n{src}"}]
prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
ids = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**ids, max_new_tokens=256, do_sample=False)
print(tok.decode(out[0, ids.input_ids.shape[1]:], skip_special_tokens=True))

Notes & limitations

  • Format: packaged as Qwen3_5ForConditionalGeneration so it loads on vLLM and the pinned vllm/vllm-openai images. The vision tower is the unmodified base-model tower (carried for architecture compatibility); this is a text model — pass text only.
  • Domain: trained on Buddhist canonical (Taishō) kanbun; best on that register.
  • Very short fragments (a handful of characters) are below the paragraph training distribution and may occasionally over-generate; feed natural clause/paragraph-length input for best results.

License

Apache-2.0, following the base model. Source kokuyaku texts derive from the public-domain Taishō Tripiṭaka Japanese translations.

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

Model tree for buddhist-nlp/kanbun-kundoku-qwen35-0.8b

Finetuned
(318)
this model
Quantizations
1 model