LEGALMIDM: Use-Case-Driven Legal Domain Specialization for Korean Large Language Model

Youngjoon Jang, Chanhee Park, Hyeonseok Moon, Young-kyoung Ham, jiwon moon, Jinhyeon Kim, JuKyung Jung, Heuiseok Lim

TL;DR

This paper introduces LEGALMIDM, a specialized large language model (LLM) for the Korean legal domain, developed through a novel use-case-driven framework. By meticulously curating legal datasets and optimizing training pipelines with input from legal professionals, they demonstrate a significant improvement in legal task performance compared to general-purpose LLMs.

What Problem Does This Paper Address?

The rapid advancement of large language models (LLMs) has led to a surge in efforts to adapt them for specialized domains. However, many existing domain-specific LLMs, particularly in critical fields like law, are developed without a deep understanding of real-world application needs. This often results in models that lack the precision and reliability required for practical use. The legal domain, in particular, has a high demand for AI-assisted tools, but current LLM training approaches often fall short due to simplistic assumptions about utility and a lack of rigorous data curation aligned with actual legal tasks. This paper aims to bridge this gap by proposing a systematic, use-case-driven framework for developing legal LLMs, focusing specifically on the Korean legal landscape.

Methods

The authors propose a systematic training framework for legal domain specialization. Key components include:

  • Use-Case-Driven Dataset Construction: They analyze existing legal tech services to identify high-demand tasks (e.g., document drafting, question answering) and collaborate with legal professionals to curate high-quality, use-case-driven datasets.
  • Automatic Law QA Generation: A method is presented to automatically generate legal Q&A pairs by leveraging Korean statutes. This involves using GPT-40 to create questions and answers from legal texts, with a verification step to ensure factual grounding.
  • Training Pipeline Optimization: They investigate optimal training strategies, including:
  • General Domain Merging: Evaluating the impact of integrating general domain data during Continual Pre-Training (CPT) and Instruction-Tuning (IT) to prevent catastrophic forgetting and enhance adaptability.
  • Synthetic Data Variation: Experimenting with different formats for incorporating legal references in synthetic data (e.g., as input, output, or both) to find the most effective approach.
  • System Prompt Optimization: Analyzing the role of system prompts in assigning a legal advisor persona, both during training and inference, to improve identity reflection and overall performance.

The base model used is Mi:dm-2.0-Base, a Korean-English bilingual LLM from KT.

Datasets

The paper utilizes several datasets for training and evaluation:

  • Continual Pre-Training (CPT) Datasets:
    • AIHub Legal (English-Korean parallel legal texts)
    • Law Books (legal certification exam textbooks)
    • LegalTimes (legal opinions and editorials)
    • Knowledge QA (legal Q&A from Naver platform)
    • Korean Laws (judicial precedents and statutes)
    • Korean Web Text (general Korean web corpus)
  • Instruction-Tuning (IT) Datasets:
    • QA_Automatic (automatically generated law Q&A)
    • QA_Human (human-curated law Q&A)
    • Summary (judicial precedent summarization)
    • Complaint (legal complaint drafting)
    • Petition (legal petition drafting)
    • MC (multiple-choice legal questions)
    • MRC (Machine Reading Comprehension on judicial precedents)
    • Hf General (general domain Q&A)
  • Human-Curated Data Statistics: A subset of the above, including OpenQA, Summary, Complaint, Petition, Doc-QA, and MC, with specific row counts.
  • General Domain Datasets for IT: KoAlpaca-v1.1a and KOpen-HQ-Hermes-2.5-60K.
  • General Task Evaluation Datasets: KMMLU and HAERAE (Korean general benchmarks).
  • Real-world General Use-Case Data: Community (2024) dataset (user queries from ChatKoAlpaca service and GPT-4o responses) for evaluating general user query handling.

Key Insights and Ideas

  • Use-Case-Driven Approach is Crucial: Simply fine-tuning on legal text isn't enough. Aligning training data and tasks with actual legal professional needs and common LLM use cases is paramount for practical utility.
  • General Domain Data Boosts Legal Performance: Integrating general domain data during both Continual Pre-Training (CPT) and Instruction-Tuning (IT) significantly enhances legal domain performance, preventing adaptability issues that arise from training solely on legal texts.
  • Optimal Synthetic Data Format Matters: The way legal references are integrated into synthetic data impacts performance differently across tasks. Generating references as part of the output works best for document-based tasks but hurts performance on multiple-choice questions, highlighting the need for task-specific optimization.
  • System Prompts for Identity, Not Training: While system prompts are effective for establishing a legal advisor persona at inference time, including them during the training phase can negatively impact overall legal performance.

Key Results

  • LEGALMIDM Outperforms: The LEGALMIDM model demonstrates superior performance on high-demand Korean legal tasks compared to other LLMs, including larger ones.
  • Comparable General Performance: LEGALMIDM achieves comparable performance on general domain tasks, even against larger models, validating the effectiveness of the proposed methodology.
  • Data Composition Impact: Integrating general domain data in CPT and IT leads to significantly better legal domain performance. Training exclusively on legal data results in lower adaptability.
  • Synthetic Data Format Trade-offs: Incorporating legal references (either as input or output) improves document-based task performance. Generating references as output yields the best results for document-based tasks but degrades performance on multiple-choice questions. The chosen strategy for LEGALMIDM is to integrate legal references into the input.
  • System Prompt Effectiveness: Using system prompts at inference time clearly improves identity reflection (responding with "Midm" to name-related questions). However, training without system prompts yields the best overall performance.

Limitations and Future Work

  • Single Model Tested: The study tested only one base model (Mi:dm-2.0-Base). The authors acknowledge that this might limit the generalizability of their findings to other LLMs, though they emphasize their strategy is not model-specific.
  • Future Work: The authors aim to extend their research to facilitate the general application of their methods to other domains.

Summary updated

BibTeX
@inproceedings{jang2026legalmidm,
  author = {Youngjoon Jang and Chanhee Park and Hyeonseok Moon and Young-kyoung Ham and jiwon moon and Jinhyeon Kim and JuKyung Jung and Heuiseok Lim},
  title = {{LEGALMIDM: Use-Case-Driven Legal Domain Specialization for Korean Large Language Model}},
  booktitle = {DATA-FM @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=XqjuAdSVFq},
}
Figure