Research note · July 2026

Behavioral Diagnostic Engine

Can math detect portfolio-manager behavioral biases from trade ledgers alone. A small task-trained model narrates those findings in language a risk committee will actually read. Simulated market, rule-based scorer, Qwen3-8B (8-billion-parameter) AI coach.

Biases found100% · 0 false positives
Train cost~$0.70
Base → trained9.0 → 9.5
Inference$0 · local

The problem

Portfolio managers show predictable biases: holding losers too long and selling winners too early (the disposition effect), trading too much because they overestimate their edge (overconfidence), and refusing to sell below the original purchase price (cost-basis anchoring). Risk reports usually show profit and loss plus Value at Risk. They rarely explain why the performance looks the way it does.

Math can detect these patterns from prices, positions, and trades alone. The AI should only narrate a structured scorecard. It should not hunt for patterns in raw ledgers.

How it works

Simulated market → unbiased and biased traders → rule-based scorer → structured scores → task-trained AI → risk-committee memo.

Every stage is formula-based and auditable except the final memo generation. The model receives a scorecard; if the memo is wrong, the scorecard is wrong, and the metric path is traceable.

Training the AI coach

Base model: Qwen3-8B, an 8-billion-parameter open-weight model, adapted via 4-bit QLoRA (a memory-efficient training method) on a GCP NVIDIA L4 (~55 min). Dataset: 700 train + 100 validation simulated scorecard-to-memo pairs, plus 2 verified real pairs from the scorer gate. Labels from a rule-based memo writer. No API spend. Local serve via Ollama (a tool for running AI models locally) with a compressed model file (bde-coach, 84 MB).

Results

Base vs trained coach

Same scorecard prompts, same local hardware (Ollama on AMD Radeon 890M integrated GPU).

Headline metrics

MetricBase Qwen3-8BBDE coach
Biased case quality10/1010/10
Control case quality8/109/10
Avg time per run~48s~27s
Quality score (1–10 scale)9.09.5

Quality scores are close. Domain correctness is not: the base model misreads PGR/PLR (profit-gain/loss realization ratios) as “growth/loss rate” and treats turnover 6.27 as “~6.3%.” The trained model writes risk-committee memos with correct disposition interpretation.

Economics

StageCost
Simulated data + rule-based scorer$0 (rule-based script)
Dataset labeling$0 (rule-based memo writer)
Training run (L4, ~1 hr)~$0.70–0.90
Inference$0 (local Ollama)

Total cloud GPU spend under $1. After training, the full pipeline runs locally with no API keys.

Rule-based scorer gate

100%
3/3 biases · 0 false positives
Role
Math finds bias before the AI narrates

Train cost

~$0.70
Qwen3-8B 4-bit trained model · GCP L4 · ~55 min
Role
Specialist coach, not a paid cloud model

Local inference

$0
~27s trained · ~48s base
Role
Ollama compressed model on existing hardware
Samples

What the coach actually writes

Trained-model outputs for the two verified scorecards. Full text in the artifacts row above.

Biased trader 3 flags · disposition · overconfidence · anchoring
SUBJECT: Cost-basis Anchoring, Overconfidence /
excess turnover, No-disposition discipline

DIAGNOSIS
PGR = 0.0462 · PLR = 0.0000 · turnover ≈ 6.27 (High)
underwater day share = 63.42% · sell-below-cost = 0.00%

Pattern: reluctance to crystallize losses; elevated
trading without matching risk-adjusted edge.

INTERVENTION
Prohibit “get-even” holds below cost beyond policy.
Cap gross turnover; require edge thesis for re-entry
within five sessions of profit-taking.
Control trader 0 flags · clean scorecard
SUBJECT: No Material Behavioral-risk Flags Present

DIAGNOSIS
Annualized turnover ≈ 2.42 (Moderate)
Sharpe ≈ 0.24 · underwater share = 28.15%
sell-below-cost rate = 23.33%

No material behavioral-risk flags on this pack.
Decisions consistent with the supplied baseline.

INTERVENTION
None required. Continue monitoring PGR/PLR gap,
turnover vs Sharpe, and underwater / sell-below-cost
on the next review pack.
Interpretation

What this proves, and what it doesn’t

Claims supported

  • Simulated data is enough to build and gate a bias detector
  • Rule-based evaluation before AI narration keeps the system auditable
  • Training changes domain behavior, not surface benchmark scores.
  • Local inference is viable after a sub-$1 training run

Limits of this note

ConstraintImplication
Version 1 biases onlyHerding, recency, loss aversion still open
Single simulated market path5 stocks × 252 days; no multi-path simulation
Simulated tradersReal portfolio-manager ledgers not yet validated
Single-response coachNo multi-turn coaching dialogue
More

Related notes