← All drillsLegal-Clause GPT — Fine-Tune GPT-2 on Contracts
What you'll be able to do- ✓Fine-tune GPT-2 on real legal contract clauses so it tags a clause with its type
- ✓Load and explore the LEDGAR legal-clause dataset from the Hugging Face Hub
- ✓Reframe a classification task as causal generation using special <Label> tokens
- ✓Extend a pretrained tokenizer with new tokens and resize the model's embeddings to match
- ✓Train with the Hugging Face Trainer, then save and reload your fine-tuned model
- ✓Generate the clause type for an unseen clause and measure how often it is right
Build the clause-tagging engine behind contract-review tools — hand it "This agreement shall be governed by the laws of Delaware" and it answers <Governing Laws>, the way Harvey and Casetext read contracts at scale.
⌁ Domain fine-tuning is how legal-AI products are built — Harvey, Casetext (CoCounsel), LexisNexis, and Thomson Reuters adapt general LLMs to contracts, case law, and clauses.
Start this internshipCreate an account to unlock the 9 sections, the workbench, and AskThili.
BeginSections
1. Legal-Clause GPT — Fine-Tuning GPT-2 on Contracts
🔒 locked2. Lesson 1 - The task: tag a clause
🔒 locked3. Lesson 2 - Meet LEDGAR
🔒 locked4. Lesson 3 - Classification as generation
🔒 locked5. Lesson 4 - Teach the tokenizer new words
🔒 locked6. Lesson 5 - Fine-tune with the Trainer
🔒 locked7. Lesson 6 - Ask it to tag a clause
🔒 locked8. Lesson 7 - How good is it?
🔒 locked9. Lesson 8 - Ship your clause tagger
🔒 lockedDig deeper
📄LEDGAR: A Large-Scale Multi-label Corpus for Text Classification of Legal Provisions (Tuggener et al., 2020, LREC)
paper📄LexGLUE: A Benchmark Dataset for Legal Language Understanding (Chalkidis et al., 2022, ACL)
paper🔗Hugging Face — lex_glue / LEDGAR dataset
docs🔗Hugging Face — fine-tuning with the Trainer API
docsPart of these learning paths
I'm a developer and I want to fine-tune small LLMs for my own use case
View path →