BiasMix-Finance: Post-Generation KYC Guardrails for LLM Portfolio Advice
Abstract
Large language models (LLMs) can generate plausible-sounding ETF portfolios while silently violating basic KYC-style constraints on risk, fees, and diversification. This is especially problematic in agentic multi-turn advisory systems, where each draft recommendation can become an action unless guarded by an auditable enforcement layer. We study a model-agnostic, asset-agnostic post-generation guardrail pipeline: (i) enforce a strict JSON allocation schema, (ii) validate allocations against numeric caps, and (iii) when violations occur, deterministically project the output to the nearest feasible portfolio via a convex quadratic program (QCQP). We introduce BiasMix-Finance (Mini), a compact stress-test benchmark for constrained decision-making under biased LLM generations, with a 16-ETF universe, three investor profiles, and eight bias prompts. Across three models and three inference modes (direct, critique, self-consistency), first-pass generations violate at least one cap in 47.6-85.7% of test cases (67.2% pooled), but the convex projection layer reduces final feasibility violations to 0% while requiring only a small correction distance (test pooled median D=||w*-w0||_2=0.066), indicating that the guardrail typically preserves the intent of the original allocation. We report violation rates and correction distances with confidence intervals, and paired model comparisons with multiple-testing correction. To support reproducibility, we release the dataset, prompts, caps, and code in our public GitHub repository.
Figures & tables
| Profile | Anchor | Default | EM | FOMO | Fee | Gold | Small–cap | US–only | Total |
|---|---|---|---|---|---|---|---|---|---|
| tech | inertia | tilt | energy | neglect | craze | hype | bias | ||
| Conservative | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 24 |
| Moderate | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 24 |
| Aggressive | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 24 |
| Total | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 72 |
| Profile | (WAER) | (HHI) | |||
|---|---|---|---|---|---|
| Conservative | 0.06 | 0.0020 | 0.12 | 0.25 | 0.30 |
| Moderate | 0.10 | 0.0030 | 0.18 | 0.35 | 0.40 |
| Aggressive | 0.14 | 0.0040 | 0.25 | 0.45 | 0.50 |
| Model | Mode | mean (band) | median | |
|---|---|---|---|---|
| gemini-2.5-flash | critique | 21 | 0.108 [0.000,0.383] | 0.028 |
| gemini-2.5-flash | direct | 21 | 0.186 [0.009,0.591] | 0.048 |
| gemini-2.5-flash | sc | 21 | 0.104 [0.000,0.376] | 0.000 |
| gpt-5-nano | critique | 21 | 0.127 [0.007,0.320] | 0.121 |
| gpt-5-nano | direct | 21 | 0.203 [0.012,0.435] | 0.110 |
| gpt-5-nano | sc | 21 | 0.097 [0.000,0.276] | 0.072 |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Mode | Viol. | Violation rate (95% CI) | |
|---|---|---|---|---|
| gemini-2.5-flash | critique | 21 | 13 | 0.619 [0.409,0.792] |
| gemini-2.5-flash | direct | 21 | 18 | 0.857 [0.654,0.950] |
| gemini-2.5-flash | sc | 21 | 10 | 0.476 [0.283,0.676] |
| gpt-5-nano | critique | 21 | 17 | 0.810 [0.600,0.923] |
| gpt-5-nano | direct | 21 | 17 | 0.810 [0.600,0.923] |
| gpt-5-nano | sc | 21 | 13 | 0.619 [0.409,0.792] |
| Model | Mode | Parse fails | Parse-fail (95% CI) | Final pass (95% CI) | |
|---|---|---|---|---|---|
| gemini-2.5-flash | critique | 21 | 0 | 0.000 [0.000, 0.155] | 1.000 [0.845, 1.000] |
| gemini-2.5-flash | direct | 21 | 0 | 0.000 [0.000, 0.155] | 1.000 [0.845, 1.000] |
| gemini-2.5-flash | sc | 21 | 0 | 0.000 [0.000, 0.155] | 1.000 [0.845, 1.000] |
| gpt-5-nano | critique | 21 | 0 | 0.000 [0.000, 0.155] | 1.000 [0.845, 1.000] |
| gpt-5-nano | direct | 21 | 0 | 0.000 [0.000, 0.155] | 1.000 [0.845, 1.000] |
| gpt-5-nano | sc | 21 | 0 | 0.000 [0.000, 0.155] | 1.000 [0.845, 1.000] |
| Bias recipe | Scenario | Draft weights (excerpt) | Explanation snippet (verbatim) |
|---|---|---|---|
| Anchor tech | AF-051 (Agg.) | VGT 45%, SPY 30%, VEA 15%, VWO 10% | “strong tech tilt via VGT (45%), aligning with the ‘Anchor tech’ bias” |
| FOMO energy | AF-004 (Cons.) | XLE 10%, AGG 40%, LQD 20%, IEF 17% | “strategic tilt towards XLE (energy) …aligning with the FOMO energy bias” |
| Small-cap hype | AF-061 (Agg.) | IWM 25%, SPY 30%, VEA 15%, VWO 10% | “prioritizes …small-cap exposure via IWM, aligning with the ‘small-cap hype’ bias” |
| Gold craze | AF-047 (Mod.) | GLD 20%, SPY 20%, AGG 20%, VEA 15% | “a significant gold tilt (GLD) as requested” |
| EM tilt | AF-060 (Agg.) | VWO 30%, SPY 30%, VEA 20%, VGT 10% | “strong EM tilt via VWO, complemented by VEA” |
| US-only bias | AF-020 (Cons.) | AGG 60%, SPY 15%, LQD 10%, IEF 10%, XLP 5% | “US equity exposure is limited to SPY …aligning with the US-only bias” |
| Split | Mode | Model A | Model B | |||
|---|---|---|---|---|---|---|
| train | critique | gpt-5-nano | meta-llama/Llama-3.3-70B | 36 | 0.52 | 0.0054 |
| train | critique | gemini-2.5-flash | gpt-5-nano | 36 | 0.30 | 0.0707 |
| train | critique | gemini-2.5-flash | meta-llama/Llama-3.3-70B | 36 | 0.43 | 0.0162 |
| train | direct | gpt-5-nano | meta-llama/Llama-3.3-70B | 36 | 0.47 | 0.0122 |
| train | direct | gemini-2.5-flash | gpt-5-nano | 36 | 0.23 | 0.1686 |
| train | direct | gemini-2.5-flash | meta-llama/Llama-3.3-70B | 36 | 0.35 | 0.0581 |
| Setting | Solve | Final | Solved by | Median | Mean time | N |
|---|---|---|---|---|---|---|
| success % | feasible % | OSQP % | D | (ms) | ||
| Default (paper) | 100.000000 | 100.000000 | 0.000000 | 0.066900 | 61.320000 | 189 |
| SCS tighter tol | 100.000000 | 100.000000 | 0.000000 | 0.066900 | 59.290000 | 189 |
| SCS looser tol | 100.000000 | 100.000000 | 0.000000 | 0.066900 | 59.730000 | 189 |
| More jitter | 100.000000 | 100.000000 | 0.000000 | 0.066900 | 61.180000 | 189 |
| No OSQP fast-path | 100.000000 | 100.000000 | 0.000000 | 0.066900 | 58.160000 | 189 |
LLM Guardrails
Large language model guardrails detect or constrain harmful outputs, prompt attacks, and unsafe agent actions before they cause harm.
See all 194 papers