QuantHive-Research-Tech commited on
Commit
7ee0f26
·
verified ·
1 Parent(s): 4cdd5b8

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +117 -0
README.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - finance
5
+ - world-model
6
+ - diffusion
7
+ - causal-inference
8
+ - scenario-generation
9
+ - indian-markets
10
+ language:
11
+ - en
12
+ pipeline_tag: other
13
+ ---
14
+
15
+ # Horizon v1 — Causal Financial World Model
16
+
17
+ The first causal world model for financial markets achieving Pearl Level 3 (counterfactual reasoning).
18
+
19
+ ## What This Model Does
20
+
21
+ Generate realistic multi-asset market scenarios from natural language descriptions:
22
+
23
+ ```python
24
+ from horizon.inference.scenario_engine import ScenarioEngine
25
+
26
+ engine = ScenarioEngine.from_checkpoint("model.pt")
27
+ result = engine.generate(
28
+ description="RBI cuts repo rate by 50bp amid slowing growth",
29
+ instruments=["NIFTY50", "BANKNIFTY", "HDFCBANK", "INFY", "TATASTEEL"],
30
+ n_scenarios=1000,
31
+ horizon_days=21,
32
+ )
33
+ # result.paths: (1000, 21, 5) daily log-returns
34
+ # result.prices: (1000, 22, 5) price paths
35
+ # result.var_95, result.expected_shortfall_95
36
+ ```
37
+
38
+ ## Architecture
39
+
40
+ - **Base**: Diffusion Transformer (DiT-1D), 172M parameters
41
+ - d_model=768, 16 axial attention blocks, 12 heads
42
+ - Alternating time-axis / asset-axis attention
43
+ - adaLN-Zero conditioning + cross-attention to event tokens
44
+ - **Causal Layer**: Backdoor-adjusted guidance with explicit causal graph
45
+ - 14 market nodes, 18 directed edges
46
+ - Per-channel guidance masking (prevents placebo bleed)
47
+ - Empirical calibration from 42 RBI rate events
48
+ - **Counterfactual**: DDIM inversion (100-step, 0.975 roundtrip correlation)
49
+ - **NL Interface**: 3-tier parser (regex → LLM → heuristic)
50
+
51
+ ## Key Results
52
+
53
+ ### CausalFinBench (Novel Benchmark)
54
+ | Tier | Tests | Result |
55
+ |------|-------|--------|
56
+ | A: World Properties | 5/5 | Consistency, Asymmetry, Compositionality, CF Coherence, Robustness |
57
+ | B: Causal Validity | 3/3 | Placebo 100%, Real effects 100%, Sensitivity monotonic |
58
+ | C: Natural Experiments | 1/1 | 42/42 RBI rate decisions — 100% direction match |
59
+
60
+ ### Calibration
61
+ | Intervention | Model Effect | Historical Actual |
62
+ |---|---|---|
63
+ | RBI rate cut | +0.40% | +0.41% (2.4% error) |
64
+ | RBI rate hike | -0.31% | -0.35% |
65
+ | India VIX spike | -0.72% | — |
66
+ | FII selling | -0.49% | — |
67
+ | Global risk-off | -0.44% | — |
68
+
69
+ ### Pearl's Causal Ladder
70
+ - **Level 1 (Association)**: Base DiT generates statistically valid paths
71
+ - **Level 2 (Intervention)**: do-operator via causal graph surgery + guided sampling
72
+ - **Level 3 (Counterfactual)**: DDIM inversion + action + prediction (verified on June 4, 2024 election)
73
+
74
+ ## Training Data
75
+
76
+ - 50 Nifty50 constituents × 26 years (2000-2026)
77
+ - 1.05M real news headlines from QLake
78
+ - 48 macro series (repo rate, CPI, VIX, yields, commodities, FX)
79
+ - 317,650 training windows
80
+
81
+ ## World Model Properties (5/5 PASS)
82
+
83
+ 1. **Consistency**: Same intervention + same noise → identical output
84
+ 2. **Causal Asymmetry**: do(rate_cut) ≠ do(nifty_rally) — different mechanisms (corr=0.47)
85
+ 3. **Compositionality**: Combined interventions produce combined effects (56% of linear sum)
86
+ 4. **Counterfactual Coherence**: Inversion roundtrip at 0.975 correlation
87
+ 5. **Robustness**: Extreme interventions (±10σ) remain finite and reasonable
88
+
89
+ ## Limitations
90
+
91
+ - **5 instruments per call** (can generate correlated paths for any 5 Nifty50 stocks)
92
+ - **Causal graph is hand-specified** (not learned from data)
93
+ - **Magnitude calibration** fitted from historical events — may not generalize to unprecedented scenarios
94
+ - **NL understanding via external parsing** — model itself does not natively understand text (v2 will fix this)
95
+ - **No options/derivatives pricing** (equity paths only)
96
+
97
+ ## Usage Requirements
98
+
99
+ - PyTorch >= 2.0
100
+ - ~700MB disk for checkpoint
101
+ - GPU recommended for inference (<30s on A100 for 1000 paths)
102
+ - CPU inference: ~20 minutes for 1000 paths
103
+
104
+ ## Citation
105
+
106
+ ```bibtex
107
+ @software{horizon_v1_2026,
108
+ title={Horizon: A Causal Financial World Model for Indian Markets},
109
+ author={QuantHive Research},
110
+ year={2026},
111
+ url={https://huggingface.co/QuantHive-Research-Tech/horizon-v1}
112
+ }
113
+ ```
114
+
115
+ ## License
116
+
117
+ Apache 2.0