LLM-Generated Counterfactual Stress Scenarios for Portfolio Risk Simulation via Hybrid Prompt-RAG Pipeline

—

LLM-Generated Counterfactual Stress Scenarios for Portfolio Risk Simulation via Hybrid Prompt-RAG Pipeline

Masoud Soleimani
Published on 11/26/2025
Cross-asset
United States (US)
Europe (EU)
Japan
United Kingdom (UK)
AI
LLM
Risk management
Machine learning

This paper presents a transparent and auditable LLM-based pipeline for macro-financial stress testing, combining structured prompting with optional retrieval of country fundamentals and news. The system generates machine-readable macroeconomic scenarios for G7 countries, covering GDP growth, inflation, and policy rates, which are translated into portfolio losses through a factor-based mapping enabling Value-at-Risk and Expected Shortfall assessment relative to classical econometric baselines. Across models, countries, and retrieval settings, the LLMs produce coherent and country-specific stress narratives, yielding stable tail-risk amplification with limited sensitivity to retrieval choices. Comprehensive plausibility checks, scenario diagnostics, and ANOVA-based variance decomposition show that risk variation is driven primarily by portfolio composition and prompt design rather than by the retrieval mechanism. The pipeline incorporates snapshotting, deterministic modes, and hash-verified artifacts to ensure reproducibility and auditability. Overall, the results demonstrate that LLM-generated macro scenarios, when paired with transparent structure and rigorous validation, can provide a scalable and interpretable complement to traditional stress-testing frameworks.

Highlights

  • 1Develops a fully auditable Prompt-RAG pipeline for generating structured macroeconomic stress scenarios using LLMs.
  • 2Combines IMF fundamentals with optional news retrieval to produce country-specific shocks for G7 economies.
  • 3Translates LLM-generated macro shocks into portfolio VaR/CVaR multiples via a three-channel factor model.
  • 4Provides extensive diagnostics including plausibility checks, dispersion analysis, and ANOVA variance decomposition.
  • 5Demonstrates that portfolio composition and prompt design dominate risk variation, with retrieval having marginal effects.

Methods

  • M
    Hybrid Prompt-RAG pipeline with structured JSON output, optional news retrieval, and MiniLM-FAISS indexing.
  • M
    Two-layer plausibility filtering (hard and soft gates) and NLI-based regime tagging for scenario quality control.
  • M
    Three-channel factor model (pure volatility, linear PCA, nonlinear polynomial) for mapping macro shocks to portfolio losses.
  • M
    ANOVA-based variance decomposition to quantify contributions of model, retrieval, news, and prompt design to tail-risk outcomes.

Results

  • R
    LLMs produce coherent, country-specific stress narratives with stable tail-risk amplification across G7 economies.
  • R
    Risk variation is driven primarily by portfolio composition and prompt design, not by retrieval mechanism.
  • R
    GPT-5-mini yields 627 accepted scenarios after plausibility filtering; Llama-3.1-8B-Instruct yields 307.
  • R
    VaR/CVaR multiples from LLM scenarios exceed historical bootstrap baselines, with nonlinear channel showing highest amplification.
  • R
    Cross-run stability and fairness diagnostics confirm consistent performance across countries and configurations.
0/5

Analyze Paper

Generate insights from "LLM-Generated Counterfactual Stress Scenarios for Portfolio ...".

Suggested Actions