Instructions to use weblab-LLM-M/Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use weblab-LLM-M/Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="weblab-LLM-M/Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507") 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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507") model = AutoModelForCausalLM.from_pretrained("weblab-LLM-M/Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507", 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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507" # 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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/weblab-LLM-M/Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507
- SGLang
How to use weblab-LLM-M/Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507" \ --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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507", "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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507" \ --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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use weblab-LLM-M/Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 with Docker Model Runner:
docker model run hf.co/weblab-LLM-M/Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507
Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507
本モデルは、NEDO(国立研究開発法人新エネルギー・産業技術総合開発機構)「AIの安全性確保に関する研究開発・検証等の推進事業 / 日本語版医療特化型LLMの社会実装に向けた安全性検証・実証」において開発された医療特化型大規模言語モデルであり、東京大学開発チーム内の Ramen Team による「Attention Head の因果的寄与に基づく選択的 Fine-tuning(Pinpoint Tuning)」研究の成果物です。
⚠️ 重要: 本モデルはベースモデルより性能が劣化する結果を得た研究成果です。手法の設計・実装・分析結果の再現性確保を目的に公開しています。性能面で本モデルを実利用することは推奨されません。 劣化要因の考察および代替設定の提案は outputs/ANALYSIS_REPORT_PinPointTuning.md を参照してください。
モデル概要
| 項目 | 内容 |
|---|---|
| モデル名 | Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 |
| ベースモデル | Qwen/Qwen3-30B-A3B-Instruct-2507 |
| パラメータ数 | 30B(A3B MoE, qwen3_moe) |
| 事後学習手法 | Pinpoint Tuning(Negative Impact Heads: medical_impact < 0 かつ reasoning_impact < 0 のヘッド選択) |
| 学習フレームワーク | ms-swift + Megatron-LM (v3.9.3) |
| 言語 | 日本語 |
| ベースモデルライセンス | Qwen3-30B-A3B-Instruct-2507 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/tree/main/Pinpoint-tuning |
| 関連記事 | Qiita記事: Path Patching手法解説 / Pinpoint Tuning実験 (公開後にURL追記予定) |
研究シリーズ内の位置づけ
本モデルは Pinpoint Tuning 研究の Negative バリアントです。同一プロジェクトの他モデルと合わせて評価してください。
- Pinpoint Tuning系(Qwen3-30B-A3B-Instruct-2507 ベース)
- Ramen-PinPointTuning-Positive — medical_impact > 0 かつ reasoning_impact > 0 のヘッドを選択
- Ramen-PinPointTuning-Negative(本モデル)— medical_impact < 0 かつ reasoning_impact < 0 のヘッドを選択
- RL系(Qwen3-Next-80B-A3B-Instruct ベース)
利用にあたっての注意事項
- 本モデルは研究成果の再現性確保を目的に公開する negative resultです。実タスク性能はベースモデル(Qwen3-30B-A3B-Instruct-2507)に劣ります。
- 開発者は本モデルの正確性・完全性・最新性・品質等について一切の保証を行わず、本モデルの利用または利用不能により生じたいかなる損害についても責任を負いません。
- 医療行為(診断、治療方針の決定、健康への助言など)に直接適用することは推奨されません。
- 本モデルを活用して具体的な医療用途の製品を開発される場合、その製品が医療機器プログラムとして薬機法の規制対象となる可能性があることにご留意ください。
- プログラム医療機器の該当性に関する相談窓口:独立行政法人医薬品医療機器総合機構(PMDA)
事後学習手法
Path Patching 法を用いて Attention Head ごとの medical_impact / reasoning_impact を測定し、Negative(medical_impact < 0 かつ reasoning_impact < 0)に該当するヘッドを含む Layer のみを選択的に SFT する手法です。
ヘッド選択の意味
| 手法 | 選択基準 | 意味 |
|---|---|---|
| Positive Pinpoint | medical_impact > 0 かつ reasoning_impact > 0 | 医学用語マスク時に正解率が上がるヘッド → 正答を妨害している疑い → 修正対象 |
| Negative Pinpoint(本モデル) | medical_impact < 0 かつ reasoning_impact < 0 | 医学用語マスク時に正解率が下がるヘッド → 医療タスクと正の関連 |
選択されたヘッドの統計
| 項目 | Negative(本モデル) |
|---|---|
| 対象ヘッド数 | 457 / 1536(29.8%) |
| 対象 Layer 数 | 48 / 48 |
| medical_impact 平均 | −0.0075 |
| reasoning_impact 平均 | −0.0076 |
| 特記 | Layer9:Head3 の medical_impact=−0.624 が突出 |
| ヘッド集中域 | 深い層(L45:23ヘッド, L47:21, L44:20) |
学習ハイパーパラメータ
| 項目 | 値 |
|---|---|
| learning rate | 1e-4 |
| max_epochs | 1 |
| global batch size | 32 |
| max_length | 4096 |
| Freeze | router / shared_expert / embed_lm_head |
| Unfreeze | 対象 Layer 内の MLP および attention(指定ヘッド以外も同一 Layer なら学習対象) |
| SFT データ | sft_igakuqa_v2.jsonl |
手法上の留意: 名称の「Pinpoint」に反し、実質的には全 48 層すべて(対象ヘッドが全 Layer に存在)が学習対象となり、Layer 内の MLP も含めて学習されるため、ほぼ full fine-tuning に近い設定です。この設定選択が下記の性能劣化の主因と考察されています(詳細は ANALYSIS_REPORT_PinPointTuning.md)。
詳細は Pinpoint-tuning/Qwen30B-A3B/ を参照してください。
評価結果
同一プロジェクト内で実施したベンチマークのみを記載します。括弧内はベースモデル(Qwen3-30B-A3B-Instruct-2507)からの変化幅。
医師国家試験(igakuqa, 2023–2025, N=1,122)
| 指標 | ベース | 本モデル (Negative) |
|---|---|---|
| Accuracy (All) | 86.2% | 79.2% (−7.0) |
| Accuracy (subset, テキストのみ) | 89.1% | 83.9% (−5.2) |
統計検定(McNemar, Base vs Negative, N=1,122): 改善 58 / 劣化 136, Net −78, χ²=30.56, p<0.000001 (***)
専門医試験(specialist_exam_test_v2, 13診療科, N=3,757)
| 指標 | ベース | 本モデル (Negative) |
|---|---|---|
| Accuracy (All) | 60.9% | 48.2% (−12.7) |
| Accuracy (subset, テキストのみ) | 64.5% | 51.2% (−13.2) |
統計検定(McNemar, Base vs Negative, N=3,757): 改善 337 / 劣化 813, Net −476, χ²=196.20, p<0.000001 (***)
診療科別の劣化率(Base 正解を本モデルが不正解にした割合の高い順)
| 診療科 | Base 正答数 | Negative 壊れ率 |
|---|---|---|
| 眼科 | 138 | 46.4% |
| 耳鼻科 | 154 | 44.8% |
| 麻酔科 | 204 | 41.7% |
| 神経内科 | 116 | 40.5% |
| 心臓外科 | 157 | 40.1% |
| 消化器 | 146 | 37.7% |
| 精神科 | 231 | 35.5% |
| 外科 | 202 | 35.1% |
| 産婦人科 | 231 | 35.1% |
| 救急 | 182 | 33.5% |
| 整形外科 | 115 | 33.0% |
| 肝臓 | 129 | 31.8% |
| 内科 | 282 | 19.9% |
Positive バリアントと比較すると、Negative は全体的に壊れ率がやや低い(内科・肝臓等)ものの、眼科では逆に悪化(Positive 42.8% → Negative 46.4%)しています。深い層に集中して介入した影響と考察されます。
診療ガイドライン(guideline_wrong_filtered)
| 指標 | ベース | 本モデル (Negative) |
|---|---|---|
| Accuracy | 15.7% | 11.7% (−4.0) |
フォーマット遵守率
[ans]...[/ans] フォーマットのパース失敗率: 0.0% — フォーマット崩壊は劣化の原因ではないことを確認済み。
未実施の評価
以下のベンチマークは本モデルでは実施していません。同種の評価を必要とする場合は Weblab-MedLLM 本系列を参照してください。
- 対話型診断(J-HealthBench)
- Do-Not-Answer
- AnswerCarefully
学習データ
医師国家試験過去問(2022年以前)由来の SFT データ(sft_igakuqa_v2.jsonl)を使用しています。評価データ(2023–2025年の医師国試および専門医試験)とはデータリークがないよう分離しています。
推奨動作環境
ハードウェア
- GPUメモリ(推論, BF16): 約 62GB(全パラメータロード時。MoE アクティブ部分のみで実行時は ~7GB 程度)
- 推奨: A100 80GB × 1枚 または H100 80GB × 1枚
ソフトウェア
- python>=3.9(transformersを使用する場合)
- python 3.12(vLLMを使用する場合は推奨)
- transformers>=4.55.0(
qwen3_moeアーキテクチャに対応したバージョンが必要) - 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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 \
--local-dir ./Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507
vLLMを使った推論(推奨)
vllm serve ./Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 \
--host 0.0.0.0 \
--port 8000 \
--served-model-name Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 \
--tensor-parallel-size 1 \
--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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507",
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-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507"
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{ramen2026pinpointnegative,
title = { Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 },
author = { Ramen Team, Matsuo-Iwasawa Lab, The University of Tokyo },
year = { 2026 },
url = { https://huggingface.co/weblab-LLM-M/Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507 },
note = { NEDO Project JPNP25006 }
}
謝辞
この成果は、NEDO(国立研究開発法人新エネルギー・産業技術総合開発機構)の 委託業務(JPNP25006)の結果得られたものです。
お問い合わせ
- Downloads last month
- 11
Model tree for weblab-LLM-M/Ramen-PinPointTuning-Negative-Qwen3-30B-A3B-Instruct-2507
Base model
Qwen/Qwen3-30B-A3B-Instruct-2507