History Rhymes: Macro-Contextual Retrieval for Robust Financial Forecasting

—

History Rhymes: Macro-Contextual Retrieval for Robust Financial Forecasting

Sarthak Khanna
Armin Berger
Muskaan Chopra
David Berghaus
Rafet Sifa
Published on 11/12/2025
Equities
United States (US)
Machine learning
Sentiment

This paper introduces a novel retrieval-augmented forecasting framework called macro-contextual retrieval, designed to address the challenge of non-stationarity in financial markets. The key idea is to ground each prediction in historically analogous macroeconomic regimes by jointly embedding structured macro indicators (CPI, unemployment, yield spread, GDP growth) and financial news sentiment into a shared similarity space. During inference, the model retrieves the top-K most similar historical days (using FAISS with causal masking) and conditions its forecast on the average of their text embeddings, effectively learning to reason by precedent without retraining.

The framework is trained on 17 years of S&P 500 data (2007-2023) and evaluated out-of-distribution on AAPL and XOM in 2024. Results show that macro-conditioned retrieval consistently outperforms static baselines (numeric-only, text-only, naive multimodal fusion) under regime shifts. It is the only configuration achieving positive trading outcomes (Profit Factor > 1, Sharpe ratio > 0) on both OOD assets, while baselines collapse with negative risk-adjusted returns. Moreover, the retrieved neighbors form interpretable evidence chains that correspond to recognizable macro contexts (e.g., inflationary periods, yield-curve inversions), providing transparency and causal interpretability. The work demonstrates that macro-aware retrieval offers a principled path toward robust and explainable financial forecasting under distributional change, operationalizing the adage that 'financial history often rhymes.'

Highlights

  • 1Introduces macro-contextual retrieval, a retrieval-augmented forecasting framework that grounds predictions in historically analogous macroeconomic regimes by jointly embedding macro indicators and financial news sentiment.
  • 2Demonstrates consistent out-of-distribution (OOD) robustness across assets (AAPL and XOM 2024), achieving the only positive trading outcomes (PF > 1, Sharpe > 0) while static baselines collapse.
  • 3Provides interpretable evidence chains linking predictions to recognizable macro contexts (e.g., inflationary phases, yield-curve inversions), enhancing transparency and causal interpretability.
  • 4Operationalizes the principle that 'financial history often rhymes' by using causal retrieval of historical precedents without retraining, narrowing the cross-validation to OOD performance gap.

Methods

  • M
    Macro-contextual retrieval: Joint embedding of structured macroeconomic indicators (CPI, unemployment, yield spread, GDP growth) and financial news sentiment (MiniLM encoder) into a shared similarity space, with FAISS-based causal retrieval of top-K historical analogs.
  • M
    Fused query formation: Concatenation of text embedding and macro vector with a weighting parameter α, followed by ℓ2 normalization, to align narrative tone and macro state for similarity search.
  • M
    Forecasting head: Logistic regression classifier that combines numeric features (OHLCV, volatility, sentiment scalars) with retrieved contextual memory (average of neighbors' text embeddings) for next-day directional prediction.
  • M
    Causal masking: Strict temporal causality enforced during retrieval, ensuring only past data (τ < t) are used for each query, preventing look-ahead bias.

Results

  • R
    Macro-conditioned retrieval (α=0.5, K=5) achieves the only positive out-of-sample trading outcomes: AAPL 2024 (Profit Factor=1.18, Sharpe=0.95) and XOM 2024 (PF=1.16, Sharpe=0.61).
  • R
    Static baselines (numeric-only, text-only, multimodal no-retrieval) degrade sharply under OOD, with negative Sharpe ratios and PF near or below 1.0.
  • R
    Macro-retrieval exhibits the smallest performance degradation between cross-validation and OOD (ΔF1 ≈ 0.24, ΔSharpe ≈ 0.60 for AAPL; ΔF1 ≈ 0.20, ΔSharpe ≈ 0.61 for XOM), compared to large drops in other methods.
  • R
    t-SNE diagnostics confirm that OOD queries lie off the training manifold, yet macro-retrieval retrieves coherent historical analogs from economically meaningful regimes (e.g., trade-war periods, rate cuts).
  • R
    Retrieved neighbors show high joint similarity (sim_joint > 0.96) and low macro distance (macro_L2 < 0.7), indicating both semantic and macroeconomic alignment.
0/5

Analyze Paper

Generate insights from "History Rhymes: Macro-Contextual Retrieval for Robust Financ...".

Suggested Actions