KAZAMI-1B-v0.2-chat
日本語 | English | References
KAZAMI-1B-PreviewSeries — Developed by Project KAZAMI Developers. A from-scratch Japanese language model preview family combining a Sandwich Looped Transformer (recurrent-depth latent computation) with an Engram-style Conditional Memory N-gram Table (800M sparse lookup parameters with optional CPU RAM offloading).Note: This checkpoint belongs to the
KAZAMI-1B-Previewseries (early preview models with room for further improvement). Future improved models may be released separately under a distinct series such asKAZAMI-1B.
日本語
概要
KAZAMI-1B 世代の最新・推奨対話モデル(累計 11.6 億トークン)。Multi-Loop 学習(R=1, 2, 3)と Assistant-only SFT により、落ち着いた知的な敬語対話、自発的な日本語 <think>...</think> 内省思考、タグ漏れゼロ、および 8GB GPU での高速省メモリ推論(VRAM 376 MB〜)を実現しています。
プレビュー版の位置づけ: 本モデルは
KAZAMI-1B-Previewシリーズに属する初期プレビュー版であり、性能面には今後の改善余地が残されています。今後の改良版モデルはKAZAMI-1B等の別シリーズとして公開する可能性があります。
KAZAMI-1B-Preview 系譜
| Model | Stage | Type | Cumulative Tokens | Loop Mode | Notes |
|---|---|---|---|---|---|
KAZAMI-1B-v0.1-base | Stage 1-A | Base | 210M | Fixed R=2 | First from-scratch 1B base |
KAZAMI-1B-v0.1-base-v4 | Stage 1-B | Base | 472M | Fixed R=2 | Quality-filtered web CPT |
KAZAMI-1B-v0.1-chat | Stage 1-B | Chat | 474M | Fixed R=2 | 1st-gen chat + <think> |
KAZAMI-1B-v0.2-base | Stage 1-C | Base | 1.16B | Multi-Loop R=1,2,3 | Latest 5-corpus base |
KAZAMI-1B-v0.2-chat (this model) | Stage 1-C | Chat | 1.16B | Multi-Loop R=1,2,3 | Latest recommended chat |
技術仕様(アーキテクチャ)
知識保持を担う Engram Conditional Memory(N-gram Table、約 8.00 億パラメータ) と、反復推論を担う Sandwich Looped Transformer(演算本体 約 1.95 億パラメータ) を組み合わせた構造を採用しています。
input_ids
│
▼
[Prelude] 2 層(GQA + RoPE + QK-Norm + SwiGLU)
└─ 第 2 層直後に [Engram Conditional Memory] を挿入
・2-gram / 3-gram × 各 8 ヘッド(計 16 ヘッド, 25,000,112 行 × 32 次元 = 800.0M パラメータ)
・日本語正規化マップ(NFKC・全半角・空白統合)をモデル内部バッファへ同梱
・文脈ゲート α + ゼロ初期化因果拡張 Conv1D(kernel=4, dilation=3)
・`engram_offload_to_cpu=True` でホスト RAM へ退避し、GPU VRAM <400 MB で推論可能
│
▼ h_pre(Input Injection アンカー)
[Recurrent Core] 物理 8 層 × R ループ(重み共有 + Gated Input Injection + ループ固有 Norm スケール)
│ R=1 → 実効 12 層 / R=2 → 実効 20 層 / R=3 → 実効 28 層
▼
[Coda] 2 層 → RMSNorm → Weight-Tied LM Head
| 項目 | 仕様 |
|---|---|
| 開発者 | Project KAZAMI Developers |
| シリーズ | KAZAMI-1B-Preview |
| 総パラメータ数 | 994,583,552 (~1.0B) |
| 内訳:演算本体(Backbone) | 194,579,968 (~195M)(Embedding 33.6M 含む・入出力重み共有) |
| 内訳:Engram N-gram Table | 800,003,584 (~800M)(2-gram / 3-gram × 8 ヘッド, 各 1,562,507 行 × 32 次元) |
| 層構成(物理 / 実効) | Prelude 2 + Core 8×R + Coda 2(物理 12 層 / R=2 時 実効 20 層) |
| 隠れ次元 / FFN 中間次元 | hidden_size = 1024 / intermediate_size = 3456 (SwiGLU) |
| Attention | GQA(16 Query Heads / 4 KV Heads, head_dim = 64), RoPE (theta=10000), QK-Norm |
| コンテキスト長 | 2,048 トークン |
| トークナイザ | 独自日本語 SentencePiece Unigram 32,768 語彙(約 2.12 文字/トークン, byte_fallback=True) |
| 保存形式 / 精度 | safetensors(BF16 単一ファイル, 約 1.99 GB) |
対話フォーマット / 思考タグ
- ターン区切り:
<user>{ユーザー発話}\n<assistant>{応答}(停止トークン:</s>[ID 2] および<user>[ID 6]) - 内省思考ブロック:
<think>\n...\n</think>\n(プロンプト未指定時の自発起動、またはenable_thinking=Trueによる明示起動の両方に対応)
クイックスタート(transformers)
pip install torch transformers safetensors sentencepiece で動作します(外部リポジトリ不要、trust_remote_code=True で自己完結ロード)。
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "PROJECT-KAZAMI/KAZAMI-1B-v0.2-chat"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
# Option A: Full BF16 on GPU (~2.0 GB VRAM)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
dtype=torch.bfloat16,
).to("cuda").eval()
# Option B: Ultra-low VRAM mode (<400 MB VRAM + ~1.6 GB host RAM)
# model = AutoModelForCausalLM.from_pretrained(
# model_id,
# trust_remote_code=True,
# dtype=torch.bfloat16,
# engram_offload_to_cpu=True,
# ).to("cuda").eval()
messages = [
{"role": "user", "content": "こんにちは。少し相談に乗ってもらえますか?"},
]
# Set enable_thinking=True to explicitly elicit <think>...</think> reasoning
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=200,
do_sample=True,
temperature=0.7,
top_p=0.9,
top_k=40,
repetition_penalty=1.15,
num_loops=2, # 1 (fast), 2 (recommended), or 3 (deep)
)
reply = tokenizer.decode(
output_ids[0][inputs["input_ids"].shape[-1]:],
skip_special_tokens=True,
)
print(reply)
学習詳細
- 学習段階: Stage 1-C Assistant-only SFT+Multi-Loop 学習(
KAZAMI-1B-v0.2-baseから初期化) - データ構成: 実世界シードに基づく 9 アーキタイプの厳選日本語対話・内省思考データ 4,364 件(学習 4,190 / 検証 174, 75%)+
public_v5公開コーパスリプレイ(25%) - 損失マスク: Assistant-only マスク(
<user>プロンプトを-100で除外し、<assistant>応答+ターン終端<user>/</s>のみを学習) - 最良チェックポイント: step 120(約 1.7 epoch,
sft_val_loss = 2.8400最小点,seq_len=1024, 16,384 tok/step) - Multi-Loop 学習:
R ∈ {1, 2, 3}(確率0.20 / 0.55 / 0.25) - オプティマイザ: Hybrid Muon + AdamW (
lr=1.5e-4,engram_lr_mult=2.0)
評価結果
| 評価指標 | 結果 |
|---|---|
対話検証 sft_ppl (val_sft, 174 件) | 17.11 (v0.1-chat 43.32 比 -60.5% / sft_val_loss=2.8400) |
公開コーパス維持 (public_v5, seq=1024 / 512) | seq=1024: 35.51 / seq=512: R=1: 42.09, R=2: 38.93, R=3: 39.14 |
| 日本語文法最小対 (12 問診断) | 11 / 12 (91.7%) |
| 10 問×3 ループ定性診断 (30 出力) | タグ漏れ 0/30、全ループ破綻 0/30、自発的 <think> 起動確認 |
| ローカル速度 (RTX 3060 Ti 8GB + RAM オフロード) | R=1: 58.0 / R=2: 40.5 / R=3: 30.3 tok/s (VRAM 375.9 MB), CPU 14.41 tok/s |
制限事項・想定用途
- 本モデルは
KAZAMI-1B-Previewシリーズとして公開する初期プレビュー版であり、性能にはまだ改善の余地があります。 - 事実の正確性や最新情報は保証されず、ハルシネーションや不正確な応答を生成する可能性があります。医療・法律・金融・安全に関わる意思決定には使用しないでください。
- 演算コア 1.95 億パラメータ・累計 11.6 億トークン規模の研究モデルであるため、長文での論理整合性・専門科学知識の厳密性・複雑な多段推論には容量上の限界があります。
- 推論時に
num_loops=1(高速)、num_loops=2(既定・推奨)、num_loops=3(より慎重な思考)を選択できます。
ライセンス・名称保護方針・データ帰属表示
- ライセンス: Apache License 2.0(LICENSE および NOTICE を参照)
- 名称・ブランド保護方針(Apache License 2.0 第 6 条):
- Apache License 2.0 はモデル重みおよびコードの利用を許諾するものであり、「KAZAMI」「風見」「PROJECT-KAZAMI」 の名称・ブランド使用権は許諾していません(第 6 条)。
- 本モデルからファインチューニング・量子化・マージ・改変等を行った派生モデルやサービスに 「KAZAMI」 等の名称を使用することは、事前の書面許諾がない限り禁止します(事実としての出所表示のみ可)。詳細は TRADEMARK_POLICY.md をご覧ください。
- 使用した公開事前学習コーパス(帰属表示):
- FineWeb-2 (
jpn_Jpan):HuggingFaceFW/fineweb-2(ODC-By v1.0) - LLM-jp Corpus v4 (
ja_sip_comprehensive_pdf):Podtech/llm-jp-corpus-v4-ja_sip_comprehensive_pdf(CC BY 4.0) - LLM-jp Corpus v4 (
ja_kaken):Podtech/llm-jp-corpus-v4-ja_kaken(CC BY 4.0) - Kokkai v2:
geniacllm/kokkai_v2(Apache 2.0) - Aozora Bunko Clean (modern orthography / 新字新仮名):
globis-university/aozorabunko-clean(CC BY 4.0)
- FineWeb-2 (
English
Overview
Latest and recommended KAZAMI-1B chat model (1.16B cumulative tokens). Combining Multi-Loop training (R=1, 2, 3) with Assistant-only loss-masked SFT, it delivers calm, concise Japanese conversation, spontaneous Japanese <think>...</think> reasoning, zero turn-tag leakage, and ultra-low VRAM inference (<400 MB VRAM with Engram CPU RAM offload).
Preview Release Status: This model is part of the
KAZAMI-1B-Previewseries—early preview checkpoints with room for further performance improvement. Future improved releases may be published separately under a distinct series such asKAZAMI-1B.
KAZAMI-1B-Preview Model Lineage
| Model | Stage | Type | Cumulative Tokens | Loop Mode | Notes |
|---|---|---|---|---|---|
KAZAMI-1B-v0.1-base | Stage 1-A | Base | 210M | Fixed R=2 | First from-scratch 1B base |
KAZAMI-1B-v0.1-base-v4 | Stage 1-B | Base | 472M | Fixed R=2 | Quality-filtered web CPT |
KAZAMI-1B-v0.1-chat | Stage 1-B | Chat | 474M | Fixed R=2 | 1st-gen chat + <think> |
KAZAMI-1B-v0.2-base | Stage 1-C | Base | 1.16B | Multi-Loop R=1,2,3 | Latest 5-corpus base |
KAZAMI-1B-v0.2-chat (this model) | Stage 1-C | Chat | 1.16B | Multi-Loop R=1,2,3 | Latest recommended chat |
Technical Specifications
KAZAMI pairs an Engram Conditional Memory N-gram Table (800.0M sparse lookup parameters) with a Sandwich Looped Transformer compute backbone (194.6M parameters):
| Component | Specification |
|---|---|
| Developers | Project KAZAMI Developers |
| Series | KAZAMI-1B-Preview |
| Total Parameters | 994,583,552 (~1.0B) |
| Compute Backbone | 194,579,968 (~195M) (including 33.6M tied input/output embeddings) |
| Engram Conditional Memory | 800,003,584 (~800M) (2-gram & 3-gram × 8 heads, 1,562,507 rows/head × dim 32) |
| Layers (Physical / Effective) | Prelude 2 + Core 8×R + Coda 2 (12 physical / 20 effective at R=2) |
| Hidden / FFN Size | 1024 / 3456 (SwiGLU) |
| Attention | GQA (16 Q / 4 KV heads, head_dim=64), RoPE (theta=10000), QK-Norm |
| Context Length | 2,048 tokens |
| Tokenizer | Custom 32,768-vocab Japanese SentencePiece Unigram (~2.12 chars/token, byte fallback) |
| Weight Format | Single-file BF16 model.safetensors (~1.99 GB) |
Chat Format & Reasoning Tags
- Turn delimiters:
<user>{user_message}\n<assistant>{reply}(stop token IDs:2</s>and6<user>) - Reasoning block:
<think>\n...\n</think>\n(supports both spontaneous invocation and explicitenable_thinking=Trueviaapply_chat_template)
Quickstart (transformers)
Install torch, transformers, safetensors, and sentencepiece. No external repository is required (trust_remote_code=True).
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "PROJECT-KAZAMI/KAZAMI-1B-v0.2-chat"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
# Option A: Full BF16 on GPU (~2.0 GB VRAM)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
dtype=torch.bfloat16,
).to("cuda").eval()
# Option B: Ultra-low VRAM mode (<400 MB VRAM + ~1.6 GB host RAM)
# model = AutoModelForCausalLM.from_pretrained(
# model_id,
# trust_remote_code=True,
# dtype=torch.bfloat16,
# engram_offload_to_cpu=True,
# ).to("cuda").eval()
messages = [
{"role": "user", "content": "こんにちは。少し相談に乗ってもらえますか?"},
]
# Set enable_thinking=True to explicitly elicit <think>...</think> reasoning
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=200,
do_sample=True,
temperature=0.7,
top_p=0.9,
top_k=40,
repetition_penalty=1.15,
num_loops=2, # 1 (fast), 2 (recommended), or 3 (deep)
)
reply = tokenizer.decode(
output_ids[0][inputs["input_ids"].shape[-1]:],
skip_special_tokens=True,
)
print(reply)
Training Summary
- Stage: Stage 1-C Assistant-only SFT + Multi-Loop training (initialized from
KAZAMI-1B-v0.2-base) - Data mix: 4,364 curated Japanese conversational &
<think>reasoning examples across 9 dialogue archetypes (4,190 train / 174 val, 75%) +public_v5pretraining replay (25%) - Loss masking: Assistant-only SFT masking (user turns masked with
-100; supervises assistant reply, optional<think>, and turn-stop tokens<user>/</s>) - Best checkpoint: Step 120 (~1.7 epochs, minimum
sft_val_loss = 2.8400,seq_len=1024, 16,384 tok/step) - Multi-Loop training:
R ∈ {1, 2, 3}(0.20 / 0.55 / 0.25) - Optimizer: Hybrid Muon + AdamW (
lr=1.5e-4,engram_lr_mult=2.0)
Evaluation Results
| Metric | Score |
|---|---|
Dialogue validation sft_ppl (val_sft, 174 items) | 17.11 (-60.5% vs v0.1-chat 43.32 / sft_val_loss=2.8400) |
Public corpus retention (public_v5, seq=1024 / 512) | seq=1024: 35.51 / seq=512: R=1: 42.09, R=2: 38.93, R=3: 39.14 |
| Japanese grammar minimal-pair (12 diagnostic items) | 11 / 12 (91.7%) |
| 10-prompt × 3-loop diagnostic (30 outputs) | 0/30 tag leakage, 0/30 loop collapse, spontaneous <think> confirmed |
| Local throughput (RTX 3060 Ti 8GB + RAM offload) | R=1: 58.0 / R=2: 40.5 / R=3: 30.3 tok/s (375.9 MB VRAM), CPU 14.41 tok/s |
Limitations & Intended Use
- This checkpoint is released as part of the
KAZAMI-1B-Previewseries; performance remains early-stage with significant room for improvement. - Like all small-scale language models, it may hallucinate facts or make reasoning errors and must not be relied upon for medical, legal, financial, or safety-critical decisions.
- As a research-scale model (195M active compute backbone, 1.16B training tokens), long-form logical consistency, specialized scientific accuracy, and complex multi-step reasoning remain bounded by model scale.
- Supports test-time compute selection via
num_loops=1(fast),num_loops=2(default/recommended), ornum_loops=3(deeper deliberation).
License, Trademark Policy & Dataset Attributions
- License: Apache License 2.0 (see LICENSE and NOTICE).
- Trademark & Naming Policy (Apache License 2.0, Section 6):
- Apache License 2.0 grants rights to the model weights and code, not to the names "KAZAMI", "風見", or "PROJECT-KAZAMI" (Section 6).
- Third-party derivative models, fine-tunes, quantizations, merges, products, or services must not be named "KAZAMI" (or confusingly similar variations) without prior written permission from Project KAZAMI Developers; only truthful descriptive provenance attribution is permitted. See TRADEMARK_POLICY.md for full terms.
- Open Pretraining Corpus Attributions:
- FineWeb-2 (
jpn_Jpan):HuggingFaceFW/fineweb-2(ODC-By v1.0) - LLM-jp Corpus v4 (
ja_sip_comprehensive_pdf):Podtech/llm-jp-corpus-v4-ja_sip_comprehensive_pdf(CC BY 4.0) - LLM-jp Corpus v4 (
ja_kaken):Podtech/llm-jp-corpus-v4-ja_kaken(CC BY 4.0) - Kokkai v2:
geniacllm/kokkai_v2(Apache 2.0) - Aozora Bunko Clean (modern orthography / 新字新仮名):
globis-university/aozorabunko-clean(CC BY 4.0)
- FineWeb-2 (
References
Technical specifications documented above build upon the following published works:
- Sandwich Looped Transformer / Recurrent Depth: Jonas Geiping, Sean McLeish, Neel Jain, John Kirchenbauer, Siddharth Singh, Brian R. Bartoldson, Bhavya Kailkhura, Abhinav Bhatele, and Tom Goldstein. Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach (2025). https://arxiv.org/abs/2502.05171
- Engram Conditional Memory: Xin Cheng, Rui Tian, Wangding Zeng, Damai Dai, et al. (Peking University & DeepSeek-AI). Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Models (2026). https://arxiv.org/abs/2601.07372
- Muon Optimizer: Jingyuan Liu, Jianlin Su, Xingcheng Yao, et al. (Moonshot AI). Muon is Scalable for LLM Training (2025). https://arxiv.org/abs/2502.16982
- Grouped-Query Attention (GQA): Joshua Ainslie, James Lee-Thorp, Michiel de Jong, Yury Zemlyanskiy, Federico Lebrón, and Sumit Sanghai. GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints (2023). https://arxiv.org/abs/2305.13245
- Rotary Position Embedding (RoPE): Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. RoFormer: Enhanced Transformer with Rotary Position Embedding (2021). https://arxiv.org/abs/2104.09864
- Query-Key Normalization (QK-Norm): Alex Henry, Prudhvi Raj Dachapally, Shubham Shantaram Pawar, and Yuxuan Chen. Query-Key Normalization for Transformers (2020). https://arxiv.org/abs/2010.04245
- SwiGLU: Noam Shazeer. GLU Variants Improve Transformer (2020). https://arxiv.org/abs/2002.05202
- RMSNorm: Biao Zhang and Rico Sennrich. Root Mean Square Layer Normalization (2019). https://arxiv.org/abs/1910.07467
- SentencePiece: Taku Kudo and John Richardson. SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processing (2018). https://arxiv.org/abs/1808.06226
Citation
@misc{kazami1b_preview_2026,
title = {KAZAMI-1B-v0.2-chat: Japanese Sandwich Looped Transformer with Engram Conditional Memory (KAZAMI-1B-Preview Series)},
author = {Project KAZAMI Developers},
year = {2026},
url = {https://huggingface.co/PROJECT-KAZAMI/KAZAMI-1B-v0.2-chat}
}