Central Bank Text NLP Models
Relevant source files
The following files were used as context for generating this wiki page:
Central Bank Text NLP Models within the project provide a deterministic framework for classifying the sentiment of Federal Reserve communications, specifically FOMC minutes and Jerome Powell's speeches. This system operates as a V2 enhancement to the monetary axis, serving as an evidence-grade signal for "monetary pressure" rather than a primary rule predicate. The implementation utilizes a curated lexicon-based scorer to ensure stateless replay, as required by the project's architecture, which forbids non-deterministic steps like unpinned LLM calls.
Sources: src/regime_detection/central_bank_text.py:1-40, src/regime_detection/_config_layer2.py:75-80
Scorer Architecture and Logic
The NLP model implements a bag-of-keywords approach using two curated vocabularies: HAWKISH_TERMS and DOVISH_TERMS. These lexicons are derived from established central-banking literature, including works by Romer & Romer and the Bank of England MPC sentiment dictionary. Matching is performed using word-boundary anchored regular expressions that account for common inflections (e.g., "hike" matches "hikes", "hiked", or "hiking").
Sources: src/regime_detection/central_bank_text.py:46-125
Scoring Calculation
A single document is assigned a net_score in the range [-1, +1], calculated based on the frequency of hawkish and dovish hits:
- Hawkish Count: Total distinct hawkish lexicon hits.
- Dovish Count: Total distinct dovish lexicon hits.
- Net Score:
(hawkish_count - dovish_count) / (hawkish_count + dovish_count). - If no hits occur, the score is
NaN.
Sources: src/regime_detection/central_bank_text.py:146-170
Data Flow for Text Sentiment
The following diagram illustrates the lifecycle of central bank text from acquisition to the final smoothed score used by the engine.
The data flow ensures that raw text is transformed into a daily session-aligned series suitable for regime detection.
Sources: src/regime_detection/central_bank_text.py:270-340, src/regime_data_fetch/fomc_minutes.py:200-250
Configuration and Calibration
The behavior of the NLP model is governed by the CentralBankTextConfig class, which manages smoothing windows, data staleness caps, and collision strategies for multiple releases on the same day.
Configuration Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
smoothing_window_sessions | int | 30 | Window in NYSE sessions for the rolling mean (approx. 6 weeks). |
max_release_age_days | int | 365 | Safety cap to exclude releases older than this threshold. |
same_date_aggregation | Literal | pick_longer | Strategy for handling multiple releases on one date. |
Sources: src/regime_detection/_config_layer2.py:72-105
Aggregation Strategies
When multiple documents (e.g., FOMC minutes and a Powell speech) land on the same date, the system applies one of three strategies:
- pick_longer: The document with the highest token count wins.
- token_weighted_average: Scores are averaged based on document length.
- fomc_priority: FOMC minutes take precedence over other sources.
Sources: src/regime_detection/central_bank_text.py:228-268
Validation and Performance
The model's accuracy is measured against the gtfintechlab/fomc_communication labeled corpus. While sentence-level accuracy is approximately 53.9%, the accuracy increases to ~70.9% when the lexicon successfully fires on a directional sentence.
This validation process confirms that while bag-of-keywords is simple, it is sufficient for document-level evidence at the granularity consumed by the regime engine.
Sources: scripts/validate_central_bank_text_lexicon.py:20-80, src/regime_detection/central_bank_text.py:127-132
Integration with Feature Store
The resulting central_bank_text_score is integrated into the project's FeatureStore via the monetary axis. This signal is surfaced as evidence to help identify tightening or easing pressure without directly triggering state transitions.
Integration Details
- Seam Alignment: The score is forward-filled onto the NYSE trading calendar.
- Bias Warnings: The feature output emits the code
central_bank_text_deterministic_lexicon_substituteto denote its implementation status. - Calibration Summaries: The
run_v2_calibration.pyscript surfaces the smoothed score distribution (min, p25, median, p75, max) for operator review.
Sources: src/regime_detection/central_bank_text.py:314-340, scripts/run_v2_calibration.py:58-95
Conclusion
The Central Bank Text NLP Models provide a robust, deterministic method for incorporating qualitative monetary policy signals into the project's quantitative regime detection engine. By leveraging a curated lexicon and rigorous session-alignment, the system maintains the architectural requirement for stateless replay while providing valuable context for identifying monetary policy cycles.
Sources: src/regime_detection/central_bank_text.py:1-40, tests/test_central_bank_text_cycle_regression.py:1-30