Text Generation
Transformers
Safetensors
Japanese
English
qwen3_moe
Mixture of Experts
Merge
qwen3
llm-jp
mixture-of-experts
conversational
Instructions to use aixsatoshi/llm-jp-4-64b-a6b-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aixsatoshi/llm-jp-4-64b-a6b-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aixsatoshi/llm-jp-4-64b-a6b-merged") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("aixsatoshi/llm-jp-4-64b-a6b-merged") model = AutoModelForCausalLM.from_pretrained("aixsatoshi/llm-jp-4-64b-a6b-merged") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use aixsatoshi/llm-jp-4-64b-a6b-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aixsatoshi/llm-jp-4-64b-a6b-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aixsatoshi/llm-jp-4-64b-a6b-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/aixsatoshi/llm-jp-4-64b-a6b-merged
- SGLang
How to use aixsatoshi/llm-jp-4-64b-a6b-merged 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 "aixsatoshi/llm-jp-4-64b-a6b-merged" \ --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": "aixsatoshi/llm-jp-4-64b-a6b-merged", "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 "aixsatoshi/llm-jp-4-64b-a6b-merged" \ --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": "aixsatoshi/llm-jp-4-64b-a6b-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use aixsatoshi/llm-jp-4-64b-a6b-merged with Docker Model Runner:
docker model run hf.co/aixsatoshi/llm-jp-4-64b-a6b-merged
LLM-JP-4-64B-A6B-Merged
llm-jp/llm-jp-4-32b-a3b-base と llm-jp/llm-jp-4-32b-a3b-thinking の2モデルを統合し、エキスパート数を2倍に拡張したMixture-of-Experts (MoE) モデルです。
Model Summary
| ソースモデル | 本モデル | |
|---|---|---|
| 総パラメータ | ~32B | ~62.3B |
| アクティブパラメータ | ~3.8B | ~5.7B |
| エキスパート数 | 128 | 256 |
| アクティブエキスパート/トークン | 8 (top-8) | 16 (top-16) |
| アーキテクチャ | Qwen3MoE | Qwen3MoE |
| Hidden size | 2560 | 2560 |
| Expert intermediate size | 960 | 960 |
| レイヤー数 | 32 | 32 |
| Attention heads | 40 (GQA 4 KV heads) | 40 (GQA 4 KV heads) |
| 語彙数 | 196,608 | 196,608 |
| 最大コンテキスト長 | 65,536 | 65,536 |
| 精度 | bfloat16 | bfloat16 |
Merge Strategy
Cross-Model Expert Interleaving + SLERP
3つの異なる手法を組み合わせた統合戦略を採用しています。
1. エキスパート層: 直接結合
- Experts 0-127:
llm-jp/llm-jp-4-32b-a3b-baseからそのまま移植 - Experts 128-255:
llm-jp/llm-jp-4-32b-a3b-thinkingからそのまま移植 - 汎用知識 (base) と推論特化 (thinking) の補完的なエキスパートセットを結合
2. ルーター: 重み行列の連結 (Concatenation)
- 各レイヤーのルーター重み
[128, 2560]× 2 を[256, 2560]に連結 - 元のルーティング能力をそのまま保持
3. 共有層: SLERP (Spherical Linear Interpolation)
- Attention層、Embedding、LayerNorm 等の非エキスパート重みは SLERP (t=0.5) で統合
- 行単位SLERPを適用し、数値安定性を確保
- 単純平均より重みのノルムと方向を保存
なぜこの戦略か
- エキスパート複製+ノイズ ではなく 異なる訓練を受けた実エキスパートの統合 により、真に多様な256エキスパートを実現
- base (汎用) と thinking (推論) は同じアーキテクチャ・トークナイザを共有しつつ異なる特化をしており、補完的な組み合わせとなる
- ルーターの連結により、各モデルが学習したルーティングパターンがそのまま活用される
Architecture Details
Qwen3MoeForCausalLM
├── embed_tokens: [196608, 2560] # SLERP merged
├── layers × 32
│ ├── self_attn (GQA) # SLERP merged
│ │ ├── q_proj: [5120, 2560]
│ │ ├── k_proj: [512, 2560]
│ │ ├── v_proj: [512, 2560]
│ │ └── o_proj: [2560, 5120]
│ ├── mlp (MoE)
│ │ ├── gate (router): [256, 2560] # Concatenated
│ │ └── experts × 256 # 0-127: base, 128-255: thinking
│ │ ├── gate_proj: [960, 2560]
│ │ ├── up_proj: [960, 2560]
│ │ └── down_proj: [2560, 960]
│ ├── input_layernorm # SLERP merged
│ └── post_attention_layernorm # SLERP merged
├── norm # SLERP merged
└── lm_head: [196608, 2560] # SLERP merged
Usage
vLLM
vllm serve aixsatoshi/llm-jp-4-64b-a6b-merged \
--trust-remote-code \
--tensor-parallel-size 4
Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "aixsatoshi/llm-jp-4-64b-a6b-merged"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="bfloat16",
device_map="auto",
trust_remote_code=True,
)
messages = [{"role": "user", "content": "日本の首都はどこですか?"}]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
inputs = inputs.to(model.device)
outputs = model.generate(inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True))
Source Models
- llm-jp/llm-jp-4-32b-a3b-base: 11.7Tトークンの公開コーパスで事前学習されたベースモデル
- llm-jp/llm-jp-4-32b-a3b-thinking: SFT + DPO で推論能力を強化したthinkingモデル
Hardware Requirements
- GPU推論 (vLLM, TP=4): ~160GB VRAM (例: 4x A100 80GB, 2x H100 80GB)
- CPU推論: ~160GB RAM
Limitations
- マージモデルのため、追加学習なしでのルーター最適化は行われていません
- thinking モデルのチャンネルシステム (analysis/final) はchat templateで簡略化されています
- 性能は元モデルの組み合わせに依存し、すべてのタスクで改善を保証するものではありません
License
ソースモデルのライセンスに従います。
- Downloads last month
- 6
docker model run hf.co/aixsatoshi/llm-jp-4-64b-a6b-merged