LLM-Generated Counterfactual Stress Scenarios for Portfolio Risk Simulation via Hybrid Prompt-RAG Pipeline
Organizations: Department of Information Engineering, University of Pisa, Pisa, Italy
Abstract
We develop a transparent, auditable large language model (LLM) pipeline for macro-financial stress testing. Structured prompting, with optional retrieval of country fundamentals and news, emits G7 macroeconomic scenarios (GDP growth, inflation, policy rate), which are converted into deviations from an IMF World Economic Outlook baseline and translated into portfolio losses through a three-channel PCA factor model. The macro-to-factor mapping is stipulated rather than estimated, so every tail-risk multiple is conditional on stated assumptions. Across 2,420 accepted scenarios from two model families and three runs, plus an unanchored-severity run and eight risk-layer ablations, we find three things. First, severity is inherited from scenario design, not generated by the model: prompt variant dominates every variance decomposition, removing the prompted severity bands makes GPT-5.6-luna's recession 1.6 pp milder, apparent country heterogeneity largely reflects the institutional baseline, and retrieval and news matter only where the prompt leaves magnitude free. Second, numerical severity and narrative severity are only weakly coupled. Third, GPT-5.6-luna follows its own arithmetic but anchors on prompted bands, whereas Llama-3.1-8B is four to seven times more dispersed and contradicts its own stated changes in 90% of cases. A repeat run differs at the scenario level yet agrees on aggregate multiples to within 0.007 times. LLM scenario generators are best used for narrative and sector elicitation around a prescribed severity path, not as autonomous calibrators of stress magnitude.
Figures & tables
| Preset | Scope | Change relative to P1 |
| P1 | — | Primary run (headline results) |
| P2 | generation | Independent repeat draw of P1 under identical settings |
| P3 | generation | Llama-3.1-8B-Instruct instead of GPT-5.6-luna |
| P4 | generation | Unanchored templates: no growth-shortfall band |
| S1 / S2 | risk layer | / |
| S3 | risk layer | estimated empirically (Section 3.9 ) |
| Linear | Volatility | Portfolio A ANOVA | |||||||
| Preset | Change | VaR | CVaR | VaR | CVaR | ||||
| P1 | primary | 838 | 4.058 | 2.438 | 2.816 | 1.824 | 0.873 | 0.140 | 0.649 |
| P2 | repeat draw | 838 | 4.064 | 2.442 | 2.823 | 1.828 | 0.874 | 0.144 | 0.101 |
| P3 | Llama | 744 | 4.277 | 2.560 | 2.916 | 1.886 | 0.398 | 0.087 | 0.020 |
| P4 | no severity bands | 840 | 3.355 | 2.062 | 2.625 | 1.704 | 0.638 | 0.197 | 0.002 |
| S1 | 838 | 3.481 | 2.144 | 2.816 | 1.824 | 0.872 | 0.141 | 0.673 | |
LLM Reliability
Large language model reliability studies whether outputs remain correct, calibrated, robust, and controllable across prompts, contexts, and deployment conditions.
See all 802 papers