/ Модель

Характеристики

Лицензия
Gemma
Архитектура
gemma4_unified · dense
Базовая модель
gemma-4-12B-it-qat-q4_0-unquantized
Библиотека
transformers
Опубликована
21 ноя 2026

onkun-gemma-4-12b-it-rslora-qat

Генерация текстаТекст → текст3 профессии
1 659скачиваний за 30 дней0лайковвеса обновлены22 ноя 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Специализированная Gemma 4 12B IT размечает сегменты японских слов по типам чтения кандзи и возвращает результат в JSON.

onkun — специализированная модель на базе Gemma 4 12B IT, разработанная для разметки типов чтения японских кандзи. Для японского слова и, при необходимости, заданного чтения она возвращает JSON с сегментами, чтением и меткой: онное, кунное, 熟字訓, кана или другая категория. Модель различает сочетания онных и кунных чтений, включая шаблоны дзюбако и юто, и учитывает озвончение и удвоение согласных.

Модель дообучена методом QLoRA с RS-LoRA на словарных примерах с детерминированно полученными метками; опубликованы объединённые веса, адаптер PEFT и варианты GGUF. Оценка релизного GGUF Q4_K_M показывает воспроизведение словарных правил только на словах, которые эти правила позволяют однозначно разметить. Для стабильного результата рекомендуется передавать чтение и использовать заданный авторами формат запроса с жадной генерацией.

Результаты следуют соглашениям словарей JMdict, JMnedict и KANJIDIC2 и не гарантируют лингвистический анализ за их пределами. Имена, редкие чтения и случаи, исключённые из обучающих данных из-за неоднозначности, слабее; если чтение не задано, модель может ошибаться при его определении. Лицензия — Gemma.

Сценарии применения

  • разметка онных и кунных чтений кандзи в японском слове
  • определение сегментов 熟字訓 в японской лексике
  • классификация смешанных онно-кунных чтений, включая дзюбако и юто
  • подготовка структурированных JSON-данных о чтениях кандзи
  • анализ чтения японского слова при заданной фуригане

Ограничения

Модель следует словарным соглашениям JMdict, JMnedict и KANJIDIC2; неоднозначные и неразмечаемые правилами случаи исключались из обучения и оценки. Имена, редкие чтения и определение чтения без подсказки относятся к слабым сторонам.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Бенчмарки пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь рядом с другими моделями теста

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы по шкале 0–100.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

onkun: Gemma 4 12B IT tagger for kanji reading types (RS-LoRA, QAT base, merged)

Given a Japanese word, and optionally its reading, the model splits it into kanji and tags how each kanji is read:

typemeaningexample
onSino-Japanese reading (音読み)動画 どう・が
kunnative Japanese reading (訓読み)春場所 はる・ば・しょ
jukujikunthe word is read as a whole, not kanji by kanji (熟字訓)今日 きょう
kanakana in the word
otherin the label scheme, a reading found only in KANJIDIC2's name readings (nanori). That rule was off for training, so the model never saw this tag.

Word patterns used in the results:

  • pure on / pure kun: every kanji has that type.
  • jūbako: two kanji, on + kun.
  • yutō: two kanji, kun + on.
  • mixed: three or more kanji with both on and kun.
  • jukujikun: contains a jukujikun span.

Mixed words such as 重箱 (じゅう・ばこ, on + kun) and 湯桶 (ゆ・とう, kun + on) are handled kanji by kanji. Sound changes such as rendaku (場 → ば) and gemination are covered too.

This is a specialised tagger: use it with the prompt below. It is not meant as a general assistant (see Side effects).

What the evaluation does and does not show. Every label comes from dictionary lookups plus deterministic rules. Words the rules cannot settle are left out of training and of scoring:

  • 11,105 pairs are quarantined (6,715 JMdict, 4,390 JMnedict): ambiguous or unmatched kanji, or multi-kanji spans the rules can't split;
  • 6,561 JMdict pairs have no segmentation;
  • 4,072 are out of scope.

