Enhancing legal question answering with data generation and knowledge distillation from large language models

Abstract Legal question answering (LQA) relies on supervised methods to automatically handle law-related queries. These solutions require a substantial amount of carefully annotated data for training, which makes the process very costly. Although large language models (LLMs) show promise in zero-shot QA, their computational demands limit their practical use, making specialized small language models (SLMs) more favorable. Furthermore, the growing interest in synthetic data generation has recently surged, spurred by the impressive generation capabilities of LLMs. This paper presents Ace-Attorney , an LLM distillation approach devised to develop LQA data and supervised models without human annotation. Given a textual prompt, a frozen LLM generates artificial examples that are used as knowledge to train a student SLM with an order of magnitude fewer parameters. Taking into account a realistic retrieval-based scenario to fetch the correct document for answer generation, we propose Selective Generative Paradigm, a novel approach designed to improve retrieval efficacy. Extensive experiments demonstrate the effectiveness and efficiency of distilled models on Syn-LeQA , our human-free synthetic dataset, and a public expert-annotated corpus. Notably, by using only a few dozen training samples, our best SLM achieves LLM-comparable performance with $$\approx $$ <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:mo>≈</mml:mo> </mml:math> 1200% less CO $$_2$$ <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:mmultiscripts> <mml:mrow/> <mml:mn>2</mml:mn> <mml:mrow/> </mml:mmultiscripts> </mml:math> emissions. The data and the code to fully reproduce our results are available at https://github.com/disi-unibo-nlp/ace-attorney .

Authors

Institutions

Publication Details

Journal
Artificial Intelligence and Law
Published
2025-07-16
DOI
https://doi.org/10.1007/s10506-025-09463-9
Citations
3
Primary Topic
Topic Modeling
Type
article
Field-Weighted Citation Impact
7.44

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Enhancing legal question answering with data generation and knowledge distillation from large language models

Luca Ragazzi, Paolo Italiani, Gianluca Moro
3 citations
Artificial Intelligence and Law
Topic Modeling
7.44
article

Enhancing legal question answering with data generation and knowledge distillation from large language models

Luca Ragazzi, Paolo Italiani, Gianluca Moro
article en
3 citations

Abstract

Abstract Legal question answering (LQA) relies on supervised methods to automatically handle law-related queries. These solutions require a substantial amount of carefully annotated data for training, which makes the process very costly. Although large language models (LLMs) show promise in zero-shot QA, their computational demands limit their practical use, making specialized small language models (SLMs) more favorable. Furthermore, the growing interest in synthetic data generation has recently surged, spurred by the impressive generation capabilities of LLMs. This paper presents Ace-Attorney , an LLM distillation approach devised to develop LQA data and supervised models without human annotation. Given a textual prompt, a frozen LLM generates artificial examples that are used as knowledge to train a student SLM with an order of magnitude fewer parameters. Taking into account a realistic retrieval-based scenario to fetch the correct document for answer generation, we propose Selective Generative Paradigm, a novel approach designed to improve retrieval efficacy. Extensive experiments demonstrate the effectiveness and efficiency of distilled models on Syn-LeQA , our human-free synthetic dataset, and a public expert-annotated corpus. Notably, by using only a few dozen training samples, our best SLM achieves LLM-comparable performance with $$\approx $$ <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:mo>≈</mml:mo> </mml:math> 1200% less CO $$_2$$ <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:mmultiscripts> <mml:mrow/> <mml:mn>2</mml:mn> <mml:mrow/> </mml:mmultiscripts> </mml:math> emissions. The data and the code to fully reproduce our results are available at https://github.com/disi-unibo-nlp/ace-attorney .

Artificial Intelligence and Law
University of Bologna (IT)
European Commission, Università di Bologna
Openalex Percentile: Top 3%
Topic Modeling
7.44
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Enhancing legal question answering with data generation and knowledge distillation from large language models — Luca Ragazzi, Paolo Italiani, et al. · Artificial Intelligence and Law (2025) | TGRS Research Map | TGRS