moncefem/legi-instruct-fr
Légitus SFT — French Legal Instruction Dataset 27,357 synthetic instruction-tuning examples in French, built to teach a legal-assistant behavior grounded in real French legislation (Légifrance / the LEGI corpus): answering from provided sources with correct citations, abstaining when sources are insufficient or off-topic, calling a legal-search tool when one is available, handling situational (non-legal-jargon) questions, and structured extraction/citation formats. This dataset… See the full description on the dataset page: https://huggingface.co/datasets/moncefem/legi-instruct-fr.
Légitus SFT — French Legal Instruction Dataset
27,357 synthetic instruction-tuning examples in French, built to teach a legal-assistant behavior grounded in real French legislation (Légifrance / the LEGI corpus): answering from provided sources with correct citations, abstaining when sources are insufficient or off-topic, calling a legal-search tool when one is available, handling situational (non-legal-jargon) questions, and structured extraction/citation formats.
This dataset is the SFT stage of a larger pipeline: a swiss-ai/Apertus-8B-2509 base model first continued-pretrained (CPT) on the LEGI French legal corpus, then instruction-tuned (SFT) on this dataset to produce a grounded, citation-aware French legal assistant ("Légitus").
Note on curation: this repository contains the full, uncurated generation output. A downstream curation pass (see Known Limitations) removes a small fraction ofabstention/no_answerexamples that don't actually demonstrate the behavior their label claims — recommended before training on this data as-is.
Dataset Summary
Every example is a multi-turn messages conversation (system?, user, assistant, optionally tool/further assistant turns for tool-calling examples), generated by fanning a diverse set of seed questions and real French legal-article excerpts out across 5 different LLMs via OpenRouter, then validated (French-language check, abstention/problem-flagging keyword checks for the categories that require them, deduplication, and a hard token-length cap using the real Apertus tokenizer). Nothing here is Apertus-tokenized or otherwise tied to a specific model's special tokens — it's portable messages-schema JSON, usable with any chat-template renderer.
Supported Tasks
- Grounded / RAG question answering with correct citation of a numbered source and abstention when sources don't cover the question.
- Tool-calling for legal lookup (
search_legifrance,get_article-style function calls). - Extraction from a legal document following a stated instruction.
- Structured citation formatting (JSON-formatted answers with an explicit citations list).
- Closed-book legal reasoning (explaining principles without inventing unsourced specifics).
- Situational / plain-language legal questions (a layperson describing a real-life situation, not quoting statute language).
Languages
French (fr) — user questions, system prompts, and assistant answers are all French. A small number of tool-call arguments JSON strings may contain latinized technical keys (e.g. "query", "code", "date"), which is a function-calling convention, not natural-language text.
Dataset Structure
Data Instances
One example per category (trimmed to the first ~220 characters per message for readability — real examples run from ~70 to ~2,400 tokens):
<details> <summary><b>groundedrag</b> (variant: <code>wrongdate</code>) — model: nvidia/nemotron-3-ultra-550b-a55b</summary>
{
"messages": [
{"role": "system", "content": "Vous êtes un assistant juridique spécialisé en droit français. Pour toute affirmation sur le droit positif, appuyez-vous UNIQUEMENT sur les sources fournies et citez les articles utilisés..."},
{"role": "user", "content": "Sources :\n[S1]\nType : CODE\nTitre : Code général des collectivités territoriales\nArticle : R4221-9\nIdentifiant : LEGIARTI000024896851\nVersion en vigueur du 2011-11-25 au en cours\n..."},
{"role": "assistant", "content": "La version fournie de l'article R4221-9 du Code général des collectivités territoriales [S1], identifiant LEGIARTI000024896851, est en vigueur depuis le 25 novembre 2011. Elle ne couvre pas les dates antérieures..."}
],
"category": "grounded_rag", "variant": "wrong_date",
"sources": ["LEGIARTI000024896851", "LEGIARTI000018710317", "LEGIARTI000006293544"],
"model": "nvidia/nemotron-3-ultra-550b-a55b"
}</details>
<details> <summary><b>tool_use</b> (variant: <code>tool</code>) — model: qwen/qwen-2.5-72b-instruct</summary>
{
"messages": [
{"role": "system", "content": "Vous êtes un assistant juridique... capable d'appeler des outils...", "tools": [{"type": "function", "function": {"name": "search_legifrance", "description": "...", "parameters": {"...": "..."}}}]},
{"role": "user", "content": "Un groupement interconsulaire souhaite être déclaré concessionnaire de travaux publics pour un projet de la région."},
{"role": "assistant", "content": null, "tool_calls": [{"id": "call_463e436f", "type": "function", "function": {"name": "search_legifrance", "arguments": "{\"query\": \"groupement interconsulaire concessionnaire travaux publics\", \"code\": \"Code d...\"}"}}]},
{"role": "tool", "tool_call_id": "call_463e436f", "content": "[S1]\nType : CODE\nTitre : Code de commerce\nArticle : L450-10\n..."},
{"role": "assistant", "content": "Selon l'article **R711-24** du *Code de commerce* (LEGIARTI000022682770), les groupements interconsulaires peuvent être déclarés concessionnaires..."}
],
"category": "tool_use", "variant": "tool",
"sources": ["LEGIARTI000043537467", "LEGIARTI000022682770"],
"model": "qwen/qwen-2.5-72b-instruct"
}</details>
<details> <summary><b>citation</b> (variant: <code>default</code>) — model: qwen/qwen-2.5-72b-instruct</summary>
{
"messages": [
{"role": "system", "content": "En tant qu'assistant juridique en droit français, répondez exclusivement à partir des sources fournies ci-dessous. Citez chaque article mobilisé..."},
{"role": "user", "content": "Sources :\n[S1]\nType : CODE\nTitre : Code rural (ancien)\nArticle : 777\nIdentifiant : LEGIARTI000006580541\n..."},
{"role": "assistant", "content": "{\n \"answer\": \"Le taux de capitalisation pour les versements effectués au titre du 'domaine-retraite'...\",\n \"legal...\": \"...\"\n}"}
],
"category": "citation", "variant": "default",
"sources": ["LEGIARTI000006580541", "LEGIARTI000019321833"],
"model": "qwen/qwen-2.5-72b-instruct"
}</details>
<details> <summary><b>abstention</b> (variant: <code>default</code>) — model: google/gemini-2.5-flash-lite</summary>
{
"messages": [
{"role": "system", "content": "Vous traitez des questions de droit français. N'utilisez que les sources ci-dessous ; n'inventez aucun article ni aucune référence. Citez systématiquement vos sources..."},
{"role": "user", "content": "J'ai besoin de savoir si je dois déclarer un don manuel d'argent reçu de mes parents."},
{"role": "assistant", "content": "Votre question porte sur la déclaration d'un don manuel d'argent. Il est important de noter que la règle concernant la déclaration des dons manuels a évolué...\n\nAntérieurement, ..."}
],
"category": "abstention", "variant": "default", "sources": [],
"model": "google/gemini-2.5-flash-lite"
}</details>
<details> <summary><b>situational</b> (variant: <code>internal</code>) — model: nvidia/nemotron-3-ultra-550b-a55b</summary>
{
"messages": [
{"role": "system", "content": "Vous expliquez le droit français de façon pédagogique et prudente. Ne présentez jamais une référence précise comme certaine sans source..."},
{"role": "user", "content": "Je suis locataire d'un appartement depuis trois ans. Mon propriétaire veut me donner congé pour vendre le logement. Il m'a envoyé une lettre recommandée il y a 15 jours. Ai-je un droit de préemption ?..."},
{"role": "assistant", "content": "De manière générale, en cas de congé pour vente d'un logement loué nu à titre de résidence principale, le locataire bénéficie d'un droit de priorité..."}
],
"category": "situational", "variant": "internal",
"sources": ["LEGIARTI000041780473", "LEGIARTI000006350818", "LEGIARTI000006351004"],
"model": "nvidia/nemotron-3-ultra-550b-a55b"
}</details>
<details> <summary><b>closedbook</b>, <b>contextgrounded</b>, <b>extraction</b>, <b>general</b> — same schema</summary>
Same messages/category/variant/sources/model shape; see the Data Fields table below for what each category means and the full example histogram. </details>
Data Fields
Category breakdown (n=27,357; token counts via the real swiss-ai/Apertus-8B-Instruct-2509 tokenizer, chat-template-rendered):
What each category teaches:
- `grounded_rag` — answer from numbered
[S1]/[S2]... source blocks. Variants specifically stress-test:clean(straightforward grounding),distractor(an irrelevant source present, must be ignored),incomplete(sources partially cover the question),no_answer(sources don't cover it at all — must abstain, not fabricate),sources_format(must list which sources were actually used, in a structured format),wrong_date(a source version that doesn't apply to the date in question — must catch this, not misapply it). - `context_grounded` — same idea,
cleanvariant only (no adversarial stress-test). - `abstention` — a planted problem in the premise or sources (wrong citation, non-existent article, repealed provision) that the assistant must catch and flag rather than answer through.
- `closed_book` — explain legal principles/reasoning without a source block; must not assert a specific article is in force without one.
- `situational` — a layperson describing a real situation (not legal jargon);
internal(reason from general knowledge),rag(sources provided),tool(a tool is available to look things up). - `tool_use` — multi-turn: assistant emits a
tool_callsrequest, atoolmessage returns retrieved article text, assistant gives the final grounded answer. - `extraction` — extract/summarize specific information from a provided legal document, staying faithful to it.
- `citation` — answer in a structured JSON format including an explicit citations list.
- `general` — general legal-adjacent instruction-following (summarization, explanation) without a strict RAG/citation requirement.
Additional structural stats:
- 89.0% of examples (24,357 / 27,357) include a
systemmessage; the rest are user-turn-only. - 3,677 examples declare
toolson the system message (alltool_use, plus thetool-variant slice ofsituational). - 4,151 examples are multi-turn (2 assistant turns — a tool-call turn followed by the final answer).
- Total corpus size: 17.7M tokens (Apertus tokenizer, chat-template-rendered).
Data Splits
Single train split (27,357 examples). No pre-baked validation/test split is included — the training pipeline this dataset was built for carves out a random ~1% holdout at train time (eval_fraction) rather than shipping a fixed split, since the categories/variants above are already a deliberate stratified design and a fixed split would need to preserve that balance.
Dataset Creation
Curation Rationale
Built to teach a grounded, non-hallucinating legal-assistant behavior: cite real sources when given them, explicitly abstain when sources are insufficient/off-topic/wrong-version rather than inventing an answer, use a search tool when the system prompt makes one available, and handle plain-language situational questions as well as jargon-heavy ones. The variant design (adversarial distractor/wrong_date/no_answer cases) specifically targets citation hallucination, which was identified as the primary failure mode to avoid for a legal-domain assistant.
Source Data
Grounding context (the [S1]/[S2]... source blocks referenced by sources) is drawn from real French legislation: the LEGI corpus via Légifrance (the French government's official legal publication service), the same corpus used for the base model's continued-pretraining (CPT) stage. Article text, identifiers (LEGIARTI...), titles, and version/date-range metadata are real, current-in-force (or deliberately superseded, for the wrong_date adversarial variant) legal text — not synthesized. general and closed_book examples reference legal topics without quoting a specific source block.
Generation Process
Each example is produced by an LLM (fanned out across 5 models via OpenRouter for stylistic diversity and to avoid single-model bias) given: (a) a category/variant-specific generation instruction, (b) for grounded categories, 1-4 real sampled article excerpts from the LEGI corpus, and (c) a strict "respond with JSON only" instruction. Temperature 0.9 for response diversity.
Model mix (roughly even, ~19-21% each):
Validation gates applied at generation time (failing examples are discarded, not retried into the dataset): output must parse as valid JSON in the requested schema; must pass a French-language heuristic; grounded_rag's no_answer variant and the abstention category are checked for abstention/problem-flagging keywords (imperfect — see Known Limitations); assistant tool-call content is coerced from null per OpenAI convention; every example is capped at the real Apertus-tokenizer-rendered token count (hard limit, chat-template + tool-schema included, not just raw text length); exact-duplicate conversations are hashed and dropped.
Known Limitations and Recommended Curation
A post-hoc audit (checking whether examples actually demonstrate the behavior their category/variant label claims, via keyword-marker matching on the assistant's answer) found:
- 114 / 505 of the
grounded_rag/no_answervariant (~22.6% of that slice) don't actually contain abstention language — the assistant answered as if the sources were sufficient instead of catching that they aren't. - 351 / 3,302 of the
abstentioncategory (~10.6% of that slice) don't contain problem-flagging language — the assistant answered through the planted issue instead of catching it. - Combined, this is 465 / 27,357 (~1.7%) of the full dataset. Training on these examples as-is would reinforce the opposite of the intended behavior for that slice.
- Recommended: filter these out before training rather than using this file as-is. This is a cheap, mechanical filter (check for abstention/problem-flagging markers in the answer text) — happy to share the exact filter script on request.
No claim is made that every remaining example is perfect — this is a keyword-marker audit of the two highest-risk categories (where a wrong answer is opposite-of-intended, not just imperfect), not a full manual correctness review of all 27,357 examples.
Considerations for Using the Data
Intended Use
Instruction-tuning a model to be a grounded French legal information assistant — not a substitute for legal advice. Assistant answers in this dataset are themselves LLM-generated and, while grounded in real source text for most categories, have not been reviewed by a legal professional. Downstream models trained on this data should preserve the abstention/citation behavior it teaches and should not be deployed as a substitute for professional legal counsel.
Licensing Information
This dataset (the compilation, structuring, category/variant design, and validation code) is released under Apache License 2.0.
Two underlying provenance notes worth being aware of, independent of this dataset's own license:
- Underlying legal source text (article titles, identifiers, and quoted statute text in the
[S1]/[S2]... blocks) is French government public legal data via Légifrance/LEGI, itself reusable under France's open-licence framework for public administrative data (Etalab Open Licence / Licence Ouverte). - Synthetic instruction/answer text was generated by 5 third-party commercial LLMs (Google Gemini, DeepSeek, NVIDIA Nemotron, Alibaba Qwen) accessed via OpenRouter. If your use case has strict requirements around model-output provenance, it's worth being aware that generation terms of service can vary by provider — but this dataset itself is Apache-2.0 licensed.
Social Impact and Bias
Assistant responses reflect the training data and alignment of 5 different commercial LLMs (not one uniform "voice"), which may carry each model's own factual errors or stylistic quirks — mitigated but not eliminated by the abstention/citation validation gates described above. French legal domain content may also reflect the state of French law at generation time (2026) and does not track subsequent legislative changes.
Citation
If you use this dataset, please cite it as:
@misc{legitus-sft-2026,
title = {Légitus SFT: A French Legal Instruction-Tuning Dataset},
year = {2026},
note = {Synthetic dataset for instruction-tuning a grounded French legal assistant,
built on the LEGI/Légifrance corpus.},
howpublished = {\url{https://huggingface.co/datasets/moncefem/legi-instruct-fr}}
}