Projects

Teaching a small LLM to call a Black–Scholes pricer

Can a 135-million-parameter model learn to call a pricing tool correctly, with the right units, and learn just as well when not to call it?

PyTorch, Transformers, TRL, LoRA, GRPO, DPO, 2026. Code on GitHub

exact tool-call success, unit-normalized prompts
94.8%
routing accuracy, tool vs. no tool
97.5%
false-positive tool calls after selective SFT
85% → 5%

The question

The target is a structured call such as bs(S=100, K=110, T=0.5, r=0.05, sigma=0.2, type="call"). Getting the format right is the easy part. The hard parts are converting "5%", "six months", or "90 days" into the right arguments, and not reaching for the tool when the question has nothing to do with option pricing.

Approach

Results

StageAvg rewardExact success
Layer 1 model on Layer 2 prompts0.8033.7%
Layer 2 SFT (135M)0.98894.8%
Layer 2 GRPO (135M)0.98190.4%
Layer 2 SFT (360M)0.99898.8%
Unit-normalized test prompts

What I learned