OsamaAli313/CFO-Agent-14B-Dataset
Viewer β’ Updated β’ 50k β’ 14
How to use OsamaAli313/CFO-Agent-14B with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")
model = PeftModel.from_pretrained(base_model, "OsamaAli313/CFO-Agent-14B")A fine-tuned language model trained to function as an AI Chief Financial Officer. It provides expert-level financial analysis, forecasting, risk assessment, scenario planning, and executive-level financial communication.
Proof-of-Concept: This version uses Qwen2.5-0.5B-Instruct as the base model for budget-efficient validation. A production version on Qwen2.5-14B-Instruct is planned.
| Capability | Description |
|---|---|
| Financial Statement Analysis | Analyze balance sheets, income statements, and cash flow statements |
| Revenue & Expense Forecasting | Project future financials with quantified assumptions |
| Risk Assessment | Identify, quantify, and prioritize financial risks |
| Scenario Planning | Model best/worst/base case scenarios with financial impact |
| Budget Optimization | Allocate resources and optimize departmental budgets |
| Executive Communication | Generate board-level reports, investor updates, and CFO memos |
| M&A Analysis | Evaluate acquisitions with DCF, multiples, and synergy analysis |
| Cash Flow Management | Monitor burn rate, runway, and working capital |
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-0.5B-Instruct",
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, "OsamaAli313/CFO-Agent-14B")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")
messages = [
{"role": "system", "content": "You are CFO-Agent, an expert Chief Financial Officer AI assistant."},
{"role": "user", "content": "Analyze this: Revenue $500K, COGS $200K, OpEx $150K. What are our margins?"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
import torch
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
)
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-0.5B-Instruct",
quantization_config=bnb_config,
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, "OsamaAli313/CFO-Agent-14B")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")
Trained on OsamaAli313/CFO-Agent-14B-Dataset β a curated dataset of 47,481 training samples across three layers:
| Layer | Source | Samples | Content |
|---|---|---|---|
| Layer 1 | Public HF datasets | ~10K | Financial instruction-following (FiQA, Alpaca Finance, FinGPT) |
| Layer 2 | Structured financial data | ~5K | Balance sheet analysis, income statement review, earnings calls, risk reports |
| Layer 3 | Synthetic CFO scenarios | ~50K | Scenario planning, risk assessment, M&A analysis, budget allocation, executive communication |
All data formatted in ChatML with a CFO-Agent system prompt.
| Parameter | Value |
|---|---|
| Base model | Qwen/Qwen2.5-0.5B-Instruct |
| Method | QLoRA (SFT) |
| LoRA rank | 64 |
| LoRA alpha | 128 |
| Target modules | q, k, v, o, gate, up, down projections |
| Epochs | 3 |
| Batch size | 1 (x16 gradient accumulation) |
| Learning rate | 2e-4 (cosine decay) |
| Max sequence length | 512 |
| Optimizer | paged_adamw_8bit |
| Precision | bf16 |
| Hardware | NVIDIA T4 (HF Jobs) |
| Training time | ~3.5 hours |
| Metric | Value |
|---|---|
| Final training loss | 0.1036 |
| Average training loss | 0.1706 |
| Mean token accuracy | 95.75% |
| Total steps | 938 |
Training metrics are available on the Trackio dashboard.
Analyze our income statement: Revenue $500K, COGS $200K, Operating Expenses $150K.
What's our gross margin and operating margin?
We have $100K cash with $20K monthly burn rate. When do we run out of cash?
What cost reduction targets should we set?
Compare two scenarios: Base case 20% revenue growth / 15% margin vs
Worst case 5% growth / 10% margin. What's the year-end profitability impact?
Our revenue grows 10% quarterly starting from $1M.
Project revenue for the next 4 quarters and calculate CAGR.
@misc{cfo-agent-14b,
title={CFO-Agent-14B: An AI Chief Financial Officer},
author={Osama Ali},
year={2026},
url={https://huggingface.co/OsamaAli313/CFO-Agent-14B}
}