Downloads · 30 days
6
18% of all-time downloads
z3rotig4r/quant-brain-solar-10.7b-finance-lora
quant-brain-solar-10.7b-finance-lora is a text generation model from z3rotig4r. 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.
QLoRA fine-tuned adapter for Upstage/SOLAR-10.7B-Instruct-v1.0, specializing in financial sentiment analysis, financial QA, and quantitative trading decision support.
Downloads · 30 days
6
18% of all-time downloads
All-time downloads
34
Public
Repo size
503 MB
Likes
0
Public
Click a slice to open those files.
.safetensors503 MB · 99%
From the Hugging Face model README
QLoRA fine-tuned adapter for Upstage/SOLAR-10.7B-Instruct-v1.0, specializing in financial sentiment analysis, financial QA, and quantitative trading decision support.
Quant-Brain is a LoRA adapter fine-tuned on top of Upstage/SOLAR-10.7B-Instruct-v1.0 using QLoRA (4-bit NF4 quantization with double quantization). It is optimized for financial domain tasks including news sentiment classification, financial question answering, and providing strategic analysis for algorithmic trading systems.
The adapter targets both Attention layers (q/k/v/o projections) and MLP layers (gate/up/down projections) to enhance financial reasoning capability beyond simple pattern matching.
Designed as the "Brain" service in the Quant-Brain automated trading system:
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
BASE_MODEL = "Upstage/SOLAR-10.7B-Instruct-v1.0"
ADAPTER = "YOUR_HF_USERNAME/quant-brain-solar-10.7b-finance"
# Load with 4-bit quantization
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
)
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
quantization_config=bnb_config,
device_map="auto",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
)
model = PeftModel.from_pretrained(model, ADAPTER)
model.eval()
# Inference
prompt = """### User:
Analyze the sentiment of the following financial news. Classify as positive, negative, or neutral, and explain your reasoning.
NVIDIA's data center revenue surged 409% year-over-year, driven by explosive AI chip demand.
### Assistant:
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7, top_p=0.9)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# First merge adapter with base model, then serve
python -m vllm.entrypoints.openai.api_server \
--model /path/to/merged-model \
--max-model-len 4096 \
--dtype bfloat16 \
--gpu-memory-utilization 0.90
A curated financial domain dataset of 147,324 training and 16,370 validation samples (163,694 total), sourced from:
| Source | Description | Samples |
|---|---|---|
| Financial PhraseBank | Financial news sentiment (positive/negative/neutral) | ~5,000 |
| Kaggle Financial Sentiment | Social media financial sentiment | ~6,000 |
| HuggingFace FinGPT Sentiment | Multi-source financial sentiment | ~50,000 |
| Financial QA Datasets | Investment, portfolio, risk management QA | ~40,000 |
| FineWeb Finance Subset | High-quality financial web text | ~50,000 |
| Stock Technical Data | OHLCV analysis for 70+ symbols across 5 years | ~12,000 |
All data formatted as instruction-input-output triplets in JSONL format.
### User:\n{instruction}\n{input}\n\n### Assistant:\n{output}| Parameter | Value |
|---|---|
| Training regime | bf16 (bfloat16 mixed precision) |
| Quantization | 4-bit NF4 with double quantization |
| LoRA rank (r) | 32 |
| LoRA alpha | 64 |
| LoRA dropout | 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Learning rate | 1e-5 |
| LR scheduler | Cosine |
| Warmup ratio | 5% |
| Epochs | 2 |
| Batch size | 16 × 2 (effective: 32) |
| Max sequence length | 512 |
| Optimizer | Paged AdamW 8-bit |
| Weight decay | 0.01 |
| Max grad norm | 1.0 |
| Gradient checkpointing | Enabled |
| Packing | Enabled |
| Metric | Value |
|---|---|
| Total training time | 22.7 hours |
| Total steps | 3,376 |
| Training samples/sec | 1.32 |
| Steps/sec | 0.041 |
| Total FLOPs | 3.52 × 10¹⁸ |
| Adapter size | ~134 MB |
| VRAM usage | ~6.4 GB (4-bit quantized) |
| Metric | Value |
|---|---|
| Final Training Loss | 0.8203 |
| Best Eval Loss | 0.7694 (step 3000) |
| Eval Loss @ step 1000 | 0.8067 |
| Eval Loss @ step 2000 | 0.7773 |
| Eval Loss @ step 3000 | 0.7694 |
| Final Token Accuracy | ~80.1% |
Step Loss Eval Loss Token Accuracy
──── ──── ───────── ──────────────
10 2.903 — 52.8%
100 1.132 — 68.9%
500 0.830 — 79.4%
1000 0.795 0.807 80.0%
2000 0.768 0.777 80.5%
3000 0.755 0.769 80.3%
3376 0.772 — 80.1%
| Test | Category | Input | Expected | Output | Result |
|---|---|---|---|---|---|
| 1 | Sentiment | Apple record revenue $124B | positive | strong positive | ✅ |
| 2 | Sentiment | Tesla shares plunged 12% | negative | moderately negative | ✅ |
| 3 | Sentiment | Fed kept rates unchanged | neutral | mildly positive | ❌ |
| 4 | Financial QA | Market vs limit order | — | Correct explanation | ✅ |
| 5 | Financial QA | Growth stock evaluation | — | Comprehensive factors | ✅ |
| 6 | Financial QA | Portfolio diversification | — | Accurate explanation | ✅ |
| 7 | Sentiment | NVIDIA revenue surged 409% | positive | moderately positive | ✅ |
| 8 | Financial QA | Inflation vs stock market | — | Correct analysis | ✅ |
Carbon emissions estimated using the ML Impact Calculator.
@misc{quant-brain-solar-finance-2025,
title = {Quant-Brain SOLAR-10.7B Financial Adapter},
author = {Quant-Brain Team},
year = {2025},
url = {https://github.com/YOUR_USERNAME/ai_quant_brain},
note = {QLoRA fine-tuned adapter for financial sentiment analysis and trading decisions}
}