Skip to main content

OpenThai 2.0 Legal — the Thai legal AI that knows the law by heart, and that you can run yourself

· 8 min read
Kobkrit Viriyayudhakorn
CEO @ iApp Technology

OpenThai 2.0 Legal — open-weight Thai legal LLM, released 24 July 2026

Today we are releasing OpenThai 2.0 Legal, an open-weight large language model purpose-built for Thai law — and we are giving away the full weights on Hugging Face. It is built by Thais, for Thailand: for lawyers, in-house counsel, compliance teams, legal-tech builders and public agencies that need reliable, source-grounded answers on Thai statutes and case law.

👉 Model page: iapp.co.th/openmodels/openthai2p0-legal · Weights: huggingface.co/iapp/openthai2.0-legal-thaillm-nemotron-3-nano-30b-a3b

It knows the law without being told the law

Most legal chatbots are only as good as the documents you hand them. Take the documents away and they guess.

Ask OpenThai 2.0 Legal a question with no statute in the prompt at all, and it recalls and cites the correct law and section (มาตรา) from memory. On code-scored benchmarks it is the strongest closed-book Thai-law recaller among models you can run yourself — roughly four times the recall of the much larger Qwen3.6-35B on the Civil and Commercial Code — and it wins all four axes of the Thai bar-exam essay evaluation against the same competitor, from correct citations to legal reasoning.

Benchmark scoreboard: closed-book, open-book (RAG) and legal-essay results versus Qwen3.6-35B and the Nemotron base

EvaluationOpenThai 2.0 LegalQwen3.6-35BNemotron-3-30B base
Closed-book · Civil & Commercial recall (n=3,729)0.070.020.001
Closed-book · Revenue Code recall (n=50)0.400.360.31
Open-book · cite from context (n=3,729)0.990.990.98
Open-book · tax echo (n=50)0.840.840.64
Open-book · tax selection among distractors (n=50)0.690.640.45
Essay · correct citations (n=72)0.250.090.02
Essay · reaches the right holding (n=72)0.570.500.31
Essay · covers the key points (n=72)0.600.550.27
Essay · writing quality (n=72)0.460.430.13

Scores run 0 to 1, higher is better. Citation rows use NitiBench's citation-F1 scorer; essay holding, coverage and fluency are judged by Gemini 3.1 Flash Lite. Every model was re-run end to end under one identical protocol — single pass, thinking off, citations checked by code rather than by an AI judge.

One honest caveat, stated up front: a closed cloud API still recalls more Thai law than we do. Our claim is scoped to models you can run on your own hardware — and there, this is the best we have measured.

Every answer names its source

Knowing the law is only half of it. Legal work needs answers you can check.

OpenThai 2.0 Legal returns the exact law name and section in a fixed JSON contract:

{"answer": "นาย ก. ต้องรับผิดตามประมวลกฎหมายแพ่งและพาณิชย์ มาตรา 420",
"citations": [{"law": "ประมวลกฎหมายแพ่งและพาณิชย์", "section": "420"}]}

That is not a formatting nicety — it is what makes the model usable in software. Citations parse straight into RAG pipelines, drafting tools and review workflows, and a reviewer can verify each one against the statute instead of taking it on trust.

In the RAG setting the model is handed candidate sections and cites only the ones that actually apply. It works with whatever retriever you already run — no particular embedding or rerank model required. And because closed-book recall is strong, plenty of questions need no retrieval at all.

It runs on your own hardware

This matters more than any single benchmark. Case files, client matters and internal investigations are exactly the data organizations cannot send to someone else's cloud.

OpenThai 2.0 Legal is a 30-billion-parameter Mixture-of-Experts model that activates only ~3B parameters per token, so it runs on a single GPU from 24 GB of VRAM in NVFP4 (4-bit) — and on 2× H100 in bfloat16 for full-precision serving. Law firms, banks and government agencies can keep sensitive matters entirely inside their own perimeter, under their own governance.

How it was built

Training pipeline: Base 30B → CPT → SFT → GRPO → Released

Three stages on the NVIDIA NeMo stack, each solving one problem:

  1. CPT — inject the law. The model drills the full text of every section in both directions (recite the section from its number; name the section from its meaning), so the knowledge lives in the weights. 360,985 drills, ~800M Thai-law tokens.
  2. SFT — teach the exam. Every answer follows a fixed JSON contract citing only the sections it was given. 16,436 exam answers and เนติบัณฑิต essays.
  3. GRPO — sharpen citations. Reinforcement learning where the reward is the benchmark's own citation F1: cite exactly what applies and the draft is reinforced; add a wrong section and it is suppressed. 8,568 graded questions, ~68,500 drafts.

The base is NVIDIA's Nemotron-3-Nano-30B-A3B, a hybrid Mamba-Transformer MoE; training used Megatron-Bridge for CPT/SFT and NeMo-RL for GRPO.

Try it right now — live, free, no GPU

Ask the real model a Thai legal question, straight from this page:

⚖️

Try OpenThai 2.0 Legal — Live

