makellm-ja-char-200m-normal-chat

🇯🇵 日本語は後半に書いてあります(下へスクロール)。 English version first, Japanese version below.

A from-scratch, character-level Japanese GPT-2 (~209.5M parameters), chat-finetuned into a calm, neutral casual-adult persona. Everything — the model, data preprocessing, pre-training, distillation-based chat finetuning, and GGUF conversion — is hand-written. No pretrained Hugging Face weights or subword tokenizer.

⚠️ This is a small, educational "atmosphere" chatbot. It produces natural, relaxed Japanese small talk, but it has no factual knowledge, no arithmetic, and does not follow instructions (see Limitations). Do not expect correct answers to questions like "what is the capital of Japan?" — it will chat instead. For research, learning, and experimentation only.


English

Author

Tsutomu Uchida (内田勉)

What this is

The neutral casual-adult persona variant of the 200M makellm chat model: a calm, everyday conversational tone (work, walks, reading, coffee, cafés), with little slang and no emoji.

A high-energy high-school-girl (JK) persona sibling is published separately as makellm-ja-char-200m-chat.

Model details

Field Value
Architecture GPT-2 style, character-level (learned absolute positions, pre-LayerNorm, weight-tied head, exact GELU)
Parameters ~209.5M
Layers / dim / heads n_layer=16 / n_embd=1024 / n_head=16 (head dim 64)
Context length 512
Vocabulary 7,283 (character-level) = 7,280 characters + 3 special tokens
Special tokens `<
Format GGUF (F16), ~415 MB
Trained on AMD Ryzen AI MAX+ 395 / Radeon 8060S (gfx1151, RDNA 3.5) + PyTorch ROCm

Character-level: 1 token = 1 Unicode character. No subword tokenization (BPE/SentencePiece).

Training data

Pre-training (base model, ~6.17B characters, character-level). A cleaned Japanese mix (internally cleancc3):

  • CC-100 Japanese — range3/cc100-ja (web text, main source)
  • Japanese Wikipedia — wikimedia/wikipedia
  • Aozora Bunko — globis-university/aozorabunko-clean (public-domain books)

Cleaning: NFKC normalization, removal of control/format/private-use/unassigned code points, web-noise stripping. The base is deliberately under-trained relative to its size (single-APU compute budget).

Chat finetuning (~40,000 conversations).

  • Conversations were distilled from Google's Gemma 4 (Apache-2.0 licensed; generated locally, then filtered: Japanese-ratio, OOV, dedup via MinHash/LSH, length, placeholder removal).
  • Formatted as <|user|>…<|bot|>…<|end|>, with loss applied only to the response part (masked finetuning), bf16/SDPA.
  • Best masked validation loss: 0.9520.

Data provenance note: the chat data is distilled from Google's Gemma 4, which is released under the Apache 2.0 license (a change from earlier Gemma's custom terms). Apache 2.0 permits fine-tuning and redistribution of derivatives with only attribution, so this model is freely publishable; Gemma 4 is attributed below.

Usage

This model uses a custom character-level tokenizer, so the chat format (<|user|>…<|bot|>…<|end|>) must be provided via the included Modelfile. A direct ollama run hf.co/... pull does not work correctly.

A. Ollama registry (easiest — if the owner has pushed there)

ollama run <owner>/makellm-ja-char-200m-normal-chat "おつかれさま"

B. From this Hugging Face repo (gguf + Modelfile)

huggingface-cli download Sido/makellm-ja-char-200m-normal-chat \
    makellm-ja-char-200m-normal-chat.f16.gguf Modelfile --local-dir ./makellm-normal
cd makellm-normal
ollama create makellm-normal -f Modelfile
ollama run makellm-normal "おつかれさま。最近どう?"

C. llama.cpp

llama-cli -m makellm-ja-char-200m-normal-chat.f16.gguf --jinja -p "おつかれさま"

D. LM Studio

LM Studio uses Hugging Face as its catalog, so this repo works directly (in-app search for makellm-ja-char-200m-normal-chat, or "Use this model → LM Studio"). The embedded Jinja template is auto-detected; if generation doesn't stop, add <|user|> as a stop string (<|end|> is the EOS).

Recommended parameters: num_ctx 512, temperature 0.7, top_k 40, repeat_penalty 1.1 (baked into the Modelfile).

Notes on the character-level tokenizer

  • tokenizer.ggml.model is llama (SPM); the vocabulary is single-character tokens only, so no merges fire — it matches the training-time character tokenizer exactly.
  • ASCII space (U+0020) is aliased to U+2581 (▁) (SPM requirement; without it, prompts with spaces crash).
  • The 3 special tokens are CONTROL type: segmented atomically and hidden from output.
  • Keep num_ctx ≤ 512 (the position embeddings have 512 rows).

Limitations (please read)

  • Conversation-only "atmosphere" model. It reproduces the shape and register of casual Japanese chat, but:
    • No factual knowledge — e.g. "日本の首都は?" is answered with chatter, not "東京".
    • No arithmetic — "1たす1は?" is not computed.
    • No instruction-following — it will not make bullet lists, play しりとり, or obey format constraints.
  • Persona leakage: it was distilled from role-play conversations, so it occasionally addresses an implied conversation partner.
  • Small & under-trained base: limited long-range coherence; 512-character context is short.
  • GELU: llama.cpp/Ollama's gpt2 path uses tanh-approx GELU while this model trained with exact (erf) GELU — a tiny numerical difference at inference (sampled output is natural; not a practical problem).
  • May reflect biases or produce inappropriate output from the training data. Educational/hobby project; not for production or high-stakes use.

License

Released under CC-BY-SA-4.0 (the base training data includes CC-BY-SA Japanese Wikipedia, whose ShareAlike is the binding constraint). When redistributing or modifying, share under the same terms and provide attribution. The chat layer is distilled from Gemma 4 (Apache-2.0) — permissive and compatible, requiring only attribution (provided below).

Attribution (per CC-BY-SA)

  • CC-100 (range3/cc100-ja) — from Common Crawl; subject to the Common Crawl terms of use. Cite: Conneau et al. 2020 (XLM-R) / Wenzek et al. 2020 (CCNet).
  • Wikipedia (wikimedia/wikipedia) — © Wikipedia contributors, CC-BY-SA.
  • Aozora Bunko (globis-university/aozorabunko-clean) — public domain.
  • Chat data — distilled from Google Gemma 4 outputs (Apache-2.0); attribution per the Apache 2.0 NOTICE.

Whether model weights constitute a derivative work of training data is legally unsettled. This is a conservative (ShareAlike-respecting) choice, not legal advice.

Related

  • High-energy JK sibling: makellm-ja-char-200m-chat.
  • Base model (no chat): makellm-ja-char-200m.
  • Smaller published sibling: Sido/makellm-ja-char-75m-chat.

日本語

フルスクラッチで実装した文字単位(BPE不使用)の日本語 GPT-2(約209.5Mパラメータ)を、落ち着いた中立の大人ペルソナにチャット微調整したモデルです。モデル・データ前処理・事前学習・蒸留チャット微調整・GGUF変換まですべて自作しています。

⚠️ 小規模な学習用の「雰囲気」チャットボットです。自然でリラックスした日本語の雑談はできますが、知識・計算・指示追従はできません(下記「制限事項」)。「日本の首都は?」のような質問には答えず、雑談で返します。研究・学習・実験用途向けです。

作者

内田勉 (Tsutomu Uchida) — ✉️ uchida@mazariba.co.jp / X: @sidodtv

これは何

200M makellm チャットの 中立な大人ペルソナ版:落ち着いた日常の口調(仕事・散歩・読書・コーヒー・カフェ)、スラング控えめ・絵文字なし。 高テンションな女子高生(JK)ペルソナ版は別リポジトリ makellm-ja-char-200m-chat で公開しています。

モデル詳細

項目 値
アーキテクチャ GPT-2型・文字単位(学習型絶対位置・pre-LayerNorm・重み共有head・厳密GELU)
パラメータ 約209.5M
層数/次元/ヘッド n_layer=16 / n_embd=1024 / n_head=16(ヘッド次元64)
コンテキスト長 512
語彙 7,283(文字単位) = 7,280文字 + 特殊トークン3
特殊トークン `<
配布形式 GGUF(F16)約415MB
学習環境 AMD Ryzen AI MAX+ 395 / Radeon 8060S(gfx1151, RDNA3.5)+ PyTorch ROCm

