arXiv:2610.39227cs.CLOct 2026

Manuscript Offprint

arXiv:2610.39227

XLaw-JP-27B: A Lightweight Open Model Specialized for Japanese Law

Andrew Shin

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

We present XLaw-JP-27B, an open-weight model specialized for Japanese law that runs on a single 48 GB GPU under the Apache 2.0 licence. It adapts Qwen3.8-27B with hybrid retrieval over all current statutes and 31k case summaries, a light QLoRA fine-tune on its own verified answers to past bar-exam questions (self-distillation), a contract-specific LoRA adapter, and four-sample voting. We evaluate it on eight Japanese legal tasks—the multiple-choice section of the bar examination in 2024, 2025 and 2026, statement-level bar questions (JBE-QA), statute questions (LawQA-JP), the patent attorney exam, and contract review and drafting built from government model contracts—against open models of 12–33B under identical prompts and retrieval. XLaw-JP-27B ranks first on six tasks, ties on one and is third on one (mean rank 1.3 against 2.8–3.1 for the baselines). It is the only system that passes the bar exam in all three years (129, 120 and 130 of 175, meeting every subject minimum; no test-year material was used in training), while open Japanese 32–33B models fail at least one year. A controlled study of each component shows that retrieval, voting and self-distillation help, and that thinking mode, retrieval-grounded synthetic tuning, self-verification, per-statement decomposition and more self-distillation do not. The largest remaining gaps to frontier models are in contract review and patent law. The model is available as a free web service at https://x-law.jp/ with the weights available at https://huggingface.co/X-LawJapan/xlaw-jp-27b under Apache 2.0.

1 Introduction

Large language models now pass professional legal examinations in several jurisdictions, but most strong Japanese results come from closed models or closed retrieval products whose components are not disclosed (Legalscape, 2025; innovatopia, 2025).

Law firms, courts, companies and public bodies that cannot send client documents to an external API need something else: a model that runs on hardware they control, under a licence that permits commercial use and modification, and that is good at the range of things Japanese legal work involves—not one exam, but statutes, case law, patents and contracts.

We build such a model and evaluate it broadly. XLaw-JP-27B is a 27B-parameter model (Qwen3.8-27B, Apache 2.0) specialized for Japanese law through retrieval over the current text of every statute and 31k court-decision summaries, a light fine-tune on its own verified reasoning, a contract adapter, and voting (§4). We compare it with the strongest open lightweight models we could run on the same hardware—Gemma 4 12B, LLM-jp-4.1 33B and Qwen3-Swallow 32B, the latter two Japanese-specialized—on eight tasks, with identical prompts and retrieval for every model (§5). Because one 77-question exam paper moves by up to 16 points between random seeds of the same system (§3), we report every seed and paired bootstrap intervals, and we build the recipe one component at a time on two clean exam years.