Text Generation
Transformers
Safetensors
GGUF
Japanese
English
inkling2_loop
image-text-to-text
japanese
unsloth
Mixture of Experts
looped-transformer
on-policy-rft
context-distillation
conversational
Instructions to use devneko/Inkling-2-Mini-JA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use devneko/Inkling-2-Mini-JA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="devneko/Inkling-2-Mini-JA") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("devneko/Inkling-2-Mini-JA") model = AutoModelForMultimodalLM.from_pretrained("devneko/Inkling-2-Mini-JA", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use devneko/Inkling-2-Mini-JA with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf devneko/Inkling-2-Mini-JA:Q8_0 # Run inference directly in the terminal: llama cli -hf devneko/Inkling-2-Mini-JA:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf devneko/Inkling-2-Mini-JA:Q8_0 # Run inference directly in the terminal: llama cli -hf devneko/Inkling-2-Mini-JA:Q8_0
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf devneko/Inkling-2-Mini-JA:Q8_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf devneko/Inkling-2-Mini-JA:Q8_0
Use Docker
docker model run hf.co/devneko/Inkling-2-Mini-JA:Q8_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use devneko/Inkling-2-Mini-JA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "devneko/Inkling-2-Mini-JA" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "devneko/Inkling-2-Mini-JA", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/devneko/Inkling-2-Mini-JA:Q8_0
- SGLang
How to use devneko/Inkling-2-Mini-JA with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "devneko/Inkling-2-Mini-JA" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "devneko/Inkling-2-Mini-JA", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "devneko/Inkling-2-Mini-JA" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "devneko/Inkling-2-Mini-JA", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use devneko/Inkling-2-Mini-JA with Ollama:
ollama run hf.co/devneko/Inkling-2-Mini-JA:Q8_0
- Unsloth Desktop
- Pi
How to use devneko/Inkling-2-Mini-JA with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf devneko/Inkling-2-Mini-JA:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "devneko/Inkling-2-Mini-JA:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use devneko/Inkling-2-Mini-JA with Docker Model Runner:
docker model run hf.co/devneko/Inkling-2-Mini-JA:Q8_0
- Lemonade
How to use devneko/Inkling-2-Mini-JA with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull devneko/Inkling-2-Mini-JA:Q8_0
Run and chat with the model
lemonade run user.Inkling-2-Mini-JA-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use devneko/Inkling-2-Mini-JA with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf devneko/Inkling-2-Mini-JA:Q8_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default devneko/Inkling-2-Mini-JA:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use devneko/Inkling-2-Mini-JA with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf devneko/Inkling-2-Mini-JA:Q8_0
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "devneko/Inkling-2-Mini-JA:Q8_0" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
File size: 7,428 Bytes
a2348fa 1d32d8d a2348fa 1d32d8d a2348fa 1d32d8d a2348fa 1d32d8d a2348fa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | ---
license: apache-2.0
base_model: thinkingmachines/Inkling-2-Mini
language:
- ja
- en
library_name: transformers
pipeline_tag: text-generation
tags:
- japanese
- unsloth
- moe
- looped-transformer
- on-policy-rft
- context-distillation
---
# devneko/Inkling-2-Mini-JA
`thinkingmachines/Inkling-2-Mini`(26.4B Looped MoE、Active 3.4B / 3×ループ実質 5.4B)をベースに、**100% オンポリシー・コンテキスト蒸留+リジェクションサンプリング RFT** によって日本語性能を向上させたモデルです。
## ベンチマーク比較(同一設問ID・`reasoning_effort="low"`・`temperature=0.0`)
※ `Qwen3.8-27B` の数値は公式公表値ではなく、同一評価ハーネス・同一設問ID(`vLLM` BF16, `reasoning_effort="low"`)での実測値です。`Inkling-2-Mini`(Base / FT 後)は `llama-server`(Q8_0 / UD-Q8_K_XL GGUF)で計測しています。
### 1. 公開日本語ベンチマーク(7種)
| Benchmark | 件数 | Qwen3.8-27B (実測) | Inkling-2-Mini (Base) | **Inkling-2-Mini-JA (Ours)** | Δ vs Base | Δ vs Qwen3.8 | 出典 |
| :--- | ---: | ---: | ---: | ---: | ---: | ---: | :--- |
| `JamC-QA` | 600 | 61.33% | 54.17% | **53.83%** | -0.34pt | -7.50pt | `sbintuitions/JamC-QA` (test) |
| `MMMLU-JA` | 200 | 86.00% | 87.00% | **88.00%** | +1.00pt | +2.00pt | `openai/MMMLU` (JA_JP/test) |
| `MMLU-ProX-JA` | 200 | 74.50% | 74.50% | **76.00%** | +1.50pt | +1.50pt | `li-lab/MMLU-ProX` (ja/test) |
| `MGSM-JA` | 200 | 89.50% | 89.50% | **90.50%** | +1.00pt | +1.00pt | `jbross-ibm-research/mgsm` (ja/test) |
| `JSTS` (Pearson) | 300 | 90.27% | 89.22% | **88.98%** | -0.24pt | -1.29pt | `yahoojapan/JGLUE` (v1.3 valid) |
| `JSTS` (Spearman) | 300 | 88.43% | 87.42% | **86.53%** | -0.89pt | -1.90pt | `yahoojapan/JGLUE` (v1.3 valid) |
| `JNLI` | 300 | 78.33% | 74.67% | **71.67%** | -3.00pt | -6.66pt | `yahoojapan/JGLUE` (v1.3 valid) |
| `JCommonsenseQA` (*) | 300 | 97.33% | 97.67% | **98.67%** | +1.00pt | +1.34pt | `sbintuitions/JCommonsenseQA` (valid) |
| **公開日本語 7種平均** | 2100 | 82.47% | 80.96% | **81.09%** | +0.13pt | -1.38pt | JSTS は Pearson 採用 |
(*) `JCommonsenseQA` は `train` スプリット由来 281 件を学習データに含むためインディストリビューション評価です(`validation` との重複なし)。`JSTS`・`JNLI` は学習データ未使用の完全ゼロショット評価です。
### 2. 独自ベンチマーク(自作データセット)および英語アンカー
| Benchmark | 件数 | Qwen3.8-27B (実測) | Inkling-2-Mini (Base) | **Inkling-2-Mini-JA (Ours)** | Δ vs Base | Δ vs Qwen3.8 | 備考 |
| :--- | ---: | ---: | ---: | ---: | ---: | ---: | :--- |
| `J-IFEval(独自・Prompt Strict)` | 120 | 68.33% | 94.17% | **95.00%** | +0.83pt | +26.67pt | **独自データセット(自作 120 問)** |
| `J-IFEval(独自・Inst Strict)` | 120 | 75.43% | 97.61% | **98.26%** | +0.65pt | +22.83pt | **独自データセット(自作 120 問)** |
| **日本語全 8種平均(独自含む)** | 2220 | 80.70% | 82.61% | **82.83%** | +0.22pt | +2.13pt | 公開 7種 + J-IFEval(独自 Prompt) |
| `MMLU-EN Anchor` | 200 | 89.00% | 86.50% | **87.50%** | +1.00pt | -1.50pt | `cais/mmlu` (all/test, 英語忘却確認) |
### 3. JamC-QA カテゴリ別内訳
| Category | Qwen3.8-27B (実測) | Inkling-2-Mini (Base) | **Inkling-2-Mini-JA (Ours)** | Δ vs Base |
| :--- | ---: | ---: | ---: | ---: |
| `culture` | 60.8% | 44.3% | **49.4%** | +5.1pt |
| `custom` | 72.2% | 59.5% | **62.0%** | +2.5pt |
| `geography` | 46.8% | 35.4% | **36.7%** | +1.3pt |
| `government` | 67.1% | 72.2% | **59.5%** | -12.7pt |
| `healthcare` | 72.9% | 79.2% | **77.1%** | -2.1pt |
| `history` | 69.6% | 59.5% | **55.7%** | -3.8pt |
| `law` | 62.0% | 59.5% | **62.0%** | +2.5pt |
| `regional_identity` | 43.6% | 33.3% | **37.2%** | +3.9pt |
## 学習手法・再現情報
- **ベースモデル:** `thinkingmachines/Inkling-2-Mini` (`unsloth/Inkling-2-Mini`)
- **学習データセット:** [`devneko/inkling-2-mini-ja-rft-v5`](https://huggingface.co/datasets/devneko/inkling-2-mini-ja-rft-v5)(Parquet、全評価ベンチマークに対して 18-gram デコンタミネーション実施済み)
- **手法:** ベースモデル自身のネイティブ `<|content_thinking|>` 分布を完全に保持する **100% オンポリシー・コンテキスト蒸留 RFT**(8領域日本 Wikipedia 4択・JAQKET/AI王・JCommonsenseQA・英語 MMLU リプレイ)
- **フレームワーク:** Unsloth (`FastModel` 16-bit LoRA + `train_on_responses_only`)
- **同梱ファイル:**
- BF16 マージ済みモデル重み(ルート直下)
- Q8_0 GGUF(`gguf/Inkling-2-Mini-JA-Q8_0.gguf`)
- LoRA アダプタ(`lora_adapter/`)
- 推論コード・推論メタデータ(`inference.py`, `inference_metadata.json`)
- 学習ハイパーパラメータ・評価結果(`train_summary.json`, `eval_comparison.json`)
- `trackio` メトリクス DB(`trackio_metrics/` — Phase 0〜v5 および JGLUE 評価ログを同梱)
### 学習ハイパーパラメータ (`train_summary.json`)
```json
{
"run_name": "sft_v5_onpolicy_rft",
"train_samples": 1991,
"global_step": 250,
"training_loss": 0.3023825306892395,
"elapsed_s": 5368.3,
"peak_vram_gb": 58.95,
"mask_check": {
"sample0_total_tokens": 343,
"sample0_trainable_tokens": 198,
"sample0_trainable_ratio": 0.577,
"masked_preview": "<|message_system|><|content_text|>Thinking effort level: 0.2<|end_message|><|message_user|><|content_text|>以下の日本語の質問に対して、最も適切な選択肢を1つ選び、最後に必ず「回答: X」(XはA〜Dの英大文字1文字)の形式で答えてください。\n\n質問: フランスの王朝で、カペー朝、ヴァロア朝、ブルボン朝のうち、最も古い時代の王朝はどれ?\nA. ノルマン朝\nB.",
"unmasked_preview": "<|content_thinking|>The user asks in Japanese: Among French dynasties, Capetian, Valois, Bourbon, which is the oldest? Options: A Norman, B Capetian, C Hainaut? Actually ヒメノ朝 maybe? D Lancaster. The question wording: \"フランスの王朝で、カペー朝、ヴァロア朝、ブルボン朝のうち、最も古い時代の王朝はどれ?\" Means among French dynasties, of Capet"
},
"args": {
"model_name": "unsloth/Inkling-2-Mini",
"dataset": "/root/inkling_ja/data/inkling_ja_rft_v5",
"train_limit": 0,
"val_limit": 150,
"max_seq_length": 2048,
"load_in_4bit": true,
"bf16_lora": true,
"lora_r": 16,
"lora_alpha": 16,
"no_attn_lora": false,
"no_mlp_lora": false,
"grad_accum": 16,
"lr": 1.5e-05,
"weight_decay": 0.01,
"warmup_ratio": 0.08,
"epochs": 2.0,
"max_steps": -1,
"save_steps": 150,
"eval_steps": 75,
"logging_steps": 5,
"seed": 3407,
"output_dir": "/root/inkling_ja/outputs/sft_v5_rft",
"run_name": "sft_v5_onpolicy_rft",
"trackio_project": "inkling-2-mini-ja",
"merge_16bit_dir": ""
}
}
```
## 推論方法
同梱の `inference.py` および `inference_metadata.json` を参照してください。`llama.cpp` での起動例:
```bash
llama-server \
-m gguf/Inkling-2-Mini-JA-Q8_0.gguf \
--host 127.0.0.1 --port 8000 \
-ngl 99 -fa on --jinja \
--chat-template-kwargs '{"reasoning_effort": "low"}'
```
|