File size: 2,048 Bytes
6e554c9
 
 
 
 
 
6ac5b8a
6e554c9
 
 
2bb6983
6e554c9
4c48a5b
 
 
6e554c9
6ac5b8a
9901a5a
6ac5b8a
 
6e554c9
6ac5b8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
library_name: pytorch
tags:
  - legal-nlp
  - statutory-parsing
  - tax-law
  - onnx
license: apache-2.0
---

# MudraForge Tax T1 Encoder — 3.41M Backbone / 4.43M Total (`law2code-tax-t1-encoder`)

Pretrained statutory language encoder for Indian and US tax provisions, used as the Stage 0 representation backbone in **law2code** ([Live Space](https://huggingface.co/spaces/yamero999/law2code)).

- **Parameter Breakdown (Verified):** `3,414,064` (**3.41M**) core encoder backbone parameters (Char-CNN + Subword Hash + 36D Discourse Geometry + Transformer) + `1,019,392` (**1.02M**) MLM word-table parameters = **`4,433,456` (`4.43M`) total** checkpoint parameters.

## Training Data
- **Dataset:** Unlabeled Statutory Tax Corpus (`corpus_2_5m.jsonl`, tax subset — full unified superset hosted at [`MudraForge/law2code-corporate-f1-corpus`](https://huggingface.co/datasets/MudraForge/law2code-corporate-f1-corpus))
- **Size:** 15,904 statutory documents (64.7 MB)
- **Objective:** Salient Masked Language Modeling (8,000 steps) prioritizing statutory numbers, percentages, cross-references, and deontic operators.

## Internal Training Scores
| Metric | Value |
| --- | --- |
| Training Steps | 8,000 |
| Final MLM Loss | 0.7644 |
| Perplexity (PPL) | 2.15 |
| Top-1 Token Accuracy | 80.27% |
| Top-5 Token Accuracy | 94.03% |

## Expected Inputs & Outputs
- **Inputs:**
  - `w_ids` `int64[batch, seq_len]`: Vocabulary token IDs
  - `c_mat` `int64[batch, seq_len, 30]`: Bounded UTF-8 character byte IDs per token
  - `sw_ids` `int64[batch, seq_len, 4]`: 4-gram subword hash IDs (8,192 buckets)
  - `g_feat` `float32[batch, seq_len, 36]`: 36-dimensional discourse & punctuation geometry
  - `c_idx` `int64[batch, seq_len]`: Clause index per token
- **Outputs:**
  - `hidden_states` `float32[batch, seq_len, 256]`: Contextualized 256-dim token representations

## Available Formats
- **PyTorch:** `pytorch/stage0_backbone_mlm_salient_16k.pt` (18.1 MB)
- **ONNX (opset 17):** `onnx/tax_t1_encoder.onnx` (13.73 MB, ORT CPU max diff `2.62e-06`)