Flexan commited on
Commit
225289f
·
verified ·
1 Parent(s): 588a759

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ TOMAGPT.f16.gguf filter=lfs diff=lfs merge=lfs -text
37
+ TOMAGPT.Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
38
+ TOMAGPT.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
39
+ TOMAGPT.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: DoodDood/TOMAGPT
4
+ datasets:
5
+ - DoodDood/HearsayGRPOTrainingData2
6
+ tags:
7
+ - legal
8
+ - hearsay
9
+ - classification
10
+ - grpo
11
+ - reinforcement-learning
12
+ - legalbench
13
+ - lora
14
+ pipeline_tag: text-generation
15
+ model-index:
16
+ - name: TOMAGPT
17
+ results:
18
+ - task:
19
+ type: text-classification
20
+ name: Hearsay Classification
21
+ dataset:
22
+ name: LegalBench Hearsay
23
+ type: nguha/legalbench
24
+ split: test
25
+ metrics:
26
+ - type: accuracy
27
+ value: 77.7
28
+ name: Decomposed Accuracy
29
+ ---
30
+
31
+ # GGUF Files for TOMAGPT
32
+
33
+ These are the GGUF files for [DoodDood/TOMAGPT](https://huggingface.co/DoodDood/TOMAGPT).
34
+
35
+ > [!NOTE]
36
+ > **Note:** this model has only been quantized to **Q2_K**, **Q4_K_M**, and **Q8_0**. Other quantizations may become available later.
37
+
38
+ ## Downloads
39
+
40
+ | GGUF Link | Quantization | Description |
41
+ | ---- | ----- | ----------- |
42
+ | [Download](https://huggingface.co/Flexan/DoodDood-TOMAGPT-GGUF/resolve/main/TOMAGPT.Q2_K.gguf) | Q2_K | Lowest quality |
43
+ | [Download](https://huggingface.co/Flexan/DoodDood-TOMAGPT-GGUF/resolve/main/TOMAGPT.Q4_K_M.gguf) | Q4_K_M | **Recommended:** Perfect mix of speed and performance |
44
+ | [Download](https://huggingface.co/Flexan/DoodDood-TOMAGPT-GGUF/resolve/main/TOMAGPT.Q8_0.gguf) | Q8_0 | Best quality |
45
+ | [Download](https://huggingface.co/Flexan/DoodDood-TOMAGPT-GGUF/resolve/main/TOMAGPT.f16.gguf) | f16 | Full precision, don't bother; use a quant |
46
+
47
+ ## Note from Flexan
48
+
49
+ I provide GGUFs and quantizations of publicly available models that do not have a GGUF equivalent available yet.
50
+ This process is not yet automated and I download, convert, quantize, and upload them **by hand**, usually for models **I deem interesting and wish to try out**.
51
+
52
+ If there are some quants missing that you'd like me to add, you may request one in the community tab.
53
+ If you want to request a public model to be converted, you can also request that in the community tab.
54
+ If you have questions regarding the model, please refer to the original model repo.
55
+
56
+ # TOMAGPT
57
+
58
+ A **Qwen3-4B-Instruct-2507** model fine-tuned with GRPO (Group Relative Policy Optimization) to classify legal hearsay by decomposing it into three sub-elements under the U.S. Federal Rules of Evidence.
59
+
60
+ ## What It Does
61
+
62
+ TOMAGPT classifies whether a statement is hearsay by analyzing three sub-elements:
63
+
64
+ 1. **Assertion** -- Is the statement an assertion?
65
+ 2. **Out-of-court** -- Was the statement made out of court?
66
+ 3. **TOMA** -- Is the statement offered to prove the truth of the matter asserted?
67
+
68
+ Hearsay = YES only if all three sub-elements are YES.
69
+
70
+ ## Results
71
+
72
+ Evaluated on the [LegalBench hearsay test set](https://huggingface.co/datasets/nguha/legalbench) (94 examples):
73
+
74
+ | Metric | Base Model | TOMAGPT | Delta |
75
+ |--------|-----------|---------|-------|
76
+ | **Overall accuracy** | 71.3% | **77.7%** | +6.4% |
77
+ | **TOMA sub-element** | 78.0% | **95.1%** | +17.1% |
78
+ | Assertion sub-element | 90.2% | 95.1% | +4.9% |
79
+ | Non-verbal hearsay | 33.3% | 83.3% | +50.0% |
80
+ | Standard hearsay | 93.1% | 100.0% | +6.9% |
81
+ | Non-assertive conduct | 89.5% | 100.0% | +10.5% |
82
+
83
+ ## Training Details
84
+
85
+ - **Method**: GRPO (Group Relative Policy Optimization)
86
+ - **Platform**: [Prime Intellect Lab](https://lab.primeintellect.ai)
87
+ - **Environment**: `smolclaims/TOMAGPT` (v0.3.0)
88
+ - **Base model**: Qwen/Qwen3-4B-Instruct-2507
89
+ - **Training data**: [DoodDood/HearsayGRPOTrainingData2](https://huggingface.co/datasets/DoodDood/HearsayGRPOTrainingData2) (3,140 examples)
90
+ - **Steps**: 500
91
+ - **Learning rate**: 1e-5
92
+ - **Batch size**: 128
93
+ - **Rollouts per example**: 16
94
+
95
+ ### LoRA Configuration
96
+
97
+ - **Rank (r)**: 16
98
+ - **Alpha**: 32
99
+ - **Dropout**: 0.0
100
+ - **Target modules**: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
101
+
102
+ ### Reward Functions
103
+
104
+ | Function | Weight | Description |
105
+ |----------|--------|-------------|
106
+ | assertion_reward | 1.5 | +1/-1 on assertion accuracy |
107
+ | out_of_court_reward | 1.0 | +1/-1 on out-of-court accuracy |
108
+ | toma_reward | 2.0 | +1/-1 on TOMA accuracy |
109
+ | consistency_penalty | 1.0 | -0.5 for contradictory outputs |
110
+ | format_compliance | 1.0 | -0.25 per missing field |
111
+ | constraint_penalty | 1.0 | -0.5 for logical violations |
112
+
113
+ ## Usage
114
+
115
+ ```python
116
+ from transformers import AutoModelForCausalLM, AutoTokenizer
117
+ import torch
118
+
119
+ model = AutoModelForCausalLM.from_pretrained(
120
+ "DoodDood/TOMAGPT", torch_dtype=torch.bfloat16, device_map="auto")
121
+ tokenizer = AutoTokenizer.from_pretrained("DoodDood/TOMAGPT")
122
+
123
+ system_prompt = (
124
+ "You are a legal assistant identifying hearsay. Hearsay is defined as "
125
+ "an out-of-court statement introduced to prove the truth of the matter "
126
+ "asserted.\n\n"
127
+ "Respond in EXACTLY this format (semicolon-separated):\n"
128
+ "is_hearsay: YES/NO; an_assertion: YES/NO; made_out_of_court: YES/NO; "
129
+ "is_for_toma: YES/NO"
130
+ )
131
+
132
+ scenario = "At trial, the prosecution presents testimony from a police officer who states that a bystander at the scene told him, 'The defendant ran the red light.'"
133
+
134
+ messages = [
135
+ {"role": "system", "content": system_prompt},
136
+ {"role": "user", "content": scenario}
137
+ ]
138
+
139
+ text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
140
+ inputs = tokenizer([text], return_tensors="pt").to(model.device)
141
+
142
+ with torch.no_grad():
143
+ output = model.generate(**inputs, max_new_tokens=128, do_sample=False)
144
+
145
+ response = tokenizer.decode(output[0][len(inputs.input_ids[0]):], skip_special_tokens=True)
146
+ print(response)
147
+ # Expected: is_hearsay: YES; an_assertion: YES; made_out_of_court: YES; is_for_toma: YES
148
+ ```
149
+
150
+ ## Links
151
+
152
+ - **Training data**: [DoodDood/HearsayGRPOTrainingData2](https://huggingface.co/datasets/DoodDood/HearsayGRPOTrainingData2)
153
+ - **GRPO environment**: `smolclaims/TOMAGPT` on [Prime Intellect](https://lab.primeintellect.ai)
154
+ - **Eval benchmark**: [nguha/legalbench](https://huggingface.co/datasets/nguha/legalbench) (hearsay subset)
TOMAGPT.Q2_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6417cc56f5b021111a3d81f4e8598b855995bd2ed97b00a235b29743da9a3fe5
3
+ size 1669498432
TOMAGPT.Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d2810fa4b7ad5b6b04b4e2074aeff6e843eff6952186a9afd23a7ce060dd661
3
+ size 2497279552
TOMAGPT.Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3df3917fb6e978dd28e4c20c1dfb3413fd73be97310973092ded11de09707358
3
+ size 4280404032
TOMAGPT.f16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17b86450724f0bf0232f90e9470c4a9cdae4466e835a796b1e13b6b6fc3fbdd6
3
+ size 8051284032