The scores below therefore measure how well the model reproduces the dictionary rules on words the rules can label. They do not measure irregular words, unlisted readings or words outside the dictionaries, where a model would have to beat a lookup. No hand-labelled hard set exists yet.

Repository structure

  • Root: the full merged weights (bf16 safetensors, for transformers). Recommended.
  • adapter/: the raw RS-LoRA adapter (PEFT).
  • gguf/: merged GGUF files: f16, Q8_0, Q5_K_M, Q4_K_M and Q2_K. Q4_K_M is the evaluated release file.

Prompt format

The model was trained on exactly this system prompt, and it answers with one JSON object.

system: Tag the reading type of each kanji in the Japanese word: on, kun, jukujikun, kana or other. Answer with JSON {"segments": [{"text", "reading", "type"}]}.
user:   Word: 春場所
        Reading: はるばしょ
{"segments": [{"text": "春", "reading": "はる", "type": "kun"}, {"text": "場", "reading": "ば", "type": "kun"}, {"text": "所", "reading": "しょ", "type": "on"}]}

If you don't know the reading, write Word: 固有名詞 followed by The reading is not given: use the word's standard reading. (mode B). The model then supplies the reading too, which is less reliable (see Results).

Use greedy decoding (temperature 0) with thinking off. generation_config.json and the GGUF metadata (general.sampling.temp = 0) now default to greedy decoding; the first upload shipped Google's sampling defaults. All evaluation requests used temperature 0.

Usage

Merged model (Transformers)

from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "julienp79/onkun-gemma-4-12b-it-rslora-qat"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype="auto")

SYSTEM = ('Tag the reading type of each kanji in the Japanese word: on, kun, jukujikun, kana or other. '
          'Answer with JSON {"segments": [{"text", "reading", "type"}]}.')
messages = [{"role": "system", "content": SYSTEM},
            {"role": "user", "content": "Word: 今日\nReading: きょう"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=256, do_sample=False)
print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))

GGUF (llama.cpp)

llama-server -hf julienp79/onkun-gemma-4-12b-it-rslora-qat:Q4_K_M --jinja -c 4096 --temp 0
# then POST to /v1/chat/completions with the system prompt above, temperature 0

Adapter (PEFT)

from peft import PeftModel
from transformers import AutoModelForCausalLM

base = AutoModelForCausalLM.from_pretrained("google/gemma-4-12B-it-qat-q4_0-unquantized",
                                            device_map="auto", torch_dtype="auto")
model = PeftModel.from_pretrained(base, "julienp79/onkun-gemma-4-12b-it-rslora-qat", subfolder="adapter")

⚠️ rsLoRA and llama.cpp. convert_lora_to_gguf.py ignores use_rslora, so llama.cpp scales the adapter by alpha/r = 1.0 and not by alpha/√r = 5.657. The adapter then runs at about 18% of its trained strength. Either pass --lora-scaled adapter.gguf:5.657, or (better) use the merged GGUFs in gguf/.

Even at the correct scale, the adapter applied to the Q4_0 base behaved worse on general tasks than the merged model (see Side effects). Use the merged files.

Training

Basegoogle/gemma-4-12B-it-qat-q4_0-unquantized
MethodQLoRA (4-bit fp4 base), RS-LoRA, SFT on the assistant turn only
LoRAr = 32, alpha = 32 (use_rslora, scale 5.657), dropout 0, all attention and MLP projections of the language model
Data23,337 examples: 17,337 with the reading given (mode A) and 6,000 without it (mode B), from the train split only
OptimiserAdamW 8-bit, lr 1e-4 with cosine decay, warmup 3%, effective batch 16, max length 640 tokens, 1 epoch (1,459 steps), seed 20261118
Hardwareone RTX 3060 12 GB, 6.1 h, peak VRAM 10.9 GB
MergeW' = W + 5.657 · (B @ A) in fp32, saved as bf16; GGUFs converted from the merged checkpoint