1トークン=1 Unicode文字。サブワード(BPE/SentencePiece)不使用。

学習データ

事前学習(ベース・約61.7億字・文字単位):クリーン化した日本語混合(社内名 cleancc3)。

  • CC-100 日本語 range3/cc100-ja(Web・主軸)/日本語Wikipedia wikimedia/wikipedia/青空文庫 globis-university/aozorabunko-clean
  • 加工:NFKC正規化・制御/書式/私用/未割当コードポイント除去・Webノイズ除去。ベースはサイズの割に意図的に過小学習(単一APUの計算予算)。

チャット微調整(約40,000会話)

  • 会話は GoogleのGemma 4から蒸留(Apache-2.0ライセンス。ローカル生成→日本語率/OOV/近重複(MinHash)/長さ/伏字などでフィルタ)。
  • <|user|>…<|bot|>…<|end|> 形式・応答部分のみにloss(マスク微調整)・bf16/SDPA。
  • 最良マスク検証損失:0.9520。

データ来歴の注意:チャットデータは GoogleのGemma 4から蒸留しています。Gemma 4は Apache 2.0ライセンス で公開されており(旧Gemmaの独自規約から変更)、微調整・派生物の再配布が帰属表示のみで認められるため、本モデルは自由に公開できます(下記で帰属表示)。

