Update README.md
Browse files
README.md
CHANGED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# π LegalMVP Dataset Collection
|
2 |
+
|
3 |
+
This repository contains curated U.S. legal datasets collected for building **retrieval-augmented generation (RAG)** and other machine learning models in the legal domain. The datasets include U.S. Codes (statutes), federal regulations, and other legal texts in multiple formats.
|
4 |
+
|
5 |
+
---
|
6 |
+
|
7 |
+
## π Repository Structure
|
8 |
+
|
9 |
+
legalMVP/
|
10 |
+
β
|
11 |
+
βββ regulations/ # Raw legal texts
|
12 |
+
β βββ USCODE-2022-title15.txt
|
13 |
+
β βββ USCODE-2023-title15.txt
|
14 |
+
β βββ USCODE-2023-title26.txt
|
15 |
+
β βββ USCODE-2023-title26.pdf
|
16 |
+
β βββ ... (other titles/years)
|
17 |
+
β
|
18 |
+
βββ scripts/ # Data processing & download scripts
|
19 |
+
β βββ fetch_regulations.py # Example: fetches 200 statutes in txt/pdf
|
20 |
+
β
|
21 |
+
βββ README.md # Project documentation
|
22 |
+
|
23 |
+
|
24 |
+
---
|
25 |
+
|
26 |
+
## π Datasets Obtained
|
27 |
+
|
28 |
+
We currently have **U.S. Code** (statutory law) datasets for multiple years, stored as both `.txt` and `.pdf`:
|
29 |
+
|
30 |
+
- **Title 15**: Commerce and Trade
|
31 |
+
- `USCODE-2022-title15.txt`
|
32 |
+
- `USCODE-2023-title15.txt`
|
33 |
+
|
34 |
+
- **Title 26**: Internal Revenue Code (Tax Law)
|
35 |
+
- `USCODE-2023-title26.txt`
|
36 |
+
- `USCODE-2023-title26.pdf`
|
37 |
+
|
38 |
+
More titles can be added as needed.
|
39 |
+
|
40 |
+
---
|
41 |
+
|
42 |
+
## π οΈ Data Formats
|
43 |
+
|
44 |
+
- **TXT** β machine-friendly plain text (ideal for preprocessing, tokenization, embeddings, and training).
|
45 |
+
- **PDF** β reference copies (useful for citation, legal formatting, and validation).
|
46 |
+
|
47 |
+
---
|
48 |
+
|
49 |
+
## π― Intended Use
|
50 |
+
|
51 |
+
These datasets are intended for **legal NLP research**, specifically:
|
52 |
+
|
53 |
+
- **Retrieval-Augmented Generation (RAG)**:
|
54 |
+
Building retrieval pipelines to fetch relevant sections of statutes and regulations before passing them into LLMs.
|
55 |
+
|
56 |
+
- **Fine-Tuning / Domain Adaptation**:
|
57 |
+
Adapting open-source LLMs to understand statutory and regulatory language.
|
58 |
+
|
59 |
+
- **Information Extraction**:
|
60 |
+
Parsing structured knowledge from unstructured statutes.
|
61 |
+
|
62 |
+
---
|
63 |
+
|
64 |
+
## β‘ Training Expectations
|
65 |
+
|
66 |
+
- **Input Size**:
|
67 |
+
Legal statutes are long and verbose β chunking (e.g., 512β2048 tokens) is necessary before embeddings.
|
68 |
+
|
69 |
+
- **Embedding Models**:
|
70 |
+
Use sentence-transformers or OpenAI embedding models to index statutes for retrieval.
|
71 |
+
|
72 |
+
- **RAG Pipelines**:
|
73 |
+
Expect performance gains in **precision** of retrieval (correctly pulling the relevant statute sections).
|
74 |
+
|
75 |
+
- **Evaluation Metrics**:
|
76 |
+
- Retrieval: Recall@k, MRR (Mean Reciprocal Rank).
|
77 |
+
- QA: Accuracy, BLEU/ROUGE for generated answers.
|
78 |
+
|
79 |
+
---
|
80 |
+
|
81 |
+
## π§ Next Steps
|
82 |
+
|
83 |
+
1. **Expand Coverage**
|
84 |
+
- Add more U.S. Code titles (e.g., Titles 7, 18, 42).
|
85 |
+
- Include **Code of Federal Regulations (CFR)** for regulatory data.
|
86 |
+
|
87 |
+
2. **Preprocessing**
|
88 |
+
- Normalize whitespace, remove headers/footers.
|
89 |
+
- Add metadata (Title, Section, Year).
|
90 |
+
|
91 |
+
3. **Embedding + Indexing**
|
92 |
+
- Build vector stores (e.g., FAISS, Weaviate, Chroma).
|
93 |
+
|
94 |
+
4. **Model Training**
|
95 |
+
- Train/evaluate RAG pipeline with legal queries.
|
96 |
+
- Fine-tune LLMs on statute-specific Q&A pairs.
|
97 |
+
|
98 |
+
---
|
99 |
+
|
100 |
+
## π License
|
101 |
+
|
102 |
+
- The U.S. Code and federal regulations are in the **public domain**.
|
103 |
+
- Scripts and preprocessing logic are released under the MIT License.
|