What This Model Does
Takes two inputs from upstream agents:
- Analyst Report — fundamentals, news, social sentiment, macro context
- Risk Manager Report — technical indicators, support/resistance, risk assessment
Outputs a structured Trading Recommendation: Buy / Hold / Sell with entry zone, stop loss, target price, reasoning, and key risks.
Training Details
Table with columns: Parameter, Value| Parameter | Value |
|---|
| Base model | Qwen/Qwen3-8B |
| Method | QLoRA (4-bit NF4) |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Training examples | 150 (30 tickers × 5 question variants) |
| Train/eval split | 135 / 15 |
| Epochs | 3 |
| Batch size | 2 × 4 grad accum = 8 effective |
| Learning rate | 2e-4 (cosine schedule) |
| Hardware | NVIDIA RTX 4070 (8GB VRAM) |
| Training time | ~9 hours |
| Trainable params | 43.6M / 8.2B (0.53%) |
Training Results
Table with columns: Metric, Value| Metric | Value |
|---|
| Initial train loss | 1.845 |
| Final train loss | 0.481 |
| Final eval loss | 0.534 |
Training Data
150 SFT examples generated by:
- Running Analyst (Qwen2.5-7B) + Risk Manager (Qwen2.5-7B) on 30 tickers across sectors (tech, finance, healthcare, energy, consumer, industrial)
- Sending report pairs to GPT-4o with varied user questions to generate gold-standard trader recommendations
- Formatting as chat-style JSONL (system + user + assistant)
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
import torch
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen3-8B",
quantization_config=BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_quant_type="nf4",
),
device_map="cuda:0",
)
model = PeftModel.from_pretrained(base_model, "abababab2003/trader-sft-lora")
model = model.merge_and_unload()
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B")
Project
ActiveTrader — a multi-agent trading system built with LangGraph for CS 496 (Agent AI) at Northwestern University. Three agents collaborate: an Analyst, a Risk Manager, and this SFT-trained Trader.
Framework Versions
- PEFT: 0.17.1
- Transformers: 4.57.6
- PyTorch: 2.6.0+cu124
- bitsandbytes: 0.48.2