使い方

カスタム文字単位トークナイザのため、チャット書式(<|user|>…<|bot|>…<|end|>)は付属 Modelfile で与えます。ollama run hf.co/... の直接pullでは正しく動きません。

A. Ollamaレジストリ(最も簡単・公開者がpush済みの場合)

ollama run <owner>/makellm-ja-char-200m-normal-chat "おつかれさま"

B. このHFリポジトリから(gguf + Modelfile)

huggingface-cli download Sido/makellm-ja-char-200m-normal-chat \
    makellm-ja-char-200m-normal-chat.f16.gguf Modelfile --local-dir ./makellm-normal
cd makellm-normal
ollama create makellm-normal -f Modelfile
ollama run makellm-normal "おつかれさま。最近どう?"

C. llama.cpp

llama-cli -m makellm-ja-char-200m-normal-chat.f16.gguf --jinja -p "おつかれさま"

D. LM Studio:HFをカタログとして使うので本リポジトリをそのまま利用可(アプリ内検索 or「Use this model → LM Studio」)。Jinjaテンプレは自動検出。止まらない場合はstopに <|user|> を追加(<|end|> はEOS)。

推奨パラメータ:num_ctx 512 / temperature 0.7 / top_k 40 / repeat_penalty 1.1(Modelfileに焼込み済)。

文字単位トークナイザの注意点

  • tokenizer.ggml.model は llama(SPM)。語彙が1文字トークンのみでマージなし=学習時と一致。
  • 半角スペース(U+0020)は U+2581(▁) にエイリアス(無いと空白入力でクラッシュ)。
  • 特殊トークン3つはCONTROL型(アトミック切出し・出力非表示)。
  • num_ctx は 512以下(位置埋め込みが512行)。

制限事項(必読)

  • 会話専用の「雰囲気」モデル。カジュアル日本語会話の型・口調を再現しますが:
    • 知識なし:「日本の首都は?」→ 雑談で返し「東京」とは言えない。
    • 計算なし:「1たす1は?」は計算しない。
    • 指示追従なし:箇条書き・しりとり・書式指定に従わない。
  • ペルソナ漏れ:ロールプレイ会話から蒸留したため、たまに想定した会話相手に話しかける。
  • 小型・過小学習ベース:長距離一貫性に限界。512文字と短い。
  • GELU差:llama.cpp/Ollamaのgpt2はtanh近似、本モデルは厳密(erf)で学習 → 推論時にごく僅かな数値差(サンプリング出力は自然で実用上OK)。
  • 学習データ由来の偏り・不適切出力の可能性。教育・趣味プロジェクト。本番・高リスク用途には非推奨。

ライセンス

CC-BY-SA-4.0 で公開(ベース学習データのCC-BY-SA日本語Wikipediaの継承が拘束条件)。再配布・改変時は同条件での共有と帰属表示を。チャット層は Gemma 4(Apache-2.0) から蒸留しています。Apache-2.0は寛容で互換性があり、帰属表示のみを要します(下記)。

帰属・出典(CC-BY-SA)

  • CC-100 (range3/cc100-ja) — Common Crawl由来・利用規約に従う。引用: Conneau et al. 2020 / Wenzek et al. 2020。
  • Wikipedia (wikimedia/wikipedia) — © Wikipedia寄稿者, CC-BY-SA。
  • 青空文庫 (globis-university/aozorabunko-clean) — パブリックドメイン。
  • チャットデータ — Google Gemma 4(Apache-2.0)の出力から蒸留。Apache 2.0 NOTICE に従い帰属表示。

※ 重みが学習データの派生著作物に当たるかは法的に未確定。本表記は安全側(ShareAlike尊重)の選択であり法的助言ではありません。

関連

  • 高テンションなJK版:**makellm-ja-char-200m-chat**
  • ベース(チャット化前):**makellm-ja-char-200m**
  • 小型の公開済み姉妹:**Sido/makellm-ja-char-75m-chat**
Downloads last month
35
GGUF
Model size
0.2B params
Architecture
gpt2
Hardware compatibility
Log In to add your hardware

16-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Datasets used to train Sido/makellm-ja-char-200m-normal-chat