--- base_model: Qwen/Qwen3-8B library_name: peft license: apache-2.0 tags: - finance - trading - sft - lora - qwen3 --- # ActiveTrader — SFT Fine-Tuned Trader Agent LoRA adapter for **Qwen3-8B**, fine-tuned to generate structured stock trading recommendations from analyst and risk manager reports. ## What This Model Does Takes two inputs from upstream agents: 1. **Analyst Report** — fundamentals, news, social sentiment, macro context 2. **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 | 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 | Metric | Value | |--------|-------| | Initial train loss | 1.845 | | Final train loss | 0.481 | | Final eval loss | 0.534 | ## Training Data 150 SFT examples generated by: 1. Running Analyst (Qwen2.5-7B) + Risk Manager (Qwen2.5-7B) on 30 tickers across sectors (tech, finance, healthcare, energy, consumer, industrial) 2. Sending report pairs to **GPT-4o** with varied user questions to generate gold-standard trader recommendations 3. Formatting as chat-style JSONL (system + user + assistant) ## Usage ```python from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig from peft import PeftModel import torch # Load base model in 4-bit 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", ) # Load LoRA adapter 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. - GitHub: [Vio1etV/Trading-Agent](https://github.com/Vio1etV/Trading-Agent) ## Framework Versions - PEFT: 0.17.1 - Transformers: 4.57.6 - PyTorch: 2.6.0+cu124 - bitsandbytes: 0.48.2