Downloads · 30 days
10
11% of all-time downloads
naazimsnh02/FinanceGemma-E4B-lora
FinanceGemma-E4B-lora is a text generation model from naazimsnh02. 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 QLoRA adapter that turns google/gemma-4-E4B-it (~4B parameters) into a financial reasoning and classification specialist — trained on a single NVIDIA L4 (24 GB).
Downloads · 30 days
10
11% of all-time downloads
All-time downloads
88
Public
Repo size
326 MB
Likes
0
Public
Click a slice to open those files.
.safetensors294 MB · 90%
From the Hugging Face model README
A QLoRA adapter that turns google/gemma-4-E4B-it (~4B parameters) into a financial reasoning and classification specialist — trained on a single NVIDIA L4 (24 GB).
google/gemma-4-E4B-it (Gemma 4, ~4B params)| Parameter | Value |
|---|---|
| Base model | unsloth/gemma-4-E4B-it (4-bit quantized) |
| LoRA rank (r) | 32 |
| LoRA alpha | 64 |
| LoRA dropout | 0 |
| Target modules | attention + MLP (all language layers) |
| Max sequence length | 4096 |
| Effective batch size | 16 (micro-batch 1 × grad accum 16) |
| Epochs | 2 |
| Total steps | 3,738 |
| Learning rate | 1e-4 |
| LR scheduler | cosine (3% warmup) |
| Optimizer | AdamW 8-bit |
| Precision | bf16 |
| Weight decay | 0.01 |
| Training runtime | 59,813s (~16.6 hours) |
| Peak VRAM | 16.4 GB |
| Loss (start → end) | 0.587 → 0.085 |
~30,000 instruction-response pairs built from two open-source finance datasets:
The corpus is diversity-sampled (per-source and per-task-type caps) and 10-gram decontaminated against FLARE evaluation inputs (FPB, FiQA_SA, Headline) to prevent benchmark leakage.
FLARE-style multiple-choice accuracy on AdaptLLM/finance-tasks (greedy decoding, temp=0):
| Task | n | Accuracy |
|---|---|---|
| FPB | 970 | 78.4% |
| FiQA_SA | 235 | 67.2% |
| Headline | 20,547 | 69.2% |
| Macro avg | — | 71.6% |
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model = AutoModelForCausalLM.from_pretrained(
"google/gemma-4-E4B-it",
device_map="auto",
torch_dtype="auto",
)
model = PeftModel.from_pretrained(base_model, "naazimsnh02/FinanceGemma-E4B-lora")
tokenizer = AutoTokenizer.from_pretrained("naazimsnh02/FinanceGemma-E4B-lora")
prompt = "Classify the sentiment of this financial news: 'Apple reported record Q4 earnings, beating analyst estimates by 15%.'"
messages = [{"role": "user", "content": [{"type": "text", "text": prompt}]}]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True, return_dict=True).to(model.device)
output = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(output[0], skip_special_tokens=True))
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
"naazimsnh02/FinanceGemma-E4B-lora",
max_seq_length=4096,
load_in_4bit=True,
)
FastModel.for_inference(model)
Financial text analysis tasks including:
Apache 2.0 (same as the base Gemma 4 model)