--- license: cc-by-4.0 language: - en tags: - eu-law - legal - gdpr - ai-act - rag - retrieval - instruction-tuning task_categories: - text-generation - text-retrieval configs: - config_name: chunks data_files: chunks/train.jsonl - config_name: finetuning data_files: finetuning/train.jsonl --- # EuropeGram: EU Legal Text -- RAG Chunks & Instruction Data Structured, chunked, and instruction-formatted text derived from official EU legislation, built for retrieval-augmented generation (RAG) and LoRA fine-tuning experiments comparing Base / RAG / Fine-tuned / Fine-tuned+RAG LLM strategies over EU documents. Produced by the EuropeGram project's extraction -> chunking -> fine-tuning-export pipeline. ## Source documents | Document | CELEX ID | Source | Chunks | Instruction pairs | |---|---|---|---|---| | Regulation (EU) 2024/1689 (Artificial Intelligence Act) | `32024R1689` | [EUR-Lex](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32024R1689) | 316 | 126 | | Regulation (EU) 2016/679 (General Data Protection Regulation) | `32016R0679` | [EUR-Lex](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679) | 187 | 99 | **Attribution & authenticity notice.** The underlying legal texts are reproduced from the official PDF renditions published on EUR-Lex. Reuse of EU legislation is permitted free of charge under [Decision 2011/833/EU](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32011D0833), provided the source is acknowledged and the meaning or message of the original is not distorted. **Only the versions published in the Official Journal of the European Union are authentic and legally binding** -- this dataset is a derived, machine-processed artifact for ML research and must not be treated as an authoritative legal source. ## Configs ### `chunks` One row per RAG chunk (structure-aware: packed by article/annex paragraph, capped at `max_chars` with `overlap_chars` overlap for long ones -- see `europegram.rag.chunker`). Fields: - `id`: chunk id, e.g. `article-4-chunk-0` - `text`: chunk text (first chunk of an article/annex is prefixed with its heading) - `document_id`, `celex_id`: which source document - `ref_type`: `"article"` or `"annex"` - `ref_id`: e.g. `"article-4"`, `"annex-viii"` - `title`: article/annex title - `chapter_number`, `chapter_title`: containing chapter, when applicable (nullable) - `page_start`, `page_end`: page span in the source PDF - `chunk_index`: position of this chunk within its article/annex (0-based) ### `finetuning` One Alpaca-style instruction/output pair per article/annex, for LoRA fine-tuning (see `europegram.finetuning.dataset_builder` and `colab/finetune_lora.ipynb`). Fields: - `instruction`: natural-language question about one article/annex - `input`: always empty (kept for Alpaca-format compatibility) - `output`: the article/annex's full text -- the target completion - `document_id`, `celex_id`, `ref_id`: provenance, so any model output can be traced back to a specific legal reference ## Loading ```python from datasets import load_dataset chunks = load_dataset("/", "chunks", split="train") finetuning = load_dataset("/", "finetuning", split="train") ```