HUKUKBERT: Domain-Specific Language Model for Turkish Law
This paper introduces HukukBERT, a state-of-the-art Turkish legal language model trained on a 18 GB domain-specific corpus using a hybrid masking strategy, which significantly outperforms existing models in legal term prediction and court decision segmentation tasks.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are trying to teach a brilliant, well-read student how to become a lawyer in Turkey. You have two options:
- The Generalist: You give them a library of 84 billion books about everyday life, news, Wikipedia, and casual conversation. They become incredibly smart about the world in general.
- The Specialist: You give them a smaller, but highly curated library of 21 billion words, but every single book is strictly about Turkish law, court rulings, and legal codes.
This paper introduces HukukBERT, which is the Specialist. The authors argue that for the complex, tricky world of Turkish law, the Generalist just doesn't cut it, no matter how many books they've read.
Here is the story of how they built HukukBERT, explained simply:
1. The Problem: The "Translation" Disaster
Turkish is a very "sticky" language (linguists call it agglutinative). You can glue many small pieces together to make one long word.
- General Models' Mistake: Imagine a general AI trying to read a legal document. It sees a complex legal phrase like "Decision on the Unification of Judgments" and tries to chop it up into tiny, meaningless crumbs like "Decision," "on," "the," "Unif," "ication," "of," "Judg," "ments."
- The Result: The AI loses the meaning. It's like trying to understand a recipe by only reading the letters "fl," "ou," and "r" separately instead of the word "flour."
- The "Semantic Shift" Trap: In law, common words mean something totally different. In everyday life, "estate" might mean a big house. In Turkish law, a specific word (tereke) means "the total assets of a deceased person." General AI models guess the common meaning ("house" or "inheritance") and get the legal answer wrong.
2. The Solution: Building a Custom Toolkit
The authors didn't just feed more data to an existing model. They built a custom toolkit from scratch:
- The "Clean" Library (Data): They gathered 27 GB of raw legal text (court decisions, laws, academic papers). But legal text is full of repetitive "boilerplate" (standard phrases like "It is considered necessary..."). They used a smart filter to remove the duplicates and balanced the library so the AI didn't just memorize court rulings but also learned from laws and academic theories.
- The Custom Dictionary (Tokenizer): This is the most important part. They created a new dictionary with 48,000 words specifically designed for law.
- Analogy: Instead of a dictionary that breaks "Unification" into "Uni-fic-ation," their dictionary treats the whole legal concept as one single block. This stops the AI from getting confused by the "sticky" parts of Turkish words.
- The "Hard Mode" Training (Masking): When training the AI, they didn't just hide random words. They used a special strategy where they hid entire legal concepts or key legal terms.
- Analogy: Instead of asking a student, "What is the [blank] in the sentence?" (where they might guess a grammar word), they asked, "In an inheritance case, what is the specific legal term for the deceased's total assets?" This forced the AI to learn the logic of law, not just the grammar.
3. The Results: The Specialist Wins
They tested HukukBERT against the "Generalists" (like TabiBERT, which read 84 billion tokens of general text) and the "Old Specialists" (older Turkish legal models).
- The Legal Cloze Test: They created a quiz of 750 hard legal questions.
- General Models: Got about 60-70% right. They kept guessing common words instead of legal terms.
- HukukBERT: Got 84.4% right. It knew exactly when to use the precise legal word instead of the everyday word.
- The Real-World Test (Document Segmentation): They asked the AI to take a messy, 50-page court decision and automatically cut it into sections (Header, Claim, Defense, Ruling, etc.).
- HukukBERT: Successfully cut the document correctly 92.8% of the time.
- Others: Failed much more often, getting lost in the long, complex sentences.
4. Why This Matters
Think of Turkish law as a very dense, old forest.
- General AI is like a hiker with a good map of the whole country but no compass for this specific forest. They get lost in the thickets.
- HukukBERT is a guide who has walked this specific forest a thousand times. They know exactly where the hidden paths are and what every strange plant is called.
The Bottom Line
The authors released HukukBERT, its custom dictionary, and their quiz to the public. They are saying: "If you want to build legal AI for Turkey, don't just throw more general data at a generic model. You need a model that speaks the specific, sticky, precise language of Turkish law."
This is a huge step forward for "LegalTech" in Turkey, making it possible to build tools that can actually understand court rulings, predict outcomes, and organize legal documents without human error.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.