Downloads · 30 days
8
20% of all-time downloads
lohithaaa/LegalMind-Gemma4-31B-BillAnalyst
LegalMind-Gemma4-31B-BillAnalyst is a text generation model from lohithaaa. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A LoRA-adapted Gemma 4 31B model fine-tuned for multi-step US Congressional bill analysis — built end-to-end using the Adaption Labs AutoScientist platform for the 2026 Adaption AutoScientist Challenge (Legal Category).
Downloads · 30 days
8
20% of all-time downloads
All-time downloads
41
Public
Repo size
76 MB
Likes
0
Public
Click a slice to open those files.
.safetensors43.9 MB · 58%
From the Hugging Face model README
<p align="center"> <img src="https://img.shields.io/badge/Base%20Model-Gemma%204%2031B--it-blue" /> <img src="https://img.shields.io/badge/Training-LoRA%20SFT-green" /> <img src="https://img.shields.io/badge/Win%20Rate-82%25-brightgreen" /> <img src="https://img.shields.io/badge/Category-Legal-orange" /> <img src="https://img.shields.io/badge/Platform-Adaption%20Labs-purple" /> <img src="https://img.shields.io/badge/Framework-PEFT%200.15.1-red" /> </p>A LoRA-adapted Gemma 4 31B model fine-tuned for multi-step US Congressional bill analysis — built end-to-end using the Adaption Labs AutoScientist platform for the 2026 Adaption AutoScientist Challenge (Legal Category).
LegalMind-Gemma4-31B-BillAnalyst is a parameter-efficient LoRA adapter that transforms Google's Gemma 4 31B instruction-tuned model into a specialized legal reasoning engine for US Congressional legislation. Unlike simple bill summarization models, it performs 8 distinct multi-step legal analysis tasks — from statutory interpretation with step-by-step reasoning traces to structured compliance checklist generation and explicit abstention when bill text lacks requested information.
The model was trained entirely through the Adaption Labs AutoScientist pipeline, which automated hyperparameter optimization, data enhancement, and the training loop. The result is an 82% training win rate against the unmodified baseline (up from just 18%), representing a 355% relative improvement.
| Metric | Base Model | Adapted Model | Delta |
|---|---|---|---|
| Training Win Rate | 18% | 82% | +64 points |
| Relative Improvement | — | — | 355% |
| Final Training Loss | — | 0.761 | — |
| Final Eval Loss | — | 0.751 | — |
| Step | Training Loss | Eval Loss | Learning Rate |
|---|---|---|---|
| 1 | 1.5427 | — | 0.0 (warmup) |
| 7 | 1.4932 | — | 1.0e-4 (peak) |
| 14 | 1.0220 | 1.0489 | 9.6e-5 |
| 25 | 0.9026 | 0.8542 | 7.6e-5 |
| 36 | 0.7837 | 0.7780 | 4.7e-5 |
| 47 | 0.7528 | 0.7589 | 2.1e-5 |
| 58 | 0.7615 | 0.7507 | 1.0e-5 |
Key observation: Train loss and eval loss converge closely throughout training (final gap: 0.011), confirming no overfitting. Eval loss monotonically decreased from 1.049 → 0.751 across all 5 checkpoints.
This model is designed for automated legal analysis of US Congressional legislation. It can be used directly for:
<reasoning_start> / </reasoning_start>) to audit the analytical process and identify potential errors.from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"google/gemma-4-31B-it",
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("google/gemma-4-31B-it")
# Load LoRA adapter
model = PeftModel.from_pretrained(
base_model,
"lohithaaa/adaption-us-bill-analysis-tasks"
)
# Example: Statutory Interpretation
prompt = """Analyze the following US Congressional bill and identify its primary
legislative mechanism. Explain step-by-step: (1) what existing law or framework
it modifies or creates, (2) the specific legal instruments used (amendments, new
sections, appropriations, mandates), and (3) the enforcement or implementation
pathway.
SECTION 1. SHORT TITLE.
This Act may be cited as the 'Fair Lending for All Act'.
SEC. 2. PROHIBITION ON DISCRIMINATORY LENDING.
(a) IN GENERAL.—No covered lender shall deny or vary the terms of a
residential mortgage loan based on the race, color, religion, national
origin, sex, or age of the applicant.
(b) ENFORCEMENT.—The Bureau of Consumer Financial Protection shall
enforce this section under the authorities granted by the Consumer
Financial Protection Act of 2010.
(c) PENALTIES.—Any lender found in violation of subsection (a) shall
be subject to a civil penalty of not more than $100,000 per violation."""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Dataset: lohithaaa/adaption-us-bill-analysis-tasks
Source: 1,000 US Congressional bills from the BillSum dataset (CC0 Public Domain), programmatically transformed into 6,648 multi-task legal reasoning examples.
Task Distribution:
| Task Type | Count | % | What It Teaches |
|---|---|---|---|
| Statutory Interpretation | 1,000 | 15.0% | Legislative mechanism analysis with reasoning traces |
| Impact Analysis | 1,000 | 15.0% | Multi-factor stakeholder and fiscal assessment |
| Compliance Checklist | 1,000 | 15.0% | Structured obligation extraction into tables |
| Risk Assessment | 1,000 | 15.0% | Constitutional & litigation risk scoring |
| Key Provisions | 1,000 | 15.0% | Table-format provision extraction with type classification |
| Abstention/Safety | 723 | 10.9% | Explicit refusal when information is missing |
| Amendment Analysis | 675 | 10.2% | Cross-referencing existing laws being modified |
| Comparative Analysis | 250 | 3.8% | Side-by-side bill comparison |
Key dataset design decisions:
<reasoning_start> / </reasoning_start> step-by-step reasoning tracesThis model was trained entirely through the Adaption Labs AutoScientist platform, which automated data enhancement, hyperparameter search, and the training loop. Below are the exact pipeline configurations used:
Enhancement Recipe Configuration:
| Recipe Toggle | Setting | Strategic Rationale |
|---|---|---|
| Prompt Rephrase | ❌ OFF | Deliberately disabled to preserve deterministic numeric data. Our dataset contains exact dollar amounts ($100,000), section references (SEC. 2), and word-frequency counts ('shall' appears 14 times). Automatic rephrasing would corrupt these strict numeric constants into vague approximations, degrading training signal quality. |
| Prompt Deduplication | ✅ ON | Second-layer deduplication on top of our pre-processing SHA-256 hash dedup, ensuring maximum dataset cleanliness and preventing the model from memorizing repeated output patterns. |
| Prompt Metadata Injection | ✅ ON | Enriches each prompt with additional contextual metadata, improving the model's understanding of legal domain nuances and bill structure. |
| House Special | ✅ ON | Adaption's most powerful proprietary combination of optimization recipes, applied for maximum quality uplift across all training examples. |
| Reasoning Traces | ✅ ON | Critical toggle for our dataset — every output contains <reasoning_start> step-by-step deductive logic. This ensures the training loop specifically optimizes for interpretable, traceable reasoning pathways. |
| Hallucination Mitigation | ✅ ON | Reinforces the ~11% abstention tasks where the model must refuse to fabricate information. Works in concert with our "Not specified in bill text" training examples to minimize hallucination of legal facts. |
Blueprint (System Preamble):
A custom system preamble was configured in the Blueprint stage to align the enhancement pipeline with the dataset's behavioral objectives:
You are an expert legal analyst specializing in US Congressional legislation.
Rules:
1. Always use <reasoning_start> and </reasoning_start> tags for step-by-step analysis
2. Present outputs in structured formats (tables, numbered steps, checklists)
3. Reproduce numeric data exactly as stated — never approximate
4. If information is missing from bill text, state "Not specified in bill text"
5. Systematically evaluate: legislative mechanism, stakeholders, fiscal impact,
implementation challenges, and constitutional considerations
6. Never fabricate case citations, statutory references, or legal advice
This ensures the platform's enhancement algorithms optimize in the same direction as the training data — reinforcing reasoning traces, structured output, deterministic numeric accuracy, and explicit abstention behavior.
All hyperparameters were automatically selected by the Adaption Labs AutoScientist — no manual tuning was performed:
q_proj, v_projadapter_model.safetensors)Evaluation was performed using the Adaption Labs platform's internal held-out evaluation methodology. The platform generates test prompts from the legal domain and uses an LLM-as-a-judge framework to compare the adapted model's responses head-to-head against the unmodified baseline.
Additionally, 5 validation checkpoints were evaluated during training using a held-out split from the training data (15 samples, 2 eval steps per checkpoint).
| Metric | Value |
|---|---|
| Training Win Rate (Adapted) | 82% |
| Training Win Rate (Base) | 18% |
| Win Rate Delta | +64 points (355% relative) |
| Final Training Loss | 0.761 |
| Final Eval Loss | 0.751 |
| Train/Eval Loss Gap | 0.011 (no overfitting) |
Eval loss progression across 5 checkpoints:
| Checkpoint | Step | Epoch | Eval Loss |
|---|---|---|---|
| 1 | 14 | 0.24 | 1.0489 |
| 2 | 25 | 0.43 | 0.8542 |
| 3 | 36 | 0.62 | 0.7780 |
| 4 | 47 | 0.81 | 0.7589 |
| 5 | 58 | 1.00 | 0.7507 |
Eval loss decreased monotonically across all checkpoints, confirming stable convergence without overfitting.
The model achieves an 82% training win rate against the unmodified Gemma 4 31B baseline, a massive improvement from the 18% base performance. The 64-point gap demonstrates that the multi-task legal reasoning dataset successfully exposed and addressed fundamental weaknesses in the base model's ability to perform structured legal analysis, step-by-step reasoning, and principled abstention.
This result validates the data-centric approach: rather than scaling model parameters, switching to complex reasoning tasks that exploit the baseline deficit yielded dramatically superior results compared to simple summarization (which achieved only a ~4% gap in prior experiments).
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
q_proj and v_proj (rank 8, alpha 8)Managed by Adaption Labs AutoScientist platform. Training utilized their GPU infrastructure with batch size 1 and max memory utilization.
BibTeX:
@misc{legalmind-gemma4-billanalyst-2026,
title={LegalMind-Gemma4-31B-BillAnalyst: Multi-Task Legal Reasoning LoRA for Gemma 4 31B},
author={lohithaaa},
year={2026},
publisher={Hugging Face},
url={https://huggingface.co/lohithaaa/adaption-us-bill-analysis-tasks},
note={Trained using Adaption Labs AutoScientist platform for the 2026 AutoScientist Challenge (Legal Category)}
}
APA:
lohithaaa. (2026). LegalMind-Gemma4-31B-BillAnalyst: Multi-Task Legal Reasoning LoRA for Gemma 4 31B. Hugging Face. https://huggingface.co/lohithaaa/adaption-us-bill-analysis-tasks
<reasoning_start> / </reasoning_start> tags.lohithaaa
Via Hugging Face: lohithaaa