Labels never come from an LLM. Every training and evaluation label is computed deterministically from dictionaries:

  • JmdictFurigana gives the per-kanji segmentation of each (word, reading) pair from JMdict and JMnedict;
  • each segment's kana is matched against the kanji's KANJIDIC2 on and kun readings, with explicit rules for sound changes (rendaku, gemination, ...);
  • UniDic word origin is used as a cross-check.

Pairs the rules cannot settle (ambiguous, unmatched, or splittable multi-kanji spans) are quarantined and never used for training or scoring. The split is by written form (train / dev / test), so no evaluated written form was seen in training. Variant spellings of one JMdict entry (e.g. 綺麗 / 奇麗) are separate written forms and can fall on different sides of the split.

Results

Builds compared.

  • The model is the release Q4_K_M (merged), unless a row says otherwise.
  • The baseline is stock Gemma 4 12B QAT Q4_0, with its best non-thinking prompt (few-shot, step by step).
  • Both use greedy decoding with thinking off.
  • The other GGUF sizes (f16, Q8_0, Q5_K_M, Q2_K) were not evaluated. Q2_K in particular may be noticeably worse.

Δ is paired, with a 95% bootstrap CI. The test split was held out from every training and design decision, and it was evaluated twice. The first run served the adapter at the wrong scale (see the rsLoRA note); nothing was selected on either run.

Baseline caveats.

  • With thinking on (capped at 1,024 tokens), the base model gains about 8 points on a harder 120-word dev sample. Thinking was not run on test, so the gap to a thinking base is smaller than shown.
  • Part of the base's exact-match gap is formatting. On test, 1.5% of its answers fail to parse and 14.2% segment the word differently from the dictionary. The model has 0% and 0%.

Test split, 1,000 words, reading given (mode A)

per-kanji type accuracywhole-word exact match
base Gemma 4 12B (best prompt)0.8670.680
this model0.9820.966
Δ+11.4 [+9.6, +13.4]+28.6 [+25.8, +31.5]

By pattern (type accuracy, base → model):

patternnbasemodelΔ [95% CI]
pure on4910.9280.995+6.7 [+4.7, +8.9]
pure kun3100.8730.968+9.5 [+6.2, +12.9]
mixed980.7510.969+21.8 [+15.3, +28.5]
jukujikun340.4670.957+48.9 [+34.1, +63.3]
jūbako (on + kun)360.8330.944+11.1 [+0.0, +22.2]
yutō (kun + on)310.7420.952+21.0 [+8.1, +35.5]

The small pattern rows (31–36 words) have wide intervals.

Errors (test, mode A).

  • Per-kanji confusion (gold → predicted): on → on 1,662, kun → kun 768, jukujikun → jukujikun 66. The main error is over-predicting jukujikun: 33 of the 47 kanji errors (on → jukujikun 16, kun → jukujikun 17), e.g. 括弧, 怪我, 紫蘇 and 矍鑠 tagged as whole-word readings.
  • We read all 34 exact-match misses by hand. About 6 have debatable gold (二度 ふたたび, 三十路 みそじ, 枝折 しおり, 経糸 たていと, 白子 しらす, the kokuji 狆), and the rest are model errors.
  • One answer garbled a katakana string into Cyrillic.

Test split, reading not given (mode B), n = 992. Any JMdict reading of the word is accepted, and the types are scored against the labels of the reading the model gave.

basemodel
valid reading0.5760.756
type accuracy0.8250.928 (+10.3 [+8.3, +12.3])
whole-word exact match0.4840.744 [0.715, 0.769]
type accuracy, where the reading is valid0.935 (n = 571)0.985 (n = 750)

Most mode-B errors are wrong readings, not wrong types, so give the reading whenever you have it.

Dev split, 479 words: mode A 0.981 type, 0.967 EM. The unmerged adapter at the correct scale scores 0.987 and 0.975, a difference that is not significant.