FREE API · 1 MONTH

Real model, real answers. Free with your iApp API key until 24 Aug 2026.

📚
RAG connected — answers grounded in real statute text

This API retrieves from a 39-law, 6,300-section Thai statute corpus (hybrid BM25 + embedding search + reranker) and grounds every answer in the current law text. The sections it selects are shown below each answer. Switch to Closed-book mode (rag: false in the API) to compare with the bare model.

Full legal analysis in prose, citing มาตรา — grounded in auto-retrieved current statute text.

Try an example:
🧑‍💻 Developer view — the API call behind this demo

This curl command updates live as you change the question, mode and toggles above. Run it in your terminal with your own API key — it is exactly what this page sends.

Request (curl)
curl -s https://api.iapp.co.th/v3/llm/openthai2p0-legal/chat/completions \
  -H "Content-Type: application/json" \
  -H "apikey: YOUR_IAPP_API_KEY" \
  -d '{
  "model": "openthai2.0-legal",
  "rag": true,
  "rag_inject": "system",
  "messages": [
    {
      "role": "system",
      "content": "You are a Thai legal expert. Answer with legal analysis and cite the relevant มาตรา."
    },
    {
      "role": "user",
      "content": "จำเลยขีดฆ่าและฉีกเอกสารหลักฐานแห่งหนี้ แม้ยังอ่านได้ ถือเป็นความผิดสำเร็จหรือเพียงพยายามกระทำผิด"
    }
  ],
  "temperature": 0,
  "top_p": 1,
  "max_tokens": 4096,
  "chat_template_kwargs": {
    "enable_thinking": true
  }
}'

Outputs are decision support, not legal advice. Verify every citation against the current law. Free with an iApp API key to 24 Aug 2026; standard pricing afterwards is 0.01/0.02 IC per 1K input/output tokens (same as Thanoy Legal AI).

And this is the full production setup, not a stripped-down toy: the API has RAG built in — it hybrid-searches a 39-law, 6,300-section Thai statute corpus (BM25 + embeddings + reranker) and grounds each answer in the current law text, showing you the exact sections it selected under every answer. Curious how the bare model does on its own? The Closed-book tab ("rag": false in the API) is the side-by-side comparison. To build the same retrieval stack on your own infrastructure, our Open WebUI & OpenThaiRAG tutorial gets you there in under an hour.

And the same endpoint is yours to build on: a free hosted API for one month — OpenAI-compatible, free until 24 August 2026 with a free iApp API key (registerAPI Keys; 30 requests/minute). After the promo it continues at standard Thanoy-rate pricing, 0.01/0.02 IC per 1K input/output tokens.

from openai import OpenAI
client = OpenAI(base_url="https://api.iapp.co.th/v3/llm/openthai2p0-legal", api_key="YOUR_IAPP_API_KEY")

r = client.chat.completions.create(
model="openthai2.0-legal",
messages=[{"role": "user", "content": "ลักทรัพย์ในเวลากลางคืน ผิดมาตราใด"}],
max_tokens=1024,
)
print(r.choices[0].message.content)

Or run it yourself in five minutes

vllm serve iapp/openthai2.0-legal-thaillm-nemotron-3-nano-30b-a3b \
--tensor-parallel-size 2 --trust-remote-code \
--max-model-len 32768 --enforce-eager

Then talk to it through any OpenAI-compatible client — NVIDIA NIM exposes the same endpoint if you prefer that path. Full prompts, recommended generation settings and worked examples for all three modes (RAG, closed-book and essay) are on the model page.

What it is not

We would rather say this ourselves than have you find out later:

  • Retrieval quality drives results. Hand it the right sections and citations are near-perfect. Hand it the wrong ones and the answer follows them.
  • Near-miss rejection is the hard part. Telling a governing section from a closely related one is the lowest-scoring axis for every model tested, ours included.
  • Coverage has edges. Training focused on Thai statutory law and Revenue Department rulings; niche areas and very recent amendments may be thinner, and statutes change.
  • It is decision support, not legal advice. A qualified professional should verify every citation against the current law before anyone relies on it.

Why we are giving it away

"Thai law deserves an AI that actually knows Thai law — and that Thai organizations can own and run themselves. By releasing OpenThai 2.0 Legal as open weights, we're putting a genuinely capable, self-hostable legal model into the hands of every Thai lawyer, developer and institution. It was built by Thais, for Thailand."

Dr. Kobkrit Viriyayudhakorn, Chief Executive Officer, iApp Technology

Sovereign AI is not only about who owns the compute. It is about who can build, inspect and improve the models. Every university lab, startup and agency that fine-tunes, evaluates or deploys this model makes Thailand's collective AI capability stronger — and the same recipe applies to any language and legal system that has been waiting for one.

OpenThai 2.0 Legal was built by the OpenThai team (AIEAT / iApp Technology) on the NVIDIA Nemotron and NeMo stack, together with the Big Data Institute (BDI), the ThaiLLM initiative and NVIDIA.

Get started