docs: update model card with verified datasets, I/O specs, and per-stage scores
Browse files
README.md
CHANGED
|
@@ -9,9 +9,9 @@ tags:
|
|
| 9 |
license: apache-2.0
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# MudraForge `law2code` Downstream Parser Stages (Stage 1, 1.5, 2
|
| 13 |
|
| 14 |
-
Supervised multi-stage statutory parsing stack for **law2code** ([Live Space](https://huggingface.co/spaces/yamero999/law2code)). These downstream parser models are trained on **annotated statutory ground truth**, separate from the unlabeled MLM encoder pretraining corpora.
|
| 15 |
|
| 16 |
## Training & Evaluation Data
|
| 17 |
- **Annotated Training Corpus:** 250 annotated statutory provisions (`ground_truth_250.json`, 2.33 MB) evaluated under 5-fold cross-validation and full-corpus training.
|
|
@@ -19,7 +19,7 @@ Supervised multi-stage statutory parsing stack for **law2code** ([Live Space](ht
|
|
| 19 |
|
| 20 |
## Per-Stage Architecture, Inputs/Outputs & Internal Scores
|
| 21 |
|
| 22 |
-
### 1. Stage 1 — Atomic Non-Operand Parser (`stage1_non_operands`)
|
| 23 |
- **Task:** Extracts 9 statutory constant & operator classes (`MONEY`, `RATE`, `DATE`, `DURATION`, `COUNT`, `ACTOR_SCOPE`, `DEFINED_TERM`, `OP`, `XREF`) across 37 BILOU tags.
|
| 24 |
- **Inputs:** Tokenized word/char/subword IDs + 36D discourse geometry + clause indices.
|
| 25 |
- **Outputs:** `hidden_states` `[1, seq_len, 256]` and `flat_log_probs` `[1, seq_len, 37]`.
|
|
@@ -28,7 +28,7 @@ Supervised multi-stage statutory parsing stack for **law2code** ([Live Space](ht
|
|
| 28 |
- Full-Corpus Exact F1: **99.17%** (Relaxed F1: 99.36%, Precision: 99.26%, Recall: 99.08%)
|
| 29 |
- **Files:** `pytorch/stage1_non_operands_tree_cl_v6_full.pt` (19.4 MB) | `onnx/stage1_non_operands.onnx` (19.10 MB, ORT max diff `3.05e-05`)
|
| 30 |
|
| 31 |
-
### 2. Stage 1.5 — Catala Operand Specialist & Entropy Gate (`stage1_5_operands`)
|
| 32 |
- **Task:** Extracts algebraic operands & conditions across 4 Catala root branches (`NUMERIC_METRIC`, `CATEGORY_FILTER`, `DOC_POINTER`, `COMPLIANCE_ATTESTATION`) and routes OOD phrases (entropy `H >= 0.50`) to human/CA review via prototype memory (`stage1_5_leaf_prototypes_v2.json`).
|
| 33 |
- **Inputs:** Token features + 10-channel coarse Stage 1 conditioning (`s1_coarse`).
|
| 34 |
- **Outputs:** `hidden_states` `[1, seq_len, 256]` and `flat_log_probs` `[1, seq_len, 17]`.
|
|
@@ -37,7 +37,7 @@ Supervised multi-stage statutory parsing stack for **law2code** ([Live Space](ht
|
|
| 37 |
- Full-Corpus Exact F1: **98.52%** (Precision: 97.49%, Recall: 99.57%, Catala Leaf Exact: 97.6%)
|
| 38 |
- **Files:** `pytorch/stage1_5_operands_catala_tree_v2_full.pt` (26.0 MB) | `onnx/stage1_5_operands.onnx` (22.91 MB, ORT max diff `1.34e-05`)
|
| 39 |
|
| 40 |
-
### 3. Stage 2 — Clause Scope Specialist (`stage2_clauses`)
|
| 41 |
- **Task:** Factors statutes into executable clause scopes (`COND`, `EXCEPTION`, `RULE_EFFECT`, `INLINE_DEF`) using the 41-tag Stage 1 + Stage 1.5 bridge.
|
| 42 |
- **Inputs:** Token features + 41-channel Stage 1/1.5 tag logits (`s1_logits_41`).
|
| 43 |
- **Outputs:** Encoder hidden states `h2`, clause representations `ca2`, and boundary anchor logits `s_logits`, `e_logits`.
|
|
@@ -45,11 +45,14 @@ Supervised multi-stage statutory parsing stack for **law2code** ([Live Space](ht
|
|
| 45 |
- Full-Corpus IoU@50 F1: **97.05%** (Exact F1: 87.73%, Precision: 95.0%, Recall: 99.2%)
|
| 46 |
- **Files:** `pytorch/stage2_clauses_v2_full.pt` (18.9 MB) | `onnx/stage2_clauses.onnx` (17.64 MB, ORT max diff `7.63e-06`)
|
| 47 |
|
| 48 |
-
### 4. Stage 2B — Clause Boundary Pointer Refiner (`stage2_refiner`)
|
| 49 |
- **Task:** Snaps Stage 2 clause start/end boundaries within a +/-6 token window.
|
| 50 |
- **Internal Scores:**
|
| 51 |
- Refined Exact F1: **94.93%** (+7.20 Exact F1 over Stage 2 base 87.73%, Overlap F1: 97.05%, 0.0% recall loss)
|
| 52 |
- **File:** `pytorch/stage2_refiner_noppo_v2_full.pt` (1.89 MB)
|
| 53 |
|
| 54 |
-
## Deterministic Post-Processing
|
| 55 |
Stage 3 (Reflexion Critic & Catala/AST Emitter) runs deterministically over the outputs above with `isAuthorizedToDisburse: false`. Both PyTorch and ONNX outputs support `teach-leaf` prototype memory updates without retraining weights.
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
license: apache-2.0
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# MudraForge `law2code` Downstream Parser Stages — 15.9M Total (Stage 1: 4.6M, Stage 1.5: 6.3M, Stage 2: 4.6M, Stage 2B: 0.47M)
|
| 13 |
|
| 14 |
+
Supervised multi-stage statutory parsing stack (**15.93M parameters total**, `15,933,743` params across all 4 neural stages) for **law2code** ([Live Space](https://huggingface.co/spaces/yamero999/law2code)). These downstream parser models are trained on **annotated statutory ground truth**, separate from the unlabeled MLM encoder pretraining corpora.
|
| 15 |
|
| 16 |
## Training & Evaluation Data
|
| 17 |
- **Annotated Training Corpus:** 250 annotated statutory provisions (`ground_truth_250.json`, 2.33 MB) evaluated under 5-fold cross-validation and full-corpus training.
|
|
|
|
| 19 |
|
| 20 |
## Per-Stage Architecture, Inputs/Outputs & Internal Scores
|
| 21 |
|
| 22 |
+
### 1. Stage 1 — Atomic Non-Operand Parser (`stage1_non_operands` · 4.62M params)
|
| 23 |
- **Task:** Extracts 9 statutory constant & operator classes (`MONEY`, `RATE`, `DATE`, `DURATION`, `COUNT`, `ACTOR_SCOPE`, `DEFINED_TERM`, `OP`, `XREF`) across 37 BILOU tags.
|
| 24 |
- **Inputs:** Tokenized word/char/subword IDs + 36D discourse geometry + clause indices.
|
| 25 |
- **Outputs:** `hidden_states` `[1, seq_len, 256]` and `flat_log_probs` `[1, seq_len, 37]`.
|
|
|
|
| 28 |
- Full-Corpus Exact F1: **99.17%** (Relaxed F1: 99.36%, Precision: 99.26%, Recall: 99.08%)
|
| 29 |
- **Files:** `pytorch/stage1_non_operands_tree_cl_v6_full.pt` (19.4 MB) | `onnx/stage1_non_operands.onnx` (19.10 MB, ORT max diff `3.05e-05`)
|
| 30 |
|
| 31 |
+
### 2. Stage 1.5 — Catala Operand Specialist & Entropy Gate (`stage1_5_operands` · 6.26M params)
|
| 32 |
- **Task:** Extracts algebraic operands & conditions across 4 Catala root branches (`NUMERIC_METRIC`, `CATEGORY_FILTER`, `DOC_POINTER`, `COMPLIANCE_ATTESTATION`) and routes OOD phrases (entropy `H >= 0.50`) to human/CA review via prototype memory (`stage1_5_leaf_prototypes_v2.json`).
|
| 33 |
- **Inputs:** Token features + 10-channel coarse Stage 1 conditioning (`s1_coarse`).
|
| 34 |
- **Outputs:** `hidden_states` `[1, seq_len, 256]` and `flat_log_probs` `[1, seq_len, 17]`.
|
|
|
|
| 37 |
- Full-Corpus Exact F1: **98.52%** (Precision: 97.49%, Recall: 99.57%, Catala Leaf Exact: 97.6%)
|
| 38 |
- **Files:** `pytorch/stage1_5_operands_catala_tree_v2_full.pt` (26.0 MB) | `onnx/stage1_5_operands.onnx` (22.91 MB, ORT max diff `1.34e-05`)
|
| 39 |
|
| 40 |
+
### 3. Stage 2 — Clause Scope Specialist (`stage2_clauses` · 4.58M params)
|
| 41 |
- **Task:** Factors statutes into executable clause scopes (`COND`, `EXCEPTION`, `RULE_EFFECT`, `INLINE_DEF`) using the 41-tag Stage 1 + Stage 1.5 bridge.
|
| 42 |
- **Inputs:** Token features + 41-channel Stage 1/1.5 tag logits (`s1_logits_41`).
|
| 43 |
- **Outputs:** Encoder hidden states `h2`, clause representations `ca2`, and boundary anchor logits `s_logits`, `e_logits`.
|
|
|
|
| 45 |
- Full-Corpus IoU@50 F1: **97.05%** (Exact F1: 87.73%, Precision: 95.0%, Recall: 99.2%)
|
| 46 |
- **Files:** `pytorch/stage2_clauses_v2_full.pt` (18.9 MB) | `onnx/stage2_clauses.onnx` (17.64 MB, ORT max diff `7.63e-06`)
|
| 47 |
|
| 48 |
+
### 4. Stage 2B — Clause Boundary Pointer Refiner (`stage2_refiner` · 0.47M params)
|
| 49 |
- **Task:** Snaps Stage 2 clause start/end boundaries within a +/-6 token window.
|
| 50 |
- **Internal Scores:**
|
| 51 |
- Refined Exact F1: **94.93%** (+7.20 Exact F1 over Stage 2 base 87.73%, Overlap F1: 97.05%, 0.0% recall loss)
|
| 52 |
- **File:** `pytorch/stage2_refiner_noppo_v2_full.pt` (1.89 MB)
|
| 53 |
|
| 54 |
+
## Deterministic Post-Processing & Continual Learning Versioning
|
| 55 |
Stage 3 (Reflexion Critic & Catala/AST Emitter) runs deterministically over the outputs above with `isAuthorizedToDisburse: false`. Both PyTorch and ONNX outputs support `teach-leaf` prototype memory updates without retraining weights.
|
| 56 |
+
|
| 57 |
+
- **Base neural checkpoints** are versioned by parameter count (`3.3M` encoders, `15.9M` parser stack).
|
| 58 |
+
- **Continual Learning (CL) memory snapshots** (`M1` / `M1.5` / `M2` episodic deltas and `teach-leaf` prototype banks) are versioned by **Year-Month (`YYYY-MM`, e.g. `2026-11`)** to track monthly statutory & Finance Act updates cleanly without re-uploading base weights.
|