Side effects (regression check vs the base model)

These rules were fixed before the run. Δ is model − base, where base is stock Q4_0. Two builds of this model were checked:

  • the release Q4_K_M (merged);
  • the PEFT adapter converted to GGUF at the correct scale and applied to Google's Q4_0 (--lora).
checkrelease Q4_K_Madapter on Q4_0pre-registered limit
JCommonsenseQA, averaged over 5 rotations of the choices (1,119 questions)+8.3 [+7.4, +9.1] pass+8.3 [+7.4, +9.3] passlower bound > −3
JA→EN translation, chrF (300 sentences)−0.4 [−1.7, +0.7] fail (narrowly)−2.2 [−3.8, −0.5] faillower bound > −1.5
arithmetic (500 items)−3.6 [−5.8, −1.6] fail−1.4 [−3.6, +0.8] passlower bound > −5
JSON leaking into general replies0 / 24 pass0 / 24 pass≤ 1
reading a word in a sentence (dev words, base 86.3%)81.7% (−4.7 [−8.7, −0.7])53.7% (−32.7)none (no transfer claim)

The adapter path keeps the QAT Q4_0 weights. It is slightly better on the tagging task (dev 0.987 vs 0.981, n.s.) and on arithmetic. But in the sentence-reading task it usually answers with the reading of the whole sentence, not of the asked word, and it loses more on translation.

The two builds may be two points on one trade-off between task strength and general ability. A sweep over the adapter scale has not been run.

General ability drifts a little:

  • translation is roughly unchanged;
  • arithmetic loses about 3.6 points;
  • reading a word inside a sentence gets slightly worse.

JCommonsenseQA and position bias.

  • The base model strongly favours option "3" and avoids "4": over 5,595 rotated prompts it picks them 1,628 and 582 times, against 1,119 expected for each.
  • The fine-tuned model is close to uniform.
  • Averaged over all rotations it gains +8.3 points, and it is right in all 5 rotations for 84% of questions, against 45% for the base.

Adapter-strength sweep (v2 adapter on Q4_0, effective scale s; dev mode A; Δ vs base):

sdev type accJA→EN chrFarithmetic (500)word in sentencepre-registered rules
1.00.931+0.9+0.6+1.7pass
2.00.969+1.2−0.60.0pass
3.00.976+0.5−0.2−2.0 (n.s.)pass
4.00.979−0.4−1.4−7.3translation fails
5.657 (trained)0.987−2.2−1.4−32.7translation fails

Task strength and general drift trade off smoothly along the scale. At s ≈ 3 the adapter keeps most of the task gain and passes every side-effect rule. For a general assistant that should also tag kanji, s = 3 is a reasonable setting: convert adapter/ with stock convert_lora_to_gguf.py, which gives scale 1.0, then load it with --lora-scaled adapter.gguf:3.0 on Google's Q4_0. s = 3 was chosen after seeing these numbers, so they are not an independent confirmation of it. The merged release files correspond to s = 5.657: treat them as a tagger.

Limitations

  • The tags follow dictionary conventions (KANJIDIC2 reading lists, JmdictFurigana segmentation). Where those disagree with a linguist's analysis, the model follows the dictionaries.
  • Names (JMnedict) and rare readings are the weakest areas. Multi-kanji spans that the rules can't split, and readings outside KANJIDIC2, were excluded, so the model has seen few of them.
  • Mode B depends on the model knowing the reading, which it often does not.

Data licences and attribution

The labels and training data are derived from:

The evaluation also uses JCommonsenseQA (JGLUE, CC BY-SA 4.0) and Tatoeba sentences via jmdict-simplified (CC BY 2.0 FR). The model weights are subject to the Gemma terms of use.

Chat template

chat_template.jinja is the newer Gemma 4 template, the one the model was trained with. If your runtime ships an older Gemma template, use this one.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
Gemma4UnifiedForConditionalGeneration
Ревизия весов
af751d5

0 моделей