# akash-r-m/cs781-legal-llm-capstone architecture

> Architecture diagram of the GitHub repository akash-r-m/cs781-legal-llm-capstone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akash-r-m/cs781-legal-llm-capstone
- Repository: https://github.com/akash-r-m/cs781-legal-llm-capstone

## Overview

This repository is a notebook-driven legal NLP research pipeline, not a deployed service. Its main workflow trains a byte-level tokenizer and legal-language-model backbone, then adapts that backbone for six IL-TUR tasks and produces Codabench submissions. The README documents the phase relationships and major task methods; Phase 4 also has a sampled script implementation. Other task internals are represented at their existing notebook-directory paths because their source was not sampled.

Main entry points: [`phase1_pretraining/notebooks/phase1_decoder.ipynb`](https://github.com/akash-r-m/cs781-legal-llm-capstone/blob/main/phase1_pretraining/notebooks/phase1_decoder.ipynb) (Legal LM), [`phase2_ner/notebooks`](https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase2_ner/notebooks) (NER tagging), [`phase3_rhetorical_roles/notebooks`](https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase3_rhetorical_roles/notebooks) (Rhetorical roles), [`phase4_judgment_prediction/phase4_cjpe_arch1_zoo.py`](https://github.com/akash-r-m/cs781-legal-llm-capstone/blob/main/phase4_judgment_prediction/phase4_cjpe_arch1_zoo.py) (Judgment prediction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundation["Model foundation"]
  node_tokenizer["Byte-level BPE"]
  node_backbone["Legal LM"]
end

subgraph group_classification["Legal classification"]
  node_ner["NER tagging"]
  node_roles["Rhetorical roles"]
  node_judgment["Judgment prediction"]
  node_statutes["Statute identification"]
end

subgraph group_generation["Legal text tasks"]
  node_summary["Legal summarization"]
end

subgraph group_retrieval["Case retrieval"]
  node_retrieval["Prior-case retrieval"]
end

node_dataset[("Course dataset")]
node_benchmark(("Codabench"))

node_dataset -->|"trains from"| node_tokenizer
node_tokenizer -->|"tokenizes training text"| node_backbone
node_backbone -->|"adapts for NER"| node_ner
node_backbone -->|"adapts for roles"| node_roles
node_backbone -->|"adapts for prediction"| node_judgment
node_backbone -->|"adapts for statutes"| node_statutes
node_backbone -->|"adapts for summarization"| node_summary
node_backbone -->|"provides features"| node_retrieval
node_ner -->|"submits results"| node_benchmark
node_roles -->|"submits results"| node_benchmark
node_judgment -->|"submits results"| node_benchmark
node_statutes -->|"submits results"| node_benchmark
node_summary -->|"submits results"| node_benchmark
node_retrieval -->|"submits results"| node_benchmark

click node_tokenizer "https://github.com/akash-r-m/cs781-legal-llm-capstone/blob/main/phase1_pretraining/notebooks/phase1_decoder.ipynb"
click node_backbone "https://github.com/akash-r-m/cs781-legal-llm-capstone/blob/main/phase1_pretraining/notebooks/phase1_decoder.ipynb"
click node_ner "https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase2_ner/notebooks"
click node_roles "https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase3_rhetorical_roles/notebooks"
click node_judgment "https://github.com/akash-r-m/cs781-legal-llm-capstone/blob/main/phase4_judgment_prediction/phase4_cjpe_arch1_zoo.py"
click node_statutes "https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase5_statute_id/notebooks"
click node_summary "https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase6_summarization/notebooks"
click node_retrieval "https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase7_retrieval/notebooks"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_tokenizer,node_backbone toneBlue
class node_ner,node_roles,node_judgment,node_statutes,node_dataset toneAmber
class node_summary toneMint
class node_retrieval toneRose
class node_benchmark toneIndigo
```

## Components

### Model foundation

- [Byte-level BPE](https://github.com/akash-r-m/cs781-legal-llm-capstone/blob/main/phase1_pretraining/notebooks/phase1_decoder.ipynb): `phase1_pretraining/notebooks/phase1_decoder.ipynb`
- [Legal LM](https://github.com/akash-r-m/cs781-legal-llm-capstone/blob/main/phase1_pretraining/notebooks/phase1_decoder.ipynb): `phase1_pretraining/notebooks/phase1_decoder.ipynb`

### Legal classification

- [NER tagging](https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase2_ner/notebooks): `phase2_ner/notebooks`
- [Rhetorical roles](https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase3_rhetorical_roles/notebooks): `phase3_rhetorical_roles/notebooks`
- [Judgment prediction](https://github.com/akash-r-m/cs781-legal-llm-capstone/blob/main/phase4_judgment_prediction/phase4_cjpe_arch1_zoo.py): `phase4_judgment_prediction/phase4_cjpe_arch1_zoo.py`
- [Statute identification](https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase5_statute_id/notebooks): `phase5_statute_id/notebooks`

### Legal text tasks

- [Legal summarization](https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase6_summarization/notebooks): `phase6_summarization/notebooks`

### Case retrieval

- [Prior-case retrieval](https://github.com/akash-r-m/cs781-legal-llm-capstone/tree/main/phase7_retrieval/notebooks): `phase7_retrieval/notebooks`

### Other components

- **Course dataset**
- **Codabench**

## Connections

- Course dataset → Byte-level BPE: trains from (evidence: `README.md`)
- Byte-level BPE → Legal LM: tokenizes training text (evidence: `README.md`)
- Legal LM → NER tagging: adapts for NER (evidence: `README.md`)
- Legal LM → Rhetorical roles: adapts for roles (evidence: `README.md`)
- Legal LM → Judgment prediction: adapts for prediction (evidence: `README.md`)
- Legal LM → Statute identification: adapts for statutes (evidence: `README.md`)
- Legal LM → Legal summarization: adapts for summarization (evidence: `README.md`)
- Legal LM → Prior-case retrieval: provides features (evidence: `README.md`)
- NER tagging → Codabench: submits results (evidence: `README.md`)
- Rhetorical roles → Codabench: submits results (evidence: `README.md`)
- Judgment prediction → Codabench: submits results (evidence: `README.md`)
- Statute identification → Codabench: submits results (evidence: `README.md`)
- Legal summarization → Codabench: submits results (evidence: `README.md`)
- Prior-case retrieval → Codabench: submits results (evidence: `README.md`)
