Instructions to use weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct") model = AutoModelForCausalLM.from_pretrained("weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct", device_map="auto") 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 weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct
- SGLang
How to use weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct 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 "weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct" \ --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": "weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct", "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 "weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct" \ --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": "weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct with Docker Model Runner:
docker model run hf.co/weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct
Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct
本モデルは、NEDO(国立研究開発法人新エネルギー・産業技術総合開発機構)「AIの安全性確保に関する研究開発・検証等の推進事業 / 日本語版医療特化型LLMの社会実装に向けた安全性検証・実証」において開発された医療特化型大規模言語モデルであり、東京大学開発チーム内の Ramen Team による「日本語医療LLMに対する事後学習手法の比較研究」の成果物です。
手法検証を目的とした研究成果の公開であり、Weblab-MedLLM 本系列とは異なり実運用向けの調整・安全性検証は行われていません。臨床現場での直接利用は推奨されません。
モデル概要
| 項目 | 内容 |
|---|---|
| モデル名 | Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct |
| ベースモデル | Qwen/Qwen3-Next-80B-A3B-Instruct |
| パラメータ数 | 80B(A3B MoE, qwen3_next) |
| 事後学習手法 | GSPO(GRPO + Sequence-level Importance Sampling) |
| 学習フレームワーク | ms-swift + Megatron-LM (v3.9.3) |
| 言語 | 日本語 |
| ベースモデルライセンス | Qwen3-Next-80B-A3B-Instruct is licensed under the Apache License 2.0. Copyright (c) Alibaba Cloud. |
| 本モデルライセンス | Apache License 2.0 |
| 開発者 | Ramen Team |
| 事業名 | NEDO JPNP25006 |
| ソースコード | https://github.com/weblab-llm-m/singularity-post-training-medical |
| 関連記事 | Qiita記事: RL手法比較(GRPO/GSPO/CHORD)サマリー (公開後にURL追記予定) |
研究シリーズ内の位置づけ
本モデルは事後学習手法比較研究の1バリアントです。同一ベースモデルに対する他手法および同一プロジェクトの他モデルと合わせて評価してください。
- RL系(Qwen3-Next-80B-A3B-Instruct ベース)
- Ramen-GRPO — 標準 GRPO
- Ramen-GSPO(本モデル)— Importance Sampling 付き GRPO 派生
- Ramen-CHORD — GRPO + SFT ハイブリッド
- Pinpoint Tuning系(Qwen3-30B-A3B-Instruct-2507 ベース)
利用にあたっての注意事項
- 本モデルは手法検証を目的とした研究成果であり、実臨床における安全性・有効性の検証は行われていません。
- 開発者は本モデルの正確性・完全性・最新性・品質等について一切の保証を行わず、本モデルの利用または利用不能により生じたいかなる損害についても責任を負いません。
- 医療行為(診断、治療方針の決定、健康への助言など)に直接適用することは推奨されません。
- 本モデルを活用して具体的な医療用途の製品を開発される場合、その製品が医療機器プログラムとして薬機法の規制対象となる可能性があることにご留意ください。
- プログラム医療機器の該当性に関する相談窓口:独立行政法人医薬品医療機器総合機構(PMDA)
事後学習手法
Qwen3-Next-80B-A3B-Instruct をベースに、医師国家試験過去問(MCQ形式)を用いた GSPO(GRPO + Sequence-level Importance Sampling) による強化学習を実施しました。
学習ハイパーパラメータ
| 項目 | 値 |
|---|---|
| learning rate | 1e-6 |
| max_epochs | 5 |
| global batch size | 512 |
| num_generations | 16 |
| KL係数(beta) | 0.1 |
| steps_per_generation | 3 |
| epsilon(IS clip) | 3e-4 |
| 報酬関数 | ophtho(正解判定, weight=1.5)+ chinese(中国語ペナルティ, weight=0.3) |
| RL学習データ | igakuqa.jsonl(医師国家試験 過去問, MCQ選択式, GRPO形式) |
| 学習リソース | 12 nodes × 8 GPU |
注意:
chineseの重み(0.3)とsteps_per_generation(3)が Ramen-GRPO / Ramen-CHORD(それぞれ 1.0, 5)と異なります。純粋な GSPO 手法単体の効果分離は困難であり、比較解釈時にはご留意ください。
詳細な設計・実装は singularity-post-training-medical および ANALYSIS_REPORT_RL.md を参照してください。
評価結果
同一プロジェクト内で実施したベンチマークのみを記載します。括弧内はベースモデル(Qwen3-Next-80B-A3B-Instruct)からの変化幅。
医師国家試験(igakuqa, 2023–2025, N=1,122)
| 指標 | ベース | 本モデル (GSPO) |
|---|---|---|
| Accuracy (All) | 89.5% | 90.2% (+0.7) |
| Accuracy (subset, テキストのみ) | 93.6% | 94.1% (+0.5) |
| 95% CI (Bootstrap, All) | [87.6%, 91.3%] | [88.5%, 91.9%] |
統計検定(McNemar, Base vs GSPO, N=1,122): 改善 38 / 劣化 30, χ²=0.72, p=0.396(n.s.)
igakuqa ではベースモデルが既に高スコアで、統計的有意差は検出されませんでした。
専門医試験(specialist_exam_test_v2, 13診療科, N=3,757)
| 指標 | ベース | 本モデル (GSPO) |
|---|---|---|
| Accuracy (All) | 69.0% | 70.9% (+1.9) |
| Accuracy (subset, テキストのみ) | 73.0% | 74.5% (+1.5) |
| 95% CI (Bootstrap, All) | [67.5%, 70.4%] | [69.5%, 72.4%] |
統計検定(McNemar, Base vs GSPO, N=3,757): 改善 342 / 劣化 269, χ²=8.48, p=0.0036 (**)
診療科別の顕著な改善(Base 80B → GSPO)
| 診療科 | Base | GSPO | Δ |
|---|---|---|---|
| 肝臓 | 68.8% | 74.0% | +5.2 |
| 産婦人科 | 74.0% | 78.8% | +4.8 |
| 消化器 | 63.1% | 65.7% | +2.6 |
| 外科 | 75.8% | 77.8% | +2.0 |
| 神経内科 | 62.9% | 68.3% | +5.4 |
フォーマット遵守率
[ans]...[/ans] フォーマットのパース失敗率: 0.0%
未実施の評価
以下のベンチマークは本モデルでは実施していません。同種の評価を必要とする場合は Weblab-MedLLM 本系列を参照してください。
- 対話型診断(J-HealthBench)
- Do-Not-Answer
- AnswerCarefully
- 診療ガイドライン(guideline_wrong_filtered, 本モデルでは未評価)
学習データ
医師国家試験過去問(2022年以前)を由来とする GRPO 形式データ(igakuqa.jsonl)を使用しています。評価データ(2023–2025年の医師国試および専門医試験)とはデータリークがないよう分離しています。
推奨動作環境
ハードウェア
- GPUメモリ(推論, BF16): 約 160GB 以上(80B × 2byte, 参考値。KVキャッシュ・アクティベーション込みで余裕を持って H100 80GB × 4枚以上を推奨)
- 実測値ではなくパラメータ数からの算出値のため、実運用前に対象環境でのメモリ実測を推奨します。
ソフトウェア
- python>=3.9(transformersを使用する場合)
- python 3.12(vLLMを使用する場合は推奨)
- transformers>=4.55.0(
qwen3_nextアーキテクチャに対応したバージョンが必要) - vllm(推奨)
- accelerate>=1.10.0
- torch>=2.8.0
ダウンロード
pip install hf_transfer
HF_HUB_ENABLE_HF_TRANSFER=1 hf download weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct \
--local-dir ./Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct
vLLMを使った推論(推奨)
vllm serve ./Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct \
--host 0.0.0.0 \
--port 8000 \
--served-model-name Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct \
--tensor-parallel-size 4 \
--dtype bfloat16 \
--gpu-memory-utilization 0.90 \
--trust-remote-code \
--enable-chunked-prefill \
--enable-prefix-caching \
--enable-expert-parallel
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
response = client.chat.completions.create(
model="Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct",
messages=[
{"role": "system", "content": "あなたは医療の専門知識を持つアシスタントです。"},
{"role": "user", "content": "脳梗塞の急性期治療において、rt-PA静注療法の適応基準について説明してください。"}
],
max_tokens=1024*4,
)
print(response.choices[0].message.content)
transformersを使った推論
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "./Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
messages = [
{"role": "system", "content": "あなたは医療の専門知識を持つアシスタントです。"},
{"role": "user", "content": "脳梗塞の急性期治療において、rt-PA静注療法の適応基準について説明してください。"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024*4)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
Citation
@misc{ramen2026gspo,
title = { Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct },
author = { Ramen Team, Matsuo-Iwasawa Lab, The University of Tokyo },
year = { 2026 },
url = { https://huggingface.co/weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct },
note = { NEDO Project JPNP25006 }
}
謝辞
この成果は、NEDO(国立研究開発法人新エネルギー・産業技術総合開発機構)の 委託業務(JPNP25006)の結果得られたものです。
お問い合わせ
- Downloads last month
- 3
Model tree for weblab-LLM-M/Ramen-GSPO-Qwen3-Next-80B-A3B-Instruct
Base model
Qwen/Qwen3-Next-80B-A3B-Instruct