Instructions to use ash2813/llm-jp-4-32b-a3b-thinking-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use ash2813/llm-jp-4-32b-a3b-thinking-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ash2813/llm-jp-4-32b-a3b-thinking-gguf", filename="llm-jp-4-32b-a3b-thinking-Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ash2813/llm-jp-4-32b-a3b-thinking-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
Use Docker
docker model run hf.co/ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use ash2813/llm-jp-4-32b-a3b-thinking-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ash2813/llm-jp-4-32b-a3b-thinking-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ash2813/llm-jp-4-32b-a3b-thinking-gguf", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
- Ollama
How to use ash2813/llm-jp-4-32b-a3b-thinking-gguf with Ollama:
ollama run hf.co/ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
- Unsloth Studio
How to use ash2813/llm-jp-4-32b-a3b-thinking-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ash2813/llm-jp-4-32b-a3b-thinking-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ash2813/llm-jp-4-32b-a3b-thinking-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ash2813/llm-jp-4-32b-a3b-thinking-gguf to start chatting
- Pi
How to use ash2813/llm-jp-4-32b-a3b-thinking-gguf with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use ash2813/llm-jp-4-32b-a3b-thinking-gguf with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
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:8080/v1 hermes config set model.default ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use ash2813/llm-jp-4-32b-a3b-thinking-gguf with Docker Model Runner:
docker model run hf.co/ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
- Lemonade
How to use ash2813/llm-jp-4-32b-a3b-thinking-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ash2813/llm-jp-4-32b-a3b-thinking-gguf:Q4_K_M
Run and chat with the model
lemonade run user.llm-jp-4-32b-a3b-thinking-gguf-Q4_K_M
List all available models
lemonade list
llm-jp-4-32b-a3b-thinking — GGUF (Q4_K_M, imatrix calibrated with llm-jp-corpus-v4)
国立情報学研究所の大規模言語モデル研究開発センターが開発した大規模言語モデル、llm-jp/llm-jp-4-32b-a3b-thinking を GGUF / Q4_K_M に量子化したものです。
本リポジトリの特徴
importance matrix (imatrix) のキャリブレーションに、同モデルの公式事前学習コーパスである llm-jp-corpus-v4 を直接利用しています。訓練分布と同源の importance matrix を取得しているため、低ビット量子化でも本モデル本来の日本語性能(特に学術ドメイン)が保持される設計です。
キャリブレーションミックス (合計 ~15MB)
研究者ユースケースを想定した 5 サブセットを以下の比率で混合しています:
| サブセット | パス | 役割 | 比率 |
|---|---|---|---|
ja_wiki |
ja/ja_wiki/0000.jsonl.gz |
一般日本語・固有名詞 | 25% |
ja_cc |
ja/ja_cc/level2/0000.jsonl.gz |
日本語 Web (高品質フィルタ済) | 30% |
ja_kaken |
ja/ja_kaken/0000.jsonl.gz |
科研費抄録: 学術日本語 | 15% |
en_wiki |
en/en_wiki/0000.jsonl.gz |
英日混在現実 | 15% |
code_stack |
code/code_stack/0000.jsonl.gz |
Python コード+コメント | 15% |
特に ja_kaken (科研費データベース抄録) を含めたことで、研究者が日常的に扱う「敬体・受動態多用・専門用語混在の論文体日本語」を imatrix に取り込んでいます。
キャリブレーションテキスト本体 (ja_calibration.txt) は元コーパスの著作権 (Wikipedia CC-BY-SA、Common Crawl 由来 Web ページ、科研費抄録、The Stack コード) の再配布リスクを考慮し同梱していません。代わりに混合定義 (corpus_subsets.yaml) と生成スクリプト (fetch_corpus.py + build_calibration.py) を同梱しているため、必要に応じて同じキャリブレーションテキストを再生成できます。
提供ファイル
通常推論用 (推奨)
| File | Quant | Size | Notes |
|---|---|---|---|
llm-jp-4-32b-a3b-thinking-Q4_K_M.gguf |
Q4_K_M | ~20GB | imatrix 適用済み。日常用途推奨 |
imatrix.dat |
— | ~97MB | 再量子化用 importance matrix |
corpus_subsets.yaml |
— | <1KB | キャリブレーションミックスの定義 (再現用レシピ) |
fetch_corpus.py |
— | 数KB | corpus_subsets.yaml を読んで GitLab から llm-jp-corpus-v4 の必要シャードのみを取得 |
build_calibration.py |
— | 数KB | DL 済みコーパスを混合して ja_calibration.txt を生成 |
再量子化・f16 直接推論用 (上級者向け、合計 ~60GB)
| File | Quant | Size | Notes |
|---|---|---|---|
llm-jp-4-32b-a3b-thinking-f16-00001-of-00003.gguf |
F16 | ~30GB | shard 1/3 |
llm-jp-4-32b-a3b-thinking-f16-00002-of-00003.gguf |
F16 | ~30GB | shard 2/3 |
llm-jp-4-32b-a3b-thinking-f16-00003-of-00003.gguf |
F16 | ~5GB | shard 3/3 |
LLM-jp-4 専用 Unigram tokenizer パッチ + OpenAI Harmony vocab スワップ適用済みの f16 GGUF を、HF の単一ファイル上限を考慮して 3 shard に分割しています。 全 3 shard を同一ディレクトリにダウンロード後、先頭 shard を -m に渡すだけで llama.cpp が自動的に残り shard をマージロードします。
通常推論には Q4_K_M で十分です。 f16 shard は任意ビットへの再量子化、またはA100/H100 80GB クラスでの f16 直接推論向けです。
キャリブレーションテキストの再生成 (任意)
本リポジトリに同梱されている 3 ファイル (corpus_subsets.yaml + fetch_corpus.py + build_calibration.py) で、本量子化に使ったものと同一のキャリブレーションテキストを手元で再生成できます:
# 1. 本リポジトリを clone (GGUF を除いて軽量に取りたい場合は --filter=blob:none を追加)
git clone https://huggingface.co/ash2813/llm-jp-4-32b-a3b-thinking-gguf
cd llm-jp-4-32b-a3b-thinking-gguf
# 2. 依存
pip install requests pyyaml
# 3. GitLab から llm-jp-corpus-v4 の必要シャードを DL (~1.6GB)
python fetch_corpus.py corpus_subsets.yaml
# → ./calibration/raw/llm-jp-corpus-v4/{ja_wiki,ja_cc,ja_kaken,en_wiki,code}/
# 4. 混合してキャリブレーションテキストを生成 (~15MB)
python build_calibration.py \
--corpus-root calibration/raw/llm-jp-corpus-v4 \
--out calibration/ja_calibration.txt \
--no-fallback
得られた ja_calibration.txt を llama-imatrix に渡せば、本リポジトリ同梱の imatrix.dat と同等の importance matrix が再計算できます (GitLab 上のコーパスシャードがバージョン更新された場合は若干差異が生じます)。
使い方
llama.cpp server (CPU)
docker run --rm -p 8080:8080 \
-v $PWD:/models:ro \
ghcr.io/ggml-org/llama.cpp:server \
-m /models/llm-jp-4-32b-a3b-thinking-Q4_K_M.gguf \
--jinja \
--host 0.0.0.0 --port 8080 -c 4096 -t 8
--jinja は harmony chat template を Jinja パーサで解釈するために必須です(未指定だと reasoning_content 分離や tool/role の整形が効きません)。 -t 8 はワーカースレッド数で、実機の物理コア数に合わせて調整してください。 GPU を使う場合は ghcr.io/ggml-org/llama.cpp:server-cuda イメージに切り替え、--gpus all と -ngl 99 を追加します。
OpenAI 互換 chat completions
curl -s http://localhost:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"messages":[{"role":"user","content":"日本の首都はどこですか?簡潔に。"}],"max_tokens":300}'
応答 (抜粋):
{
"choices": [{
"message": {
"role": "assistant",
"content": "東京です。",
"reasoning_content": "The user asks in Japanese: ..."
},
"finish_reason": "stop"
}]
}
思考過程は reasoning_content フィールドに自動分離されます。
別ビットへの再量子化
本リポジトリ同梱の f16 shard と imatrix.dat があれば、任意のビット (Q3_K_M / Q5_K_M / Q6_K / Q8_0 等) を 1 コマンドで生成できます:
# 全 shard と imatrix.dat を同一ディレクトリに用意してから:
llama-quantize --imatrix imatrix.dat \
--output-tensor-type Q8_0 \
llm-jp-4-32b-a3b-thinking-f16-00001-of-00003.gguf \
llm-jp-4-32b-a3b-thinking-Q5_K_M.gguf Q5_K_M
llama.cpp が先頭 shard から残り 2 shard を自動的に検出して読み込みます。 convert/imatrix 計算は不要で、llama-quantize 1 ステップで完了します。
--output-tensor-type Q8_0 は出力射影層を Q8_0 に固定するオプションで、harmony chat-template の長文プロンプト下での argmax 安定性に寄与します (本リポジトリの Q4_K_M も同オプション付きで生成済み)。サイズは数百 MB 増えますが、付けておくのが安全です。
ライセンス・元モデル
- License: Apache-2.0 (元モデルを継承)
- Base model: llm-jp/llm-jp-4-32b-a3b-thinking
- Calibration corpus: llm-jp/llm-jp-corpus-v4 (GitLab)
謝辞
- LLM-jp プロジェクト (NII) のモデルおよびコーパス公開に深く感謝します
- 先行参考実装: mmnga-o/llm-jp-4-32b-a3b-thinking-gguf
- Downloads last month
- 573
4-bit
16-bit
Model tree for ash2813/llm-jp-4-32b-a3b-thinking-gguf
Base model
llm-jp/llm-jp-4-32b-a3b-thinking