XLaw-JP-27B (xlaw-jp-27b)
Paper: XLaw-JP-27B: A Lightweight Open Model Specialized for Japanese Law (arXiv:2610.39227)
Benchmark: XLaw-Bench, our evaluation suite for Japanese legal tasks (leaderboard).
Release name of the frozen model qwen38-27b-jplaw-e8 (+ contract adapter qwen38-27b-jplaw-e8-contract-adapter).
A lightweight open model specialized for Japanese law, fine-tuned from Qwen/Qwen3.8-27B (Apache 2.0). It runs on one 48 GB GPU (FP8). Among the open models of 12-33B we evaluated with identical prompts and retrieval, it is best overall across eight Japanese legal tasks (first on six, tied on one, third on one; mean rank 1.3 vs 2.8-3.1) and the only one that passes the bar exam's multiple-choice section in 2024, 2025 and 2026. It is meant to be used with statute and case retrieval and, for multiple-choice exam questions, majority voting over four samples, as described in the accompanying paper.
Try it: X-Law Agent Beta, a free web demo with legal Q&A, contract review and drafting, and case and statute search, served from these weights.
This repository contains:
| Path | What |
|---|---|
/ (safetensors) | merged bf16 weights of the release model (E8): Qwen3.8-27B + a QLoRA fine-tune on 150 of its own verified answers to 2019-2023 bar-exam questions and 91 contract reviews |
contract-adapter/ | optional LoRA adapter (rank 32) on top of these weights for contract review and drafting (E17c); do not use it for exam questions |
release/ | the frozen release: MANIFEST.json (base revision, recipe), SHA256SUMS of every file, training configs |
The checkpoint is saved in the base model's (vision-language) layout; the vision tower is unchanged from the base and
was not evaluated. Serve it as a text model, e.g. vLLM with --language-model-only.
Results
All numbers from the paper; same prompts and retrieval for every model; baselines one run each. To reproduce or compare your own model, use XLaw-Bench.
| Benchmark | This model | Gemma 4 12B | LLM-jp-4.1 33B (thinking) | Qwen3-Swallow 32B (thinking) |
|---|---|---|---|---|
| 司法試験 短答式 2026, points /175 (pass 99) | 130 (vote@4) | 101 | 92 | 82 |
| 司法試験 短答式 2024, points /175 (pass 93) | 129 (vote@4) | 90 | 100 | 96 |
| 司法試験 短答式 2025, points /175 (pass 81) | 120 (vote@4) | 87 | 88 | 85 (fail) |
| Benrishi-MC (弁理士 短答 2024-25), accuracy | 0.517 (vote@4) | 0.350 | 0.383 | 0.383 |
| LawQA-JP, accuracy | 0.821 (vote@4) | 0.821 | 0.793 | 0.800 |
| JBE-QA (200-item sample), MCC | 0.537 | 0.534 | 0.600 | 0.660 |
| OI-Contract Review, checklist recall (with adapter) | 0.240 | 0.228 | 0.169 | 0.173 |
| OI-Contract Draft, row score (with adapter) | 0.829 | 0.794 | 0.759 | 0.692 |
Single runs (no voting) average 115.8 (2026) and 115.0 (2024). Claude Opus 5.5, closed-book, scores 171 and 173; on contract review it reaches 0.475.
How to use
The scores above depend on the retrieval context: without it the base model scores 20-33 points lower per exam run.
serve/ and web/ in the code repository run the full stack (retrieval gateway, contract adapter, voting):
bash serve/start_vllm.sh /path/to/weights /path/to/contract-adapter # vLLM OpenAI server, FP8, 48 GB GPU
python -m uvicorn serve.gateway:app --port 8080 # retrieval + voting gateway
Decoding: thinking off (enable_thinking=False), temperature 0.7, top-p 0.8, top-k 20, min-p 0, presence penalty
1.5; 8,192 new tokens for exam answers. Greedy decoding loops on long answers.
Training data
- 150 answers generated by the untuned base model to 司法試験 短答式 questions of 2019-2023 (法務省), kept only when the final answer matched the official key; prompts include the question text and retrieved statutes/case summaries.
- 91 contract reviews of clauses from the training half of the 特許庁 OIモデル契約書 (公共データ利用規約1.0), written by the base model with the official commentary as a private reference.
- Adapter only: 557 reviews of clauses from government model contracts (農林水産省, 経済産業省, 国土交通省; 公共データ利用規約1.0) and the OI training half into which known one-sided problems were planted (taxonomy in the code repository).
- No 2024 or 2026 exam material, no COLIEE data, no JBE-QA items were used for training.
Government sources (法務省, 特許庁, 農林水産省, 経済産業省, 国土交通省, e-Gov) are used under 公共データ利用規約 第1.0版
(PDL1.0): 出典を明記し、編集・加工して利用しています。See docs/release/LICENSE_NOTES.md for the full list.
Limitations
- Not legal advice. Outputs must be checked by a qualified professional.
- Even with the correct article in context the model misjudges about one statement in five; it can cite case numbers that do not exist; Chinese phrases occasionally leak into Japanese answers.
- Weak areas: constitutional law (≈49% of points), patent law (Benrishi-MC patents 12/40), and statute-specific risks in contract review (about half of what Claude Opus 5.5 finds).
- The 2026 exam was held before the base model's release; contamination of the base model cannot be excluded.
Citation
@misc{shin2026xlawjp,
title = {XLaw-JP-27B: A Lightweight Open Model Specialized for Japanese Law},
author = {Shin, Andrew},
year = {2026},
eprint = {2610.39227},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
url = {https://arxiv.org/abs/2610.39227}
}
Licence
Apache 2.0, as the base model. These weights are a modified version of
Qwen/Qwen3.8-27B (Copyright Alibaba Cloud / Qwen Team, Apache 2.0),
fine-tuned by X-Law, Inc.; the base model's licence is included as LICENSE. Attribution for the government sources used in training is listed in
docs/release/LICENSE_NOTES.md (出典の明記、編集・加工した旨).