"Building FinOptix-14B: A FinOps Architect in 14 Billion Parameters"
"How I fine-tuned a small language model to audit Terraform, parse AWS costs, and enforce cloud governance — in 40 minutes on a single GPU."
tags: finops, aws, huggingface, machinelearning
The Problem
I run a small AWS-based startup. Every month I spend 2+ hours manually auditing Terraform configs, checking for missing tags, oversized instances, and parsing Cost Explorer JSONs to find anomalies. It's repetitive, error-prone, and I know I'm leaving money on the table.
Large language models can do this — but they cost $0.01-0.03 per query, need internet, and send my infrastructure code to someone else's servers.
What if I had a specialist model that runs on a single GPU, offline, for free?
The Approach: Fine-tune Small, Think Big
For the Hugging Face Build Small Hackathon, I built FinOptix-14B — a Qwen 2.5 14B model fine-tuned specifically for:
- Auditing Terraform HCL for FinOps compliance
- Parsing AWS Cost Explorer / Anomaly Detection JSON
- Validating architecture files against governance policies
- Answering FinOps strategy questions
The constraint: ≤ 32 billion parameters. Fits on a laptop.
Training: 265 Examples, 40 Minutes, $3.50
The Dataset
I generated 265 high-quality synthetic training pairs covering:
| Category | Examples | What it teaches |
|---|---|---|
| Terraform HCL | 100 | Rightsizing, tagging, encryption, lifecycle policies |
| AWS Cost JSON | 80 | Anomaly parsing, budget alerts, cost-by-service analysis |
| BYaML Governance | 50 | Architecture validation, policy enforcement |
| FinOps Q&A | 15 | Frameworks, strategies, tools |
| Scripts | 20 | boto3, bash automation for cloud ops |
Every output follows a structured format: findings with severity (🔴 🟡 🔵), estimated savings, and corrected code. The model learns how to think, not just what to say.
The Training
Base: Qwen/Qwen2.5-14B-Instruct
Method: QLoRA (4-bit NF4)
LoRA: r=16, alpha=32
GPU: NVIDIA A100-80GB (Modal)
Duration: 40 minutes
Cost: $3.50
That's it. No multi-GPU clusters. No days of training. One A100 for 40 minutes.
The Gotchas
It took 4 attempts to get training right:
- ❌ Client disconnected (forgot
--detach) - ❌ Eval split too small for sample packing
- ❌ CUDA error from stale cache + flash attention
- ✅ Disabled flash_attention, sample_packing, cleaned cache → success
Lesson: with small datasets (~265 examples), keep your training config simple. No fancy optimizations needed.
The Result
FinOptix-14B generates structured audit reports from raw Terraform:
Input:
resource "aws_instance" "api" {
ami = "ami-0c55b159"
instance_type = "m5.4xlarge"
}
Output:
### FinOptix Audit Report
**Findings:**
1. 🔴 Over-provisioned — m5.4xlarge detected
2. 🟡 Missing governance tags
3. 🔵 Not using Graviton instances
**Estimated Impact:** ~67% cost reduction → t3.large
**Recommended Fix:**
[corrected HCL with tags and rightsized instance]
It runs on a single L4 GPU (24GB) in under 20 seconds per query. Fully offline once loaded.
Serving: The VRAM Battle
Serving a 14B model in a hackathon budget taught me things:
| Hardware | Result |
|---|---|
| A10G Small (14GB RAM) | ❌ OOM on load |
| HF Inference API | ❌ Model not supported (too large) |
| L4 (24GB VRAM, 30GB RAM) | ✅ Works! ~22GB VRAM used |
Key learnings:
- Use
do_sample=False(greedy) with 4-bit quantization — sampling produces NaN - Add a threading lock — concurrent model loads crash the container
- One request at a time — KV cache fills remaining VRAM
What I'd Do Differently
- Start with 7B — 14B is at the edge of what fits on affordable GPUs. A 7B model would serve faster and cheaper.
- More diverse outputs — My training data is good but narrow. More edge cases would help generalization.
- Pre-quantize to GGUF — Would enable llama.cpp runtime and truly local inference on consumer hardware.
Try It
- 🔗 Live demo: huggingface.co/spaces/build-small-hackathon/finoptix14b
- 🔗 Open weights: huggingface.co/ccortezb/FinOptix-14B
- 🏕️ Hackathon: Build Small Hackathon
- **Hackaton Space FinOptix: ** build-small-hackathon/finoptix14b
Built by Carlos Cortez — AWS Community Hero, Lima, Peru. Fine-tuned on Modal, served on Hugging Face Spaces, trained on synthetic data. Total cost: $4.08.
💡 The Opportunity Cost of NOT Having It
From cost engineering: it's not just what you pay to build — it's what you lose by not building.
| Without FinOptix | With FinOptix |
|---|---|
| 2+ hrs/month manual audit | < 5 min (ask the model) |
| Miss 30-40% of governance violations | Catches tags, sizing, lifecycle systematically |
| React to billing spikes (after damage) | Proactive anomaly analysis |
| $0.01-0.03/query to GPT-4 ($15-50/month for daily use) | $0 inference (local GPU) |
| Send Terraform + billing to external APIs | 100% private, offline capable |
Conservative estimate: 2 hrs × $75/hr × 12 months = $1,800/year in engineer time saved. Plus avoided cloud waste (rightsizing + idle resources): $500-2,000/year for a small account.
ROI: $4.08 invested → $2,300+/year in value. That's a 56,000% return.
📋 But Wait — The Hidden Costs You're NOT Considering
The $4.08 model is the easy part. In the real world, adopting FinOps properly involves costs most teams ignore:
| Cost Category | Estimated (LATAM/Peru) | What it involves |
|---|---|---|
| FinOps Assessment | $3,000 - $8,000 | External audit to determine your maturity level (Crawl/Walk/Run), identify gaps, define KPIs. Required before any tooling decision. |
| Training: Cloud → FinOps Architects | $1,500 - $4,000/person | Transitioning cloud architects to FinOps thinking. Not just "tag your resources" — it's allocation models, showback, unit economics. |
| FinOps Foundation Certification | $300/person (FinOps Certified Practitioner) | The industry standard. Exam + prep materials. Required for credibility with leadership. |
| Advanced FinOps Training | $2,000 - $5,000/team | Workshops on: cost allocation strategies, anomaly response playbooks, commitment-based discounts, container cost visibility |
| Data Protection & Compliance | $1,000 - $3,000 | Billing data is sensitive (reveals business scale, margins, client costs). Needs access controls, audit trails, encryption. |
| Coding Agent Tooling | $20 - $100/month | Kiro, Claude, GitHub Copilot — the AI assistants that accelerate FinOps automation. Not optional in 2026. |
Total realistic investment for a 5-person team: $15,000 - $30,000 in Year 1.
Why this matters: A DevOps engineer or a cloud architect watching YouTube tutorials won't get you there. FinOps requires:
- Financial modeling skills (not just infra skills)
- Organizational change management (showback → chargeback)
- Data governance (billing data = business intelligence)
- AI-assisted automation (Coding Agents like Kiro + Claude are force multipliers, not toys)
The $4.08 model doesn't replace the journey — it accelerates it.
FinOptix-14B gives your team a private, local specialist that's available 24/7 during that transformation. It's the tool that makes the $15K-$30K investment actually pay off faster.
The real cost isn't $4.08. It's the $2,300/year you leave on the table every year you don't automate your FinOps — multiplied by the organizational debt of not having trained practitioners.
Final thought: After you've paid for the assessment, the training, the certifications, and the tooling — after all the hidden costs are accounted for — the $4.08 model is the cherry on top. It's the best-of-the-best optimization: a specialist that runs locally, costs nothing to operate, and compounds the value of every dollar you already invested in FinOps maturity. Totally worth it.
Check it out on : https://huggingface.co/spaces/build-small-hackathon/finoptix14b
Built by Carlos Cortez — AWS Community Hero, Lima, Peru. Fine-tuned on Modal, served on Hugging Face Spaces, trained on synthetic data. Total cost: you know now it cost more than 4.08 dollars
