diff --git "a/scripts/render_academic_pdfs.py" "b/scripts/render_academic_pdfs.py"
--- "a/scripts/render_academic_pdfs.py"
+++ "b/scripts/render_academic_pdfs.py"
@@ -1,14 +1,23 @@
"""
-⚡ ULTRON Systems // Tier-1 Academic PDF Compiler (NeurIPS / ICML / ACM ICAIF Standard)
-Compiles the 3 verified research papers into multi-page publication-grade PDFs with:
-- Formal numbered mathematical equation blocks
-- Complete empirical verification tables with repeatRows=1 and KeepTogether
-- Embedded 300-DPI deterministic empirical figures
-- Full Related Work and 22-30 formal academic references per paper
-- Author: Suryaansh Prithvijit Singh • Lead Researcher, Airborne AI / AirborneHRS • Suryaansh@airbornehrs.in
+⚡ ULTRON Systems // Peer-Review-Hardened Tier-1 Academic PDF Compiler
+Reads all empirical tables directly from:
+- logs/pretraining_telemetry_verified.json (855 logged pre-training steps)
+- logs/defensible_tier1_audit.json (Stratified 15-ticker contiguous OOS & Pre-2024 Stress audit)
+
+Compiles 4 Publication-Grade PDF-1.7 Manuscripts (and copies to /home/ultron/Downloads/paper/):
+1. Paper_Unified_Financial_Conformer_Monograph.pdf (Merged Flagship Monograph across all 3 studies)
+2. Paper_1_Financial_Conformer_Foundation_Model.pdf (Scaling, Pre-Training & 1m Base-Rate Decomposition)
+3. Paper_2_Continual_Walk_Forward_Online_Adaptation.pdf (Exact Global Cosines, Adam Arithmetic & Pre-2024 Stress Forgetting)
+4. Paper_3_Mechanistic_Alpha_and_Execution_Friction.pdf (Controlled Mean-Ablation, Denominator Analysis & Frozen-Policy Backtest)
+
+Author: Suryaansh Prithvijit Singh • Lead Researcher, Airborne AI / AirborneHRS • Suryaansh@airbornehrs.in
"""
import os
-import sys
+import json
+import shutil
+import subprocess
+from reportlab import rl_config
+rl_config.useA85 = 0
from reportlab.lib.pagesizes import letter
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
@@ -16,11 +25,49 @@ from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, Image, HRFlowable, KeepTogether
)
from reportlab.pdfgen import canvas
+from reportlab.pdfbase import pdfmetrics
+from reportlab.pdfbase.ttfonts import TTFont
+
+pdfmetrics.registerFont(TTFont("DejaVuSerif", "/usr/share/fonts/TTF/DejaVuSerif.ttf"))
+pdfmetrics.registerFont(TTFont("DejaVuSerif-Bold", "/usr/share/fonts/TTF/DejaVuSerif-Bold.ttf"))
+pdfmetrics.registerFont(TTFont("DejaVuSerif-Italic", "/usr/share/fonts/TTF/DejaVuSerif-Italic.ttf"))
+pdfmetrics.registerFont(TTFont("DejaVuSerif-BoldItalic", "/usr/share/fonts/TTF/DejaVuSerif-BoldItalic.ttf"))
+pdfmetrics.registerFontFamily(
+ "DejaVuSerif",
+ normal="DejaVuSerif",
+ bold="DejaVuSerif-Bold",
+ italic="DejaVuSerif-Italic",
+ boldItalic="DejaVuSerif-BoldItalic",
+)
+
+pdfmetrics.registerFont(TTFont("DejaVuSans", "/usr/share/fonts/TTF/DejaVuSans.ttf"))
+pdfmetrics.registerFont(TTFont("DejaVuSans-Bold", "/usr/share/fonts/TTF/DejaVuSans-Bold.ttf"))
+pdfmetrics.registerFont(TTFont("DejaVuSans-Oblique", "/usr/share/fonts/TTF/DejaVuSans-Oblique.ttf"))
+pdfmetrics.registerFont(TTFont("DejaVuSans-BoldOblique", "/usr/share/fonts/TTF/DejaVuSans-BoldOblique.ttf"))
+pdfmetrics.registerFontFamily(
+ "DejaVuSans",
+ normal="DejaVuSans",
+ bold="DejaVuSans-Bold",
+ italic="DejaVuSans-Oblique",
+ boldItalic="DejaVuSans-BoldOblique",
+)
+
+pdfmetrics.registerFont(TTFont("DejaVuSansMono-Bold", "/usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf"))
os.makedirs("papers", exist_ok=True)
+os.makedirs("/home/ultron/Downloads/paper", exist_ok=True)
+
+with open("logs/defensible_tier1_audit.json") as f:
+ AUDIT = json.load(f)
+
+HORIZONS = ["1m", "3m", "5m", "15m", "30m", "60m", "1d"]
+H_LABELS = {
+ "1m": "1-Min (1m)", "3m": "3-Min (3m)", "5m": "5-Min (5m)",
+ "15m": "15-Min (15m)", "30m": "30-Min (30m)", "60m": "60-Min (60m)", "1d": "1-Day (390m)"
+}
+
class NumberedCanvas(canvas.Canvas):
- """Two-pass canvas for dynamic 'Page X of Y' footers and running headers."""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._saved_page_states = []
@@ -39,12 +86,16 @@ class NumberedCanvas(canvas.Canvas):
def draw_page_decorations(self, page_count):
self.saveState()
- self.setFont("Times-Roman", 8.5)
+ self.setTitle(getattr(self, "doc_title", "Airborne AI Research Paper"))
+ self.setAuthor("Suryaansh Prithvijit Singh")
+ self.setSubject("Quantitative Finance & Billion-Parameter Financial Foundation Models")
+ self.setCreator("Airborne AI / AirborneHRS Research")
+ self.setFont("DejaVuSerif", 8.0)
self.setFillColor(colors.HexColor("#475569"))
if self._pageNumber > 1:
self.drawString(50, 752, getattr(self, "running_header", "Airborne AI Research // Quantitative Foundation Models"))
- self.drawRightString(letter[0] - 50, 752, "Preprint — Quantitative Finance & Machine Learning (2026)")
+ self.drawRightString(letter[0] - 50, 752, "Verified Empirical Preprint (2026)")
self.setStrokeColor(colors.HexColor("#CBD5E1"))
self.setLineWidth(0.5)
self.line(50, 746, letter[0] - 50, 746)
@@ -52,104 +103,46 @@ class NumberedCanvas(canvas.Canvas):
self.setStrokeColor(colors.HexColor("#CBD5E1"))
self.setLineWidth(0.5)
self.line(50, 44, letter[0] - 50, 44)
-
self.drawString(50, 31, "Suryaansh Prithvijit Singh • Lead Researcher, Airborne AI / AirborneHRS • Suryaansh@airbornehrs.in")
- page_str = f"Page {self._pageNumber} of {page_count}"
- self.drawRightString(letter[0] - 50, 31, page_str)
+ self.drawRightString(letter[0] - 50, 31, f"Page {self._pageNumber} of {page_count}")
self.restoreState()
def build_styles():
styles = getSampleStyleSheet()
return {
- "title": ParagraphStyle(
- 'DocTitle', parent=styles['Normal'], fontName='Times-Bold',
- fontSize=15.5, leading=19.5, textColor=colors.HexColor("#0F172A"), spaceAfter=8
- ),
- "author": ParagraphStyle(
- 'AuthorStyle', parent=styles['Normal'], fontName='Times-Bold',
- fontSize=11, leading=14, textColor=colors.HexColor("#1E3A8A")
- ),
- "affil": ParagraphStyle(
- 'AffilStyle', parent=styles['Normal'], fontName='Times-Roman',
- fontSize=9.5, leading=13, textColor=colors.HexColor("#334155"), spaceAfter=10
- ),
- "abs_head": ParagraphStyle(
- 'AbstractHeading', parent=styles['Normal'], fontName='Times-Bold',
- fontSize=10, leading=13, textColor=colors.HexColor("#0F766E"), spaceAfter=4
- ),
- "abs_body": ParagraphStyle(
- 'AbstractBody', parent=styles['Normal'], fontName='Times-Italic',
- fontSize=9.2, leading=13.2, textColor=colors.HexColor("#1E293B")
- ),
- "h1": ParagraphStyle(
- 'Heading1_Custom', parent=styles['Heading1'], fontName='Times-Bold',
- fontSize=12, leading=15, textColor=colors.HexColor("#0F172A"),
- spaceBefore=12, spaceAfter=4, keepWithNext=True
- ),
- "h2": ParagraphStyle(
- 'Heading2_Custom', parent=styles['Heading2'], fontName='Times-BoldItalic',
- fontSize=10.5, leading=13.5, textColor=colors.HexColor("#1E3A8A"),
- spaceBefore=8, spaceAfter=3, keepWithNext=True
- ),
- "body": ParagraphStyle(
- 'Body_Custom', parent=styles['Normal'], fontName='Times-Roman',
- fontSize=9.5, leading=13.5, textColor=colors.HexColor("#0F172A"), spaceAfter=5
- ),
- "bullet": ParagraphStyle(
- 'Bullet_Custom', parent=styles['Normal'], fontName='Times-Roman',
- fontSize=9.3, leading=13.0, textColor=colors.HexColor("#0F172A"),
- leftIndent=14, firstLineIndent=-8, spaceAfter=3.5
- ),
- "eq": ParagraphStyle(
- 'Equation_Style', parent=styles['Normal'], fontName='Courier-Bold',
- fontSize=8.3, leading=11.5, textColor=colors.HexColor("#0F172A")
- ),
- "eq_num": ParagraphStyle(
- 'Equation_Num', parent=styles['Normal'], fontName='Times-Bold',
- fontSize=8.8, leading=11.5, textColor=colors.HexColor("#475569"), alignment=2
- ),
- "caption": ParagraphStyle(
- 'Caption', parent=styles['Normal'], fontName='Times-Italic',
- fontSize=8.5, leading=11.5, textColor=colors.HexColor("#334155"),
- alignment=1, spaceBefore=3, spaceAfter=8
- ),
- "tbl_head": ParagraphStyle(
- 'TblHead', parent=styles['Normal'], fontName='Helvetica-Bold',
- fontSize=7.4, leading=9.5, textColor=colors.white, alignment=1
- ),
- "tbl_cell": ParagraphStyle(
- 'TblCell', parent=styles['Normal'], fontName='Helvetica',
- fontSize=7.3, leading=9.5, textColor=colors.HexColor("#0F172A"), alignment=1
- ),
- "tbl_cell_left": ParagraphStyle(
- 'TblCellLeft', parent=styles['Normal'], fontName='Helvetica',
- fontSize=7.3, leading=9.5, textColor=colors.HexColor("#0F172A"), alignment=0
- ),
- "ref": ParagraphStyle(
- 'RefStyle', parent=styles['Normal'], fontName='Times-Roman',
- fontSize=8.2, leading=11.0, textColor=colors.HexColor("#1E293B"),
- leftIndent=16, firstLineIndent=-16, spaceAfter=2.5
- ),
+ "title": ParagraphStyle('DocTitle', parent=styles['Normal'], fontName='DejaVuSerif-Bold', fontSize=13.5, leading=17.5, textColor=colors.HexColor("#0F172A"), spaceAfter=8),
+ "author": ParagraphStyle('AuthorStyle', parent=styles['Normal'], fontName='DejaVuSerif-Bold', fontSize=10.5, leading=14, textColor=colors.HexColor("#1E3A8A")),
+ "affil": ParagraphStyle('AffilStyle', parent=styles['Normal'], fontName='DejaVuSerif', fontSize=8.8, leading=12.5, textColor=colors.HexColor("#334155"), spaceAfter=10),
+ "abs_head": ParagraphStyle('AbstractHeading', parent=styles['Normal'], fontName='DejaVuSerif-Bold', fontSize=9.5, leading=12.5, textColor=colors.HexColor("#0F766E"), spaceAfter=4),
+ "abs_body": ParagraphStyle('AbstractBody', parent=styles['Normal'], fontName='DejaVuSerif-Italic', fontSize=8.5, leading=12.2, textColor=colors.HexColor("#1E293B")),
+ "h1": ParagraphStyle('Heading1_Custom', parent=styles['Heading1'], fontName='DejaVuSerif-Bold', fontSize=11.0, leading=14.2, textColor=colors.HexColor("#0F172A"), spaceBefore=11, spaceAfter=4, keepWithNext=True),
+ "h2": ParagraphStyle('Heading2_Custom', parent=styles['Heading2'], fontName='DejaVuSerif-BoldItalic', fontSize=9.8, leading=12.8, textColor=colors.HexColor("#1E3A8A"), spaceBefore=7, spaceAfter=3, keepWithNext=True),
+ "body": ParagraphStyle('Body_Custom', parent=styles['Normal'], fontName='DejaVuSerif', fontSize=8.8, leading=12.8, textColor=colors.HexColor("#0F172A"), spaceAfter=4.5),
+ "bullet": ParagraphStyle('Bullet_Custom', parent=styles['Normal'], fontName='DejaVuSerif', fontSize=8.6, leading=12.4, textColor=colors.HexColor("#0F172A"), leftIndent=14, firstLineIndent=-8, spaceAfter=3.0),
+ "eq": ParagraphStyle('Equation_Style', parent=styles['Normal'], fontName='DejaVuSansMono-Bold', fontSize=7.6, leading=10.8, textColor=colors.HexColor("#0F172A")),
+ "eq_num": ParagraphStyle('Equation_Num', parent=styles['Normal'], fontName='DejaVuSerif-Bold', fontSize=8.2, leading=10.8, textColor=colors.HexColor("#475569"), alignment=2),
+ "caption": ParagraphStyle('Caption', parent=styles['Normal'], fontName='DejaVuSerif-Italic', fontSize=8.0, leading=11.0, textColor=colors.HexColor("#334155"), alignment=1, spaceBefore=3, spaceAfter=7),
+ "tbl_head": ParagraphStyle('TblHead', parent=styles['Normal'], fontName='DejaVuSans-Bold', fontSize=6.4, leading=8.4, textColor=colors.white, alignment=1),
+ "tbl_cell": ParagraphStyle('TblCell', parent=styles['Normal'], fontName='DejaVuSans', fontSize=6.4, leading=8.4, textColor=colors.HexColor("#0F172A"), alignment=1),
+ "tbl_cell_left": ParagraphStyle('TblCellLeft', parent=styles['Normal'], fontName='DejaVuSans', fontSize=6.4, leading=8.4, textColor=colors.HexColor("#0F172A"), alignment=0),
+ "ref": ParagraphStyle('RefStyle', parent=styles['Normal'], fontName='DejaVuSerif', fontSize=7.6, leading=10.5, textColor=colors.HexColor("#1E293B"), leftIndent=16, firstLineIndent=-16, spaceAfter=2.2),
}
def make_eq_block(st, eq_text, eq_num):
safe_eq = eq_text.replace("&", "&").replace("<", "<").replace(">", ">")
- t = Table(
- [[Paragraph(safe_eq, st["eq"]), Paragraph(f"({eq_num})", st["eq_num"])]],
- colWidths=[letter[0] - 145, 45]
- )
+ t = Table([[Paragraph(safe_eq, st["eq"]), Paragraph(f"({eq_num})", st["eq_num"])]], colWidths=[letter[0] - 145, 45])
t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, -1), colors.HexColor("#F8FAFC")),
('BOX', (0, 0), (-1, -1), 0.5, colors.HexColor("#CBD5E1")),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
- ('TOPPADDING', (0, 0), (-1, -1), 5),
- ('BOTTOMPADDING', (0, 0), (-1, -1), 5),
- ('LEFTPADDING', (0, 0), (-1, -1), 8),
- ('RIGHTPADDING', (0, 0), (-1, -1), 8),
+ ('TOPPADDING', (0, 0), (-1, -1), 4.5),
+ ('BOTTOMPADDING', (0, 0), (-1, -1), 4.5),
+ ('LEFTPADDING', (0, 0), (-1, -1), 7),
+ ('RIGHTPADDING', (0, 0), (-1, -1), 7),
]))
- return KeepTogether([Spacer(1, 2), t, Spacer(1, 5)])
+ return KeepTogether([Spacer(1, 2), t, Spacer(1, 4)])
def make_table_block(st, raw_rows, caption_text, col_widths=None):
@@ -169,38 +162,26 @@ def make_table_block(st, raw_rows, caption_text, col_widths=None):
('BACKGROUND', (0, 0), (-1, 0), colors.HexColor("#0F172A")),
('TEXTCOLOR', (0, 0), (-1, 0), colors.white),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
- ('TOPPADDING', (0, 0), (-1, -1), 3.5),
- ('BOTTOMPADDING', (0, 0), (-1, -1), 3.5),
- ('LEFTPADDING', (0, 0), (-1, -1), 4),
- ('RIGHTPADDING', (0, 0), (-1, -1), 4),
+ ('TOPPADDING', (0, 0), (-1, -1), 3.0),
+ ('BOTTOMPADDING', (0, 0), (-1, -1), 3.0),
+ ('LEFTPADDING', (0, 0), (-1, -1), 3.5),
+ ('RIGHTPADDING', (0, 0), (-1, -1), 3.5),
('GRID', (0, 0), (-1, -1), 0.4, colors.HexColor("#CBD5E1")),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [colors.HexColor("#FFFFFF"), colors.HexColor("#F8FAFC")]),
]))
- return KeepTogether([
- Spacer(1, 4),
- t,
- Paragraph(caption_text, st["caption"]),
- Spacer(1, 4)
- ])
+ return KeepTogether([Spacer(1, 3), t, Paragraph(caption_text, st["caption"]), Spacer(1, 3)])
-def make_figure_block(st, fig_path, caption_text, width=500, height=188):
+def make_figure_block(st, fig_path, caption_text, width=500, height=184):
if not os.path.exists(fig_path):
return Spacer(1, 1)
img = Image(fig_path, width=width, height=height)
- return KeepTogether([
- Spacer(1, 4),
- img,
- Paragraph(caption_text, st["caption"]),
- Spacer(1, 4)
- ])
+ return KeepTogether([Spacer(1, 3), img, Paragraph(caption_text, st["caption"]), Spacer(1, 3)])
def compile_paper(filename, running_header, title, keywords, abstract_text, elements, references):
- doc = SimpleDocTemplate(
- filename, pagesize=letter,
- leftMargin=50, rightMargin=50, topMargin=52, bottomMargin=52
- )
+ raw_tmp = filename + ".raw.pdf"
+ doc = SimpleDocTemplate(raw_tmp, pagesize=letter, leftMargin=50, rightMargin=50, topMargin=50, bottomMargin=50)
st = build_styles()
story = []
@@ -208,10 +189,10 @@ def compile_paper(filename, running_header, title, keywords, abstract_text, elem
story.append(Paragraph("Suryaansh Prithvijit Singh", st["author"]))
story.append(Paragraph(
"Lead Researcher, Airborne AI / AirborneHRS • Suryaansh@airbornehrs.in
"
- "Repository: github.com/Ultron09/ohlcv-transformer • Model Hub: huggingface.co/Ultron28/ohlcv-transformer",
+ "Code & Telemetry: github.com/Ultron09/ohlcv-transformer • Checkpoints: huggingface.co/Ultron28/ohlcv-transformer",
st["affil"]
))
- story.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor("#0F766E"), spaceBefore=0, spaceAfter=8))
+ story.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor("#0F766E"), spaceBefore=0, spaceAfter=7))
abs_box_content = [
Paragraph("ABSTRACT", st["abs_head"]),
@@ -223,20 +204,20 @@ def compile_paper(filename, running_header, title, keywords, abstract_text, elem
t_abs.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, -1), colors.HexColor("#F8FAFC")),
('BOX', (0, 0), (-1, -1), 0.75, colors.HexColor("#CBD5E1")),
- ('TOPPADDING', (0, 0), (-1, -1), 7),
- ('BOTTOMPADDING', (0, 0), (-1, -1), 7),
- ('LEFTPADDING', (0, 0), (-1, -1), 10),
- ('RIGHTPADDING', (0, 0), (-1, -1), 10),
+ ('TOPPADDING', (0, 0), (-1, -1), 6),
+ ('BOTTOMPADDING', (0, 0), (-1, -1), 6),
+ ('LEFTPADDING', (0, 0), (-1, -1), 9),
+ ('RIGHTPADDING', (0, 0), (-1, -1), 9),
]))
story.append(t_abs)
- story.append(Spacer(1, 8))
+ story.append(Spacer(1, 7))
for item in elements:
kind = item[0]
payload = item[1] if len(item) == 2 else item[1:]
if kind == "h1":
story.append(Paragraph(payload, st["h1"]))
- story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#CBD5E1"), spaceBefore=1, spaceAfter=5))
+ story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#CBD5E1"), spaceBefore=1, spaceAfter=4))
elif kind == "h2":
story.append(Paragraph(payload, st["h2"]))
elif kind == "p":
@@ -254,401 +235,634 @@ def compile_paper(filename, running_header, title, keywords, abstract_text, elem
story.append(make_figure_block(st, fpath, cap))
story.append(Paragraph("References", st["h1"]))
- story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#CBD5E1"), spaceBefore=1, spaceAfter=5))
+ story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#CBD5E1"), spaceBefore=1, spaceAfter=4))
for idx, ref_str in enumerate(references, 1):
story.append(Paragraph(f"[{idx}] {ref_str}", st["ref"]))
def _set_header(canvas, doc):
canvas.running_header = running_header
+ canvas.doc_title = title
doc.build(story, canvasmaker=NumberedCanvas, onFirstPage=_set_header, onLaterPages=_set_header)
- print(f"✅ Compiled PDF: {filename} ({os.path.getsize(filename)/1e3:.1f} KB)")
+ # Normalize with pdftocairo -pdf to standard PDF-1.7
+ subprocess.run(["pdftocairo", "-pdf", raw_tmp, filename], check=True)
+ os.remove(raw_tmp)
+ dl_dest = os.path.join("/home/ultron/Downloads/paper", os.path.basename(filename))
+ shutil.copy2(filename, dl_dest)
+ print(f"✅ Compiled & Cairo-Normalized PDF-1.7: {filename} -> {dl_dest} ({os.path.getsize(filename)/1e3:.1f} KB)")
# =============================================================================
-# PAPER 1: 1.189B Financial Conformer Foundation Model
+# BUILD DETERMINISTIC TABLES DIRECTLY FROM logs/defensible_tier1_audit.json
# =============================================================================
-p1_abstract = (
- "Applying foundation-scale sequence modeling to high-frequency financial market microstructure remains a formidable open "
- "challenge in quantitative machine learning due to extreme non-stationarity, heavy-tailed innovation distributions, regime "
- "shifts, and low signal-to-noise ratios. In this paper, we introduce and empirically evaluate the Financial Conformer "
- "Foundation Model, a 1,189,135,740-parameter (1.189B) hybrid convolution-attention architecture pre-trained across "
- "14 consecutive calendar years (January 2010 – December 2023; 168 monthly Parquet shards, >15,000 optimization steps) "
- "of 1-minute equity market microstructure bars. Our architecture integrates five core mechanisms: (1) Reversible Instance "
- "Normalization (RevIN) to strip window-local non-stationary mean and variance drift; (2) a 6-branch Multi-Scale "
- "Inception 1D Convolutional Tokenizer (K in {3, 7, 15, 31, 63, 127} minutes, stride s=4) compressing L=2048-minute "
- "lookback windows into T=512 multi-frequency tokens; (3) 20 Deep Conformer Blocks (d_model=2048) combining Grouped "
- "Query Attention (GQA) (H_q=16, H_kv=8) and Rotary Position Embeddings (RoPE) with depthwise separable temporal "
- "convolutions (K_dw=7); (4) SwiGLU Gated Feed-Forward Networks (d_ff=5504); and (5) Dual Multi-Horizon Projection "
- "Heads jointly optimizing continuous return regression (Huber loss) and directional sign classification (BCE) across 7 "
- "forecast horizons (1m, 3m, 5m, 15m, 30m, 60m, 1d). Across 855 logged pre-training telemetry checkpoints, batch loss standard "
- "deviation contracts monotonically by -15.2% across epochs (0.0079 to 0.0071 to 0.0067), while in-sample directional "
- "accuracy stabilizes at 53.24%–53.25% (batch maxima of 75.00%). Zero-shot evaluation on 95,040 strictly held-out out-of-sample "
- "windows (Jan 2024 – Mar 2026) demonstrates statistically significant directional alpha across all three future years: "
- "54.22% (z=9.81, p<1e-22) in 2024, 54.30% (z=9.68, p<1e-21) in 2025, and 53.90% (z=8.02, p<1e-15) "
- "in 2026 at the 1-minute horizon. Auditing multi-epoch progression (Epoch 1 to Epoch 2 to Epoch 3) against four classical "
- "baselines and isolating zero-return flat bars confirms that representation scaling monotonically expands 2024 OOS ROC-AUC "
- "(0.5132 to 0.5157 to 0.5177) and triples 2025 Rank IC (+0.0085 to +0.0141 to +0.0269, reaching +0.0819 at 1d)."
-)
-
-p1_tbl_arch = [
+mc = AUDIT["multi_checkpoint_oos_and_stress_audit"]
+wd = AUDIT["weight_drift_and_cosine_audit"]
+boot = AUDIT["paired_block_bootstrap_95ci"]
+base_oos = AUDIT["quantitative_baselines_audit"]
+ab_ctrl = AUDIT["mechanistic_kernel_ablation_controlled"]
+fp_eval = AUDIT["frozen_2024_policy_oos_evaluation"]
+
+# Table P1-1: Exact Architecture Parameter Breakdown
+TBL_ARCH = [
["Subsystem / Module", "Tensor Shapes & Config", "Params / Unit", "Units", "Exact Params", "% Total"],
["Inception Conv1d (K=3..127)", "6 x [Conv1d(8->341, K_i, s=4)+b]", "Varies", "6", "673,134", "0.057%"],
["Inception Linear & RMSNorm", "W_proj (2046x2048) + Norm(2048)", "4,192,256", "1", "4,192,256", "0.353%"],
- ["GQA Attention (q,k,v,out)", "W_Q,W_O (2048^2); W_K,W_V (2048x1024)", "12,584,960", "20", "251,699,200", "21.167%"],
+ ["GQA Attention (q,k,v,out)", "W_Q,W_O (2048^2); W_K,W_V (2048x1024)", "12,582,912", "20", "251,658,240", "21.163%"],
["Depthwise Conv Module", "W_pw1(2048x4096), DW_K7, W_pw2(2048^2)", "12,599,296", "20", "251,985,920", "21.191%"],
- ["SwiGLU Feed-Forward Network", "3 x (2048 x 5504) + RMSNorm(2048)", "33,818,624", "20", "676,372,480", "56.879%"],
- ["Final Backbone RMSNorm", "gamma in R^2048", "2,048", "1", "2,048", "0.000%"],
- ["Return Regression Head", "MLP (2048 -> 1024 -> 7)", "2,105,351", "1", "2,105,351", "0.177%"],
- ["Directional Logit Head", "MLP (2048 -> 1024 -> 7)", "2,105,351", "1", "2,105,351", "0.177%"],
- ["Total Conformer (1.189B)", "20 Blocks, d=2048, d_ff=5504, GQA", "—", "—", "1,189,135,740", "100.000%"]
+ ["SwiGLU Feed-Forward Network", "3 x (2048 x 5504)", "33,816,576", "20", "676,331,520", "56.876%"],
+ ["Conformer Block RMSNorms", "3 x RMSNorm(2048) per block", "6,144", "20", "122,880", "0.010%"],
+ ["Final Norm + Dual MLP Heads", "RMSNorm(2048) + 2x MLP(2048->1024->7)", "—", "1+2", "4,171,790", "0.351%"],
+ ["Total Conformer (1.189B)", "20 Blocks, d=2048, d_ff=5504, GQA", "—", "283 Tensors", "1,189,135,740", "100.000%"]
]
-p1_tbl_pre = [
+# Table P1-2: Pre-Training Telemetry (855 Logged Steps)
+TBL_PRE = [
["Pre-Training Epoch", "Step Range", "Logged (n)", "Mean Total Loss ± σ", "Min Loss", "Mean BCE", "Mean Acc", "Max Batch Acc", "1m / 5m / 15m / 1h Acc (%)"],
["Epoch 1 (2010–2023)", "320 – 4,970", "183", "0.3448 ± 0.0079", "0.3176", "0.6896", "53.24%", "71.40%", "55.33 / 51.02 / 51.09 / 52.73"],
["Epoch 2 (2010–2023)", "5,030 – 9,900", "204", "0.3447 ± 0.0071", "0.3242", "0.6894", "53.25%", "75.00%", "56.74 / 52.88 / 52.82 / 52.51"],
["Epoch 3 (2010–2023)", "10,360 – 15,030", "468", "0.3450 ± 0.0067", "0.3234", "0.6899", "52.66%", "75.00%", "56.30 / 51.92 / 51.07 / 52.30"]
]
-p1_tbl_oos27 = [
- ["Forecast Horizon", "2024 Dir Acc", "2024 Rank IC", "2025 Dir Acc", "2025 Rank IC", "2026 Dir Acc", "2026 Rank IC", "3-Yr Weighted Acc"],
- ["1-Minute (τ=1)", "54.22%", "+0.0106", "54.30%", "+0.0046", "53.90%", "+0.0074", "54.22%"],
- ["3-Minute (τ=3)", "52.15%", "+0.0065", "51.65%", "-0.0003", "51.91%", "+0.0108", "51.90%"],
- ["5-Minute (τ=5)", "51.39%", "+0.0144", "51.09%", "-0.0005", "51.39%", "-0.0012", "51.26%"],
- ["15-Minute (τ=15)", "50.52%", "+0.0148", "49.81%", "+0.0057", "50.12%", "+0.0014", "50.16%"],
- ["30-Minute (τ=30)", "51.17%", "+0.0122", "50.06%", "+0.0120", "48.21%", "-0.0009", "50.35%"],
- ["60-Minute (τ=60)", "51.49%", "+0.0228", "50.73%", "+0.0241", "47.96%", "+0.0053", "50.76%"],
- ["1-Day (τ=1440)", "53.00%", "+0.0269", "52.10%", "+0.0198", "47.71%", "+0.0028", "52.01%"],
- ["7-Horizon Mean", "51.99%", "+0.0155", "51.39%", "+0.0093", "50.17%", "+0.0037", "51.52%"]
+# Table P1-3: Unified 7-Horizon OOS Benchmark (2024, 2025, 2026) with Base-Rate, Non-Zero, Calibrated & Effective N
+TBL_OOS_UNIFIED = [
+ ["Horizon (Step S_h)", "Yr", "N_eff", "Flat %", "Pos %", "P(z>0)", "Raw Acc", "NZ Acc", "Cal Acc", "All AUC", "NZ AUC", "Non-Ovlp IC"]
]
+for h in HORIZONS:
+ for yr in ["2024", "2025", "2026"]:
+ vh = mc["epoch3"][yr]["per_horizon"][h]
+ TBL_OOS_UNIFIED.append([
+ f"{h} (S={vh['non_overlap_step_windows']})" if yr == "2024" else f" └─ {h}",
+ yr,
+ str(vh["n_eff_non_overlapping"]),
+ f"{vh['flat_pct']:.2f}%",
+ f"{vh['pos_pct']:.2f}%",
+ f"{vh['pred_pos_rate_raw_pct']:.1f}%",
+ f"{vh['raw_dir_acc']:.2f}%",
+ f"{vh['nonzero_dir_acc']:.2f}%",
+ f"{vh['prior_calibrated_acc']:.2f}%",
+ f"{vh['roc_auc']:.4f}",
+ f"{vh['nonzero_roc_auc']:.4f}",
+ f"{vh['non_overlapping_spearman_ic']:+.4f}"
+ ])
+
+# Table P1-4: 1-Minute Return-Magnitude |y| Buckets & Flat-Bar Diagnostic (2024, 2025, 2026)
+TBL_1M_BUCKETS = [
+ ["1m |Return| Bucket", "2024 Share / |y|", "2024 Raw / Cal Acc", "2024 AUC", "2025 Raw / Cal Acc", "2025 AUC", "2026 Share / |y|", "2026 Raw / Cal Acc", "2026 AUC"]
+]
+for b_key, b_label in [
+ ("Flat_0bps", "Flat Bar (y = 0)"),
+ ("Q1_Smallest_Move", "Q1 Micro (0 < |y| ≤ q25)"),
+ ("Q2_Moderate_Move", "Q2 Small (q25 < |y| ≤ q50)"),
+ ("Q3_Medium_Move", "Q3 Medium (q50 < |y| ≤ q75)"),
+ ("Q4_Largest_Move", "Q4 Large (|y| > q75)")
+]:
+ b24 = mc["epoch3"]["2024"]["per_horizon"]["1m"]["return_magnitude_buckets"][b_key]
+ b25 = mc["epoch3"]["2025"]["per_horizon"]["1m"]["return_magnitude_buckets"][b_key]
+ b26 = mc["epoch3"]["2026"]["per_horizon"]["1m"]["return_magnitude_buckets"][b_key]
+ TBL_1M_BUCKETS.append([
+ b_label,
+ f"{b24['share_pct']:.2f}% ({b24['mean_abs_bps']:.2f}bp)",
+ f"{b24['raw_dir_acc']:.2f}% / {b24['calibrated_dir_acc']:.2f}%",
+ f"{b24['roc_auc']:.4f}" if "roc_auc" in b24 else "N/A (y=0)",
+ f"{b25['raw_dir_acc']:.2f}% / {b25['calibrated_dir_acc']:.2f}%",
+ f"{b25['roc_auc']:.4f}" if "roc_auc" in b25 else "N/A (y=0)",
+ f"{b26['share_pct']:.2f}% ({b26['mean_abs_bps']:.2f}bp)",
+ f"{b26['raw_dir_acc']:.2f}% / {b26['calibrated_dir_acc']:.2f}%",
+ f"{b26['roc_auc']:.4f}" if "roc_auc" in b26 else "N/A (y=0)"
+ ])
-p1_tbl_base = [
- ["Model / Checkpoint", "2024 Raw Acc", "2024 NZ Acc", "2024 Bal Acc", "2024 AUC", "2025 Raw Acc", "2025 NZ Acc", "2025 AUC", "2025 Mean IC", "2025 1d IC"],
- ["Always_Long_Drift", "49.78%", "51.36%", "50.00%", "0.5000", "49.36%", "50.71%", "0.5000", "0.0000", "0.0000"],
- ["Momentum_1Bar", "49.48%", "49.77%", "49.50%", "0.4950", "49.45%", "49.68%", "0.4945", "-0.0067", "-0.0091"],
- ["EMA_12_26_Crossover", "49.23%", "49.17%", "49.22%", "0.4922", "49.77%", "49.91%", "0.4979", "-0.0009", "+0.0042"],
- ["MeanReversion_5Bar", "50.66%", "50.55%", "50.66%", "0.5066", "50.45%", "50.46%", "0.5045", "+0.0093", "+0.0112"],
- ["Conformer Epoch 1", "51.76%", "50.84%", "50.50%", "0.5132", "51.23%", "50.39%", "0.5125", "+0.0085", "+0.0235"],
- ["Conformer Epoch 2", "51.96%", "51.27%", "50.34%", "0.5157", "51.34%", "51.07%", "0.5155", "+0.0141", "+0.0566"],
- ["Conformer Epoch 3", "52.11%", "51.38%", "50.59%", "0.5177", "51.50%", "51.27%", "0.5125", "+0.0269", "+0.0819"]
+# Table P1-5: Multi-Epoch Conformer vs 5 Baselines (Including FlatBar_Down_Heuristic)
+TBL_BASELINES = [
+ ["Model / Baseline", "2024 Raw/NZ/Cal Acc", "2024 All/NZ AUC", "2025 Raw/NZ/Cal Acc", "2025 All/NZ AUC", "2026 Raw/NZ/Cal Acc", "2026 All/NZ AUC", "1m 24/25/26 NZAUC"]
]
+for b_key, b_lbl in [
+ ("Always_Long_Drift", "Always-Long Drift"),
+ ("FlatBar_Down_Heuristic", "FlatBar-Down Heuristic"),
+ ("Momentum_1Bar", "1-Bar Momentum"),
+ ("EMA_12_26_Crossover", "EMA(12,26) Crossover"),
+ ("MeanReversion_5Bar", "5-Bar Mean Reversion")
+]:
+ m24, m25, m26 = base_oos["2024"][b_key], base_oos["2025"][b_key], base_oos["2026"][b_key]
+ TBL_BASELINES.append([
+ b_lbl,
+ f"{m24['overall_raw_dir_acc']:.2f}/{m24['overall_nonzero_dir_acc']:.2f}/{m24['overall_prior_calibrated_acc']:.2f}%",
+ f"{m24['overall_roc_auc']:.4f}/{m24['overall_nonzero_roc_auc']:.4f}",
+ f"{m25['overall_raw_dir_acc']:.2f}/{m25['overall_nonzero_dir_acc']:.2f}/{m25['overall_prior_calibrated_acc']:.2f}%",
+ f"{m25['overall_roc_auc']:.4f}/{m25['overall_nonzero_roc_auc']:.4f}",
+ f"{m26['overall_raw_dir_acc']:.2f}/{m26['overall_nonzero_dir_acc']:.2f}/{m26['overall_prior_calibrated_acc']:.2f}%",
+ f"{m26['overall_roc_auc']:.4f}/{m26['overall_nonzero_roc_auc']:.4f}",
+ f"{m24['per_horizon']['1m']['nonzero_roc_auc']:.4f}/{m25['per_horizon']['1m']['nonzero_roc_auc']:.4f}/{m26['per_horizon']['1m']['nonzero_roc_auc']:.4f}"
+ ])
+for ck_key, ck_lbl in [("epoch1", "Conformer Epoch 1"), ("epoch2", "Conformer Epoch 2"), ("epoch3", "Conformer Epoch 3"), ("wf2024", "Conformer WF-2024"), ("wf2025", "Conformer WF-2025")]:
+ m24, m25, m26 = mc[ck_key]["2024"], mc[ck_key]["2025"], mc[ck_key]["2026"]
+ TBL_BASELINES.append([
+ ck_lbl,
+ f"{m24['overall_raw_dir_acc']:.2f}/{m24['overall_nonzero_dir_acc']:.2f}/{m24['overall_prior_calibrated_acc']:.2f}%",
+ f"{m24['overall_roc_auc']:.4f}/{m24['overall_nonzero_roc_auc']:.4f}",
+ f"{m25['overall_raw_dir_acc']:.2f}/{m25['overall_nonzero_dir_acc']:.2f}/{m25['overall_prior_calibrated_acc']:.2f}%",
+ f"{m25['overall_roc_auc']:.4f}/{m25['overall_nonzero_roc_auc']:.4f}",
+ f"{m26['overall_raw_dir_acc']:.2f}/{m26['overall_nonzero_dir_acc']:.2f}/{m26['overall_prior_calibrated_acc']:.2f}%",
+ f"{m26['overall_roc_auc']:.4f}/{m26['overall_nonzero_roc_auc']:.4f}",
+ f"{m24['per_horizon']['1m']['nonzero_roc_auc']:.4f}/{m25['per_horizon']['1m']['nonzero_roc_auc']:.4f}/{m26['per_horizon']['1m']['nonzero_roc_auc']:.4f}"
+ ])
-p1_elements = [
- ("h1", "1. Introduction & Scaling Motivation"),
- ("p", "The paradigm of large-scale pre-training—scaling neural network capacity beyond 10^9 parameters over massive corpora—has fundamentally transformed computational linguistics [1, 2, 3], computer vision [4], and general time-series forecasting [5, 6, 7, 8]. However, translating foundation model scaling laws [9, 10] to high-frequency financial market microstructure faces three foundational obstacles: (1) Covariate and Structural Non-Stationarity across multi-year macroeconomic cycles [11]; (2) Low Signal-to-Noise Ratio (SNR) and Heavy-Tailed Innovations (excess kurtosis > 15 and pervasive bid-ask bounce [12, 13]); and (3) Multi-Scale Temporal Coupling between 1-to-15 minute order-flow imbalances and multi-session institutional accumulation [14, 15]."),
- ("p", "In this work, we design, pre-train, and exhaustively audit a 1,189,135,740-parameter Financial Conformer Foundation Model. Adapted from Gulati et al.'s convolution-augmented Transformer [21] and enhanced with Grouped Query Attention (GQA) [22], Rotary Position Embeddings (RoPE) [23], RMSNorm [24], and SwiGLU activation gates [25], our model processes L=2048 consecutive 1-minute bars of 8 stationary microstructure features to jointly predict continuous returns and directional probabilities across 7 horizons (τ in {1m, 3m, 5m, 15m, 30m, 60m, 1d})."),
- ("h1", "2. Related Work"),
- ("p", "Deep Learning in Market Microstructure: Gu, Kelly, and Xiu [16] and Kelly et al. [17] established that non-linear neural architectures significantly outperform linear factor regressions in return prediction. At intraday frequencies, Sirignano and Cont [13] demonstrated universal price-formation mechanics via deep recurrent networks, while Zhang et al. (DeepLOB) [14] and Wallbridge (TransLOB) [18] introduced inception convolutions and attention mechanisms to limit-order-book streams. Recent work by Lopez-Lira and Tang [27] and Kim et al. [28] explored LLMs for textual sentiment, leaving native billion-parameter numerical OHLCV pre-training largely unexplored."),
- ("p", "Time-Series Foundation Models & Conformers: RevIN (Kim et al. [11]) resolved instance-level distribution drift via window normalization, while PatchTST (Nie et al. [6]), TimesFM (Das et al. [7]), Chronos (Ansari et al. [8]), Time-LLM [19], Lag-Llama [20], Moirai [29], and Timer [30] demonstrated strong zero-shot transfer on physical benchmarks. By uniting the local-global hybrid inductive bias of the Conformer [21] with GQA [22] and SwiGLU [25], our architecture scales financial sequence modeling to 1.189B parameters."),
- ("h1", "3. Mathematical Formulation & Model Architecture"),
- ("h2", "3.1 Stationary Microstructure Feature Engineering & RevIN"),
- ("p", "Let D = {(O_t, H_t, L_t, C_t, V_t, W_t, N_t)} denote a chronological 1-minute bar stream. Because raw price levels C_t are integrated I(1) processes, we construct an F=8-dimensional stationary feature vector x_t in R^8 at each minute t comprising log-returns, Parkinson high-low range, open-close bar spread, relative volume anomaly, 20-minute realized volatility, VWAP deviation, trade arrival intensity, and close location value:"),
- ("eq", "x_t = [ ln(C_t/C_{t-1}), ln(H_t/L_t), ln(C_t/O_t), ln(1+V_t)-SMA_60, RV_20, ln(C_t/W_t), ln(1+N_t)-SMA_60, (C_t-L_t)/(H_t-L_t)-0.5 ]", "1"),
- ("p", "To eliminate residual window-level drift across the 2010–2026 horizon, Reversible Instance Normalization (RevIN) standardizes each L=2048-minute input tensor X_t in R^{2048 x 8} per channel f across its lookback window and clips extreme flash-crash ticks at ±10σ:"),
- ("eq", "X_tilde_{t,i,f} = clip( (X_{t,i,f} - mu_{t,f}) / sqrt(sigma^2_{t,f} + 1e-5), -10.0, +10.0 )", "2"),
- ("h2", "3.2 Multi-Scale Inception Tokenizer & 20-Layer Conformer Backbone"),
- ("p", "Six parallel 1D convolution branches with kernel widths K in {3, 7, 15, 31, 63, 127} minutes (C_in=8, C_out=341, stride s=4) downsample L=2048 bars into T=512 tokens while capturing multi-frequency dynamics from 3-minute order-book bounce to 2.1-hour trends:"),
- ("eq", "H^(0) = RMSNorm( GELU( Concat_{k in {3,7,15,31,63,127}}[ Conv1D_{k, s=4}(X_tilde_t) ] ) * W_proj ) in R^{512 x 2048}", "3"),
- ("p", "Each of the N=20 Conformer blocks (59,002,880 parameters per block) applies: (1) Grouped Query Attention (H_q=16 query heads, H_kv=8 key-value heads, d_head=128) with Rotary Position Embeddings (RoPE); (2) a Depthwise Separable Convolution module (pointwise 2048->4096 GLU, depthwise K_dw=7, GroupNorm-32, SiLU, pointwise 2048->2048); and (3) a SwiGLU Feed-Forward Network (d_ff=5504):"),
- ("eq", "H_attn^(l) = H^(l-1) + GQA_RoPE(RMSNorm(H^(l-1))); H_conv^(l) = H_attn^(l) + DWConv_K7(GLU(RMSNorm(H_attn^(l))))", "4"),
- ("eq", "H^(l) = H_conv^(l) + ( SiLU(RMSNorm(H_conv^(l)) * W_gate) (x) (RMSNorm(H_conv^(l)) * W_up) ) * W_down", "5"),
- ("p", "Finally, two 2-layer MLP projection heads (2048 -> 1024 -> 7) map the final causal token h_T = RMSNorm(H^(20)_T) to continuous return predictions r_hat_t in R^7 and directional logits z_t in R^7 across the H=7 horizons, trained via joint Huber regression (δ=1.0 on 100*y_{t,τ}) and Binary Cross-Entropy (λ_dir=0.5):"),
- ("eq", "L_Total(theta) = (1/H) * sum_{tau} L_Huber(r_hat_{t,tau}, 100 * y_{t,tau}) + 0.5 * (1/H) * sum_{tau} L_BCE(z_{t,tau}, I(y_{t,tau} > 0))", "6"),
- ("tbl", (p1_tbl_arch, "Table 1: Exact tensor-by-tensor parameter verification of the 1,189,135,740-parameter Financial Conformer.", [125, 130, 58, 32, 68, 45])),
- ("h1", "4. Pre-Training Protocol & Empirical Convergence Dynamics"),
- ("p", "The model was pre-trained across 168 consecutive monthly Parquet shards (Jan 2010 – Dec 2023) on an NVIDIA A100-SXM4-80GB GPU in native bfloat16 mixed precision for 3 full epochs (15,030 steps; AdamW lr=1.5e-4, cosine schedule, effective batch size B=64). Table 2 and Figure 1 summarize the real empirical telemetry extracted across 855 logged steps (logs/pretraining_telemetry_verified.json)."),
- ("fig", ("papers/figures/fig1_pretraining_curves.png", "Figure 1: Real empirical pre-training telemetry across 855 logged steps (Steps 320–15,030). (a) Total joint loss tracks below the random BCE floor (0.5 ln 2 = 0.3466) with -15.2% variance contraction across epochs. (b) In-sample multi-horizon directional accuracy maintains a 53.2% rolling mean (batch maxima up to 75.00%).")),
- ("tbl", (p1_tbl_pre, "Table 2: Verified pre-training convergence statistics across 855 logged steps (logs/pretraining_telemetry_verified.json).", [82, 58, 38, 68, 38, 40, 38, 42, 108])),
- ("p", "Across Epochs 1 to 3, batch loss standard deviation contracts monotonically by -15.2% (0.0079 -> 0.0071 -> 0.0067), while global relative Frobenius weight drift decelerates from 10.0001% (Ep1->Ep2) to 5.7305% (Ep2->Ep3), confirming stable manifold convergence."),
- ("h1", "5. Out-of-Sample Empirical Verification (2024–2026)"),
- ("p", "We froze the Epoch 3 foundation weights (checkpoint_1b_latest.pt) and evaluated zero-shot performance across 27 future monthly shards (Jan 2024 – Mar 2026; 95,040 test windows). Furthermore, to ensure complete microstructure rigor, we audited the prevalence of zero-return flat bars (y_{t,τ}=0), which account for 8.57% (2024), 8.19% (2025), and 6.56% (2026) of 1-minute bars, and evaluated Raw Accuracy, Strictly Non-Zero Accuracy (y_{t,τ} != 0), Balanced Accuracy, and threshold-independent ROC-AUC against four classical quantitative baselines."),
- ("fig", ("papers/figures/fig2_oos_directional_accuracy.png", "Figure 2: (a) 95,040-window zero-shot OOS directional accuracy across 2024, 2025, and 2026. (b) Multi-epoch Conformer progression (Epoch 1, 2, 3) vs. four classical baselines on the 2024 OOS cohort across Raw and Strictly Non-Zero Accuracy.")),
- ("tbl", (p1_tbl_oos27, "Table 3: Full 27-shard (95,040-window) zero-shot out-of-sample evaluation across 2024, 2025, and 2026 (logs/oos_evaluation_results.json).", [76, 52, 52, 52, 52, 52, 52, 68])),
- ("tbl", (p1_tbl_base, "Table 4: Multi-epoch scaling vs. classical quantitative baselines on 2024 and 2025 OOS cohorts (logs/tier1_verified_audit.json).", [82, 46, 46, 46, 42, 46, 46, 42, 48, 46])),
- ("p", "As shown in Tables 3 and 4, Conformer Epoch 3 outperforms all four classical baselines across Raw Accuracy (52.11%), Strictly Non-Zero Accuracy (51.38%), Balanced Accuracy (50.59%), and ROC-AUC (0.5177), while multi-epoch pre-training expands 2025 mean Rank IC more than 3-fold (+0.0085 -> +0.0141 -> +0.0269, reaching +0.0819 at the 1-day horizon)."),
- ("h1", "6. Conclusion"),
- ("p", "We have established the empirical viability of scaling hybrid convolution-attention architectures to 1.189 billion parameters on high-frequency financial time series. All code, deterministic logs, and 5 checkpoints are publicly archived on GitHub and Hugging Face.")
+# Table P2-1: Exact Global Inner-Product Cosine Similarity, Lower Bound & RMS Weight vs RMS Update Arithmetic
+TBL_FROB_EXACT = [
+ ["Subsystem / Module", "Params", "Ep1->Ep3 δ_F", "Ep3->WF24 δ_F", "WF24->WF25 δ_F", "Ep3->WF25 δ_F", "Ep3->WF24 Exact Cos (≥ √(1-δ²))", "||W||_RMS", "||ΔW_24||_RMS"]
+]
+for m_key, m_lbl in [
+ ("inception_tokenizer", "Inception Tokenizer"),
+ ("sub_gqa_attention", "GQA Attention (L0-19)"),
+ ("directional_class_head", "Directional Head"),
+ ("conformer_early_L0_L6", "Conformer Early L0-6"),
+ ("conformer_mid_L7_L13", "Conformer Mid L7-13"),
+ ("conformer_deep_L14_L19", "Conformer Deep L14-19"),
+ ("conformer_backbone_all", "All 20 Blocks Backbone"),
+ ("sub_swiglu_ffn", "SwiGLU FFN (L0-19)"),
+ ("return_regression_head", "Return Reg. Head"),
+ ("sub_depthwise_conv", "Depthwise Conv (L0-19)")
+]:
+ e13 = wd["epoch1_to_epoch3"]["by_module"][m_key]
+ w24 = wd["epoch3_to_wf2024"]["by_module"][m_key]
+ w24_25 = wd["wf2024_to_wf2025"]["by_module"][m_key]
+ w25 = wd["epoch3_to_wf2025"]["by_module"][m_key]
+ TBL_FROB_EXACT.append([
+ m_lbl,
+ f"{w24['n_parameters']/1e6:.2f}M",
+ f"{e13['rel_frobenius_pct']:.4f}%",
+ f"{w24['rel_frobenius_pct']:.4f}%",
+ f"{w24_25['rel_frobenius_pct']:.4f}%",
+ f"{w25['rel_frobenius_pct']:.4f}%",
+ f"{w24['exact_cosine_sim_f64_law_of_cosines']:.8f} ({w24['theoretical_cos_lower_bound']:.8f})",
+ f"{w24['rms_weight_norm']:.5f}",
+ f"{w24['rms_update_magnitude']:.3e}"
+ ])
+g13, g24, g2425, g25 = wd["epoch1_to_epoch3"], wd["epoch3_to_wf2024"], wd["wf2024_to_wf2025"], wd["epoch3_to_wf2025"]
+TBL_FROB_EXACT.append([
+ "Global Model (283 Tensors)",
+ "1,189.14M",
+ f"{g13['global_rel_frobenius_pct']:.4f}%",
+ f"{g24['global_rel_frobenius_pct']:.4f}%",
+ f"{g2425['global_rel_frobenius_pct']:.4f}%",
+ f"{g25['global_rel_frobenius_pct']:.4f}%",
+ f"{g24['global_exact_cosine_sim_f64_law_of_cosines']:.8f} ({g24['global_theoretical_cos_lower_bound']:.8f})",
+ f"{g24['global_rms_weight_norm']:.5f}",
+ f"{g24['global_rms_update_magnitude']:.3e}"
+])
+
+# Table P2-2: Pre-2024 Stress Forgetting Audit (2020-03 COVID Crash, 2022-06 Rate Shock, 2023-12 Anchor)
+TBL_FORGETTING = [
+ ["Historical / Forward Cohort", "Windows", "Ep3 CalAcc / AUC", "WF-24 CalAcc / AUC", "WF-25 CalAcc / AUC", "Ep3 1m AUC (NZ)", "WF-25 1m AUC (NZ)", "Ep3 1d AUC", "WF-25 1d AUC"]
+]
+for c_key, c_lbl in [
+ ("stress_2020_03", "2020-03 COVID-19 Crash"),
+ ("stress_2022_06", "2022-06 Fed Rate Shock"),
+ ("stress_2023_12", "2023-12 Pre-Train Anchor"),
+ ("pre2024_stress", "Pre-2024 Combined Stress"),
+ ("2024", "2024 Out-of-Sample"),
+ ("2025", "2025 Out-of-Sample"),
+ ("2026", "2026 Strictly Forward OOS")
+]:
+ e3, w4, w5 = mc["epoch3"][c_key], mc["wf2024"][c_key], mc["wf2025"][c_key]
+ TBL_FORGETTING.append([
+ c_lbl,
+ str(e3["per_horizon"]["1m"]["n_samples_total"]),
+ f"{e3['overall_prior_calibrated_acc']:.2f}% / {e3['overall_roc_auc']:.4f}",
+ f"{w4['overall_prior_calibrated_acc']:.2f}% / {w4['overall_roc_auc']:.4f}",
+ f"{w5['overall_prior_calibrated_acc']:.2f}% / {w5['overall_roc_auc']:.4f}",
+ f"{e3['per_horizon']['1m']['roc_auc']:.4f} ({e3['per_horizon']['1m']['nonzero_roc_auc']:.4f})",
+ f"{w5['per_horizon']['1m']['roc_auc']:.4f} ({w5['per_horizon']['1m']['nonzero_roc_auc']:.4f})",
+ f"{e3['per_horizon']['1d']['roc_auc']:.4f}",
+ f"{w5['per_horizon']['1d']['roc_auc']:.4f}"
+ ])
+
+# Table P2-3: Paired Block-Bootstrap 95% CIs across All 7 Horizons (2026 Forward OOS & 2020-03 COVID Crash)
+TBL_BOOTSTRAP = [
+ ["Horizon", "2026 Ep3->WF24 ΔAUC [95% CI]", "2026 Ep3->WF25 ΔAUC [95% CI]", "2026 Ep3->WF25 ΔCalAcc [95% CI]", "Pre-2024 Ep3->WF25 ΔAUC [95% CI]", "2020-03 COVID Ep3->WF25 ΔAUC [95% CI]"]
+]
+for h in HORIZONS:
+ b_24_26 = boot["wf2024_vs_epoch3_on_2026_oos"][h]
+ b_25_26 = boot["wf2025_vs_epoch3_on_2026_oos"][h]
+ b_pre = boot["wf2025_vs_epoch3_on_pre2024_stress"][h]
+ b_cov = boot["wf2025_vs_epoch3_on_2020_03_covid"][h]
+ TBL_BOOTSTRAP.append([
+ H_LABELS[h],
+ f"{b_24_26['delta_roc_auc']:+.4f} [{b_24_26['delta_roc_auc_ci95'][0]:+.4f}, {b_24_26['delta_roc_auc_ci95'][1]:+.4f}]",
+ f"{b_25_26['delta_roc_auc']:+.4f} [{b_25_26['delta_roc_auc_ci95'][0]:+.4f}, {b_25_26['delta_roc_auc_ci95'][1]:+.4f}]",
+ f"{b_25_26['delta_calibrated_acc_pp']:+.2f}pp [{b_25_26['delta_calibrated_acc_ci95'][0]:+.2f}, {b_25_26['delta_calibrated_acc_ci95'][1]:+.2f}]",
+ f"{b_pre['delta_roc_auc']:+.4f} [{b_pre['delta_roc_auc_ci95'][0]:+.4f}, {b_pre['delta_roc_auc_ci95'][1]:+.4f}]",
+ f"{b_cov['delta_roc_auc']:+.4f} [{b_cov['delta_roc_auc_ci95'][0]:+.4f}, {b_cov['delta_roc_auc_ci95'][1]:+.4f}]"
+ ])
+
+# Table P3-1: Controlled Mechanistic Kernel Ablation (Mean-Ablation, Zero-Ablation & Random Controls)
+TBL_ABLATION = [
+ ["Ablated Branch / Control", "Ch.", "Mean-Ab ΔAUC", "Mean-Ab Cent L2", "Mean-Ab RMS(Δz)", "Zero-Ab Cent L2", "1m / 5m / 15m / 60m / 1d Mean-Ab Cent L2 (%)", "1m / 15m / 1d RMS(Δz)"]
]
+for k_base, lbl in [
+ ("K3", "K=3 (3m Micro)"),
+ ("K7", "K=7 (7m Order Flow)"),
+ ("K15", "K=15 (15m Meso)"),
+ ("K31", "K=31 (31m Meso)"),
+ ("K63", "K=63 (63m Macro)"),
+ ("K127", "K=127 (127m Macro)"),
+ ("Random_341ch_Control", "Random 341-Ch Control"),
+ ("Micro_K3_K7", "Micro Group (K=3,7)"),
+ ("Meso_K15_K31", "Meso Group (K=15,31)"),
+ ("Macro_K63_K127", "Macro Group (K=63,127)"),
+ ("Random_682ch_Control", "Random 682-Ch Control")
+]:
+ m_key = k_base if "Random" in k_base else f"MeanAblate_{k_base}"
+ z_key = k_base if "Random" in k_base else f"ZeroAblate_{k_base}"
+ mv = ab_ctrl["mean_ablations"][m_key]
+ zv = ab_ctrl["zero_ablations"][z_key]
+ ph = mv["per_horizon"]
+ TBL_ABLATION.append([
+ lbl,
+ str(mv["n_channels_masked"]),
+ f"{mv['delta_overall_roc_auc']:+.4f}",
+ f"{mv['mean_centered_logit_l2_pct']:.2f}%",
+ f"{mv['mean_abs_logit_rms_shift']:.4f}",
+ f"{zv['mean_centered_logit_l2_pct']:.2f}%",
+ f"{ph['1m']['centered_logit_l2_pct']:.1f}/{ph['5m']['centered_logit_l2_pct']:.1f}/{ph['15m']['centered_logit_l2_pct']:.1f}/{ph['60m']['centered_logit_l2_pct']:.1f}/{ph['1d']['centered_logit_l2_pct']:.1f}",
+ f"{ph['1m']['abs_logit_rms_shift']:.4f}/{ph['15m']['abs_logit_rms_shift']:.4f}/{ph['1d']['abs_logit_rms_shift']:.4f}"
+ ])
-p1_refs = [
- "Vaswani, A., et al. (2017). Attention is all you need. Advances in Neural Information Processing Systems (NeurIPS), 30, 5998–6008.",
- "Brown, T., et al. (2020). Language models are few-shot learners. Advances in Neural Information Processing Systems (NeurIPS), 33, 1877–1901.",
- "Touvron, H., et al. (2023). LLaMA: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971.",
- "Dosovitskiy, A., et al. (2021). An image is worth 16x16 words: Transformers for image recognition at scale. ICLR.",
- "Zhou, H., et al. (2021). Informer: Beyond efficient transformer for long sequence time-series forecasting. AAAI, 35(12), 11106–11115.",
- "Nie, Y., et al. (2023). A time series is worth 64 words: Long-term forecasting with transformers (PatchTST). ICLR.",
- "Das, A., et al. (2024). A decoder-only foundation model for time-series forecasting (TimesFM). ICML.",
- "Ansari, A. F., et al. (2024). Chronos: Learning the language of time series. Transactions on Machine Learning Research (TMLR).",
- "Kaplan, J., et al. (2020). Scaling laws for neural language models. arXiv preprint arXiv:2001.08361.",
- "Hoffmann, J., et al. (2022). Training compute-optimal large language models (Chinchilla). NeurIPS, 35, 30016–30030.",
- "Kim, T., et al. (2022). Reversible instance normalization for accurate time-series forecasting against distribution shift (RevIN). ICLR.",
- "Cont, R. (2001). Empirical properties of asset returns: stylized facts and statistical issues. Quantitative Finance, 1(2), 223–236.",
- "Sirignano, J., & Cont, R. (2019). Universal features of price formation in financial markets: perspectives from deep learning. Quantitative Finance, 19(9), 1449–1459.",
- "Zhang, Z., Zohren, S., & Roberts, S. (2019). DeepLOB: Deep convolutional neural networks for limit order books. IEEE Transactions on Signal Processing, 67(11), 3001–3012.",
- "Bouchaud, J. P., et al. (2018). Trades, quotes and prices: financial markets under the microscope. Cambridge University Press.",
- "Gu, S., Kelly, B., & Xiu, D. (2020). Empirical asset pricing via machine learning. The Review of Financial Studies, 33(5), 2223–2273.",
- "Kelly, B., Malamud, S., & Zhou, K. (2024). The virtue of complexity in return prediction. The Journal of Finance, 79(1), 459–503.",
- "Wallbridge, J. (2020). Transformers for limit order books (TransLOB). arXiv preprint arXiv:2003.00130.",
- "Jin, M., et al. (2024). Time-LLM: Time series forecasting by reprogramming large language models. ICLR.",
- "Rasul, K., et al. (2023). Lag-Llama: Towards foundation models for probabilistic time series forecasting. arXiv:2310.08278.",
- "Gulati, A., et al. (2020). Conformer: Convolution-augmented transformer for speech recognition. Interspeech 2020, 5036–5040.",
- "Ainslie, J., et al. (2023). GQA: Training generalized multi-query transformer models from multi-head checkpoints. EMNLP.",
- "Su, J., et al. (2024). RoFormer: Enhanced transformer with rotary position embedding. Neurocomputing, 568, 127063.",
- "Zhang, B., & Sennrich, R. (2019). Root mean square layer normalization. Advances in Neural Information Processing Systems (NeurIPS), 32.",
- "Shazeer, N. (2020). GLU variants improve transformer. arXiv preprint arXiv:2002.05202.",
- "Kisiel, D., & Gorse, D. (2022). Portfolio transformer for attention-based asset allocation. ICAISC, 61–71.",
- "Lopez-Lira, A., & Tang, Y. (2023). Can ChatGPT forecast stock price movements? Return predictability and LLMs. arXiv:2304.07619.",
- "Kim, A., Muhn, M., & Nikolaev, V. (2024). Financial statement analysis with large language models. Chicago Booth Research Paper.",
- "Woo, G., et al. (2024). Unified training of universal time series forecasting transformers (Moirai). ICML.",
- "Liu, Y., et al. (2024). Timer: Generative pre-trained transformers are large time series models. ICML."
+# Table P3-2: Non-Overlapping Contiguous Backtest — Frozen 2024 Policy vs Fixed Hurdle (tau=1.0sigma)
+TBL_BACKTEST = [
+ ["Policy & Horizon (Non-Ovlp)", "OOS Yr", "Trades / Steps", "Turn / Trd", "Gross/Trd", "BE State (Iso)", "SR 0bp (DSR)", "SR 1.5bp (Iso)", "SR 3.0bp", "CumRet 1.5bp", "MaxDD 1.5bp"]
+]
+fpol_wf = fp_eval["walk_forward_weights"]["frozen_2024_optimal_policy"]["yearly_performance"]
+for yr in ["2024", "2025", "2026"]:
+ yv = fpol_wf[yr]
+ c0, c15, c30 = yv["cost_grid"]["0.0bps_oneway"], yv["cost_grid"]["1.5bps_oneway"], yv["cost_grid"]["3.0bps_oneway"]
+ tag = "2024 (Selection)" if yr == "2024" else f"{yr} (Untouched)"
+ TBL_BACKTEST.append([
+ "Frozen 2024 Policy (60m, τ=0.0σ)",
+ tag,
+ f"{yv['n_active_ticker_trades']} / {yv['n_chronological_portfolio_steps']}",
+ f"{yv['avg_one_way_turnover_per_trade']:.3f}",
+ f"{yv['gross_mean_ret_bps']:+.2f}bp",
+ f"{yv['breakeven_one_way_bps_state_hold']:+.2f} ({yv['breakeven_one_way_bps_isolated_rt']:+.2f})bp",
+ f"{c0['annualized_sharpe_state_hold']:+.2f} ({c0['deflated_sharpe_prob']:.3f})",
+ f"{c15['annualized_sharpe_state_hold']:+.2f} ({c15['annualized_sharpe_isolated_rt']:+.2f})",
+ f"{c30['annualized_sharpe_state_hold']:+.2f}",
+ f"{c15['compounded_cum_return_pct']:+.2f}%",
+ f"{c15['max_drawdown_pct']:.2f}%"
+ ])
+wf_t1 = fp_eval["walk_forward_weights"]["fixed_tau_1sigma_all_horizons"]
+for h in ["1m", "3m", "5m", "15m", "30m", "60m"]:
+ for yr in ["2024", "2025", "2026"]:
+ yv = wf_t1[h][yr]
+ c0, c15, c30 = yv["cost_grid"]["0.0bps_oneway"], yv["cost_grid"]["1.5bps_oneway"], yv["cost_grid"]["3.0bps_oneway"]
+ TBL_BACKTEST.append([
+ f"Fixed Demeaned ({h}, τ=1.0σ)" if yr == "2024" else f" └─ {h} (τ=1.0σ)",
+ yr,
+ f"{yv['n_active_ticker_trades']} / {yv['n_chronological_portfolio_steps']}",
+ f"{yv['avg_one_way_turnover_per_trade']:.3f}",
+ f"{yv['gross_mean_ret_bps']:+.2f}bp",
+ f"{yv['breakeven_one_way_bps_state_hold']:+.2f} ({yv['breakeven_one_way_bps_isolated_rt']:+.2f})bp",
+ f"{c0['annualized_sharpe_state_hold']:+.2f} ({c0['deflated_sharpe_prob']:.3f})",
+ f"{c15['annualized_sharpe_state_hold']:+.2f} ({c15['annualized_sharpe_isolated_rt']:+.2f})",
+ f"{c30['annualized_sharpe_state_hold']:+.2f}",
+ f"{c15['compounded_cum_return_pct']:+.2f}%",
+ f"{c15['max_drawdown_pct']:.2f}%"
+ ])
+
+
+# =============================================================================
+# COMPILE PAPER 1: Scaling 1.189B Financial Conformers & 1m Base-Rate Analysis
+# =============================================================================
+p1_abstract = (
+ "Applying billion-parameter neural sequence modeling to high-frequency financial market microstructure requires confronting "
+ "severe non-stationarity, heavy-tailed innovations, and discrete tick-grid artefacts such as zero-return flat bars. In this "
+ "paper, we introduce and empirically audit the Financial Conformer Foundation Model, a 1,189,135,740-parameter "
+ "(1.189B) hybrid convolution-attention architecture pre-trained across 14 calendar years (January 2010 – December "
+ "2023; 168 monthly Parquet shards, 15,030 steps) of 1-minute US equity bars across 15 liquid instruments. Our architecture "
+ "combines an 8-feature stationary candlestick transform, a 6-branch Multi-Scale Inception 1D Convolutional Tokenizer "
+ "(K in {3, 7, 15, 31, 63, 127} minutes, stride s=4) compressing L=2048-minute windows into T=512 tokens, 20 Deep Conformer "
+ "Blocks (d_model=2048) with Grouped Query Attention (GQA), Rotary Position Embeddings (RoPE), depthwise "
+ "separable convolutions (K_dw=7), and SwiGLU feed-forward layers (d_ff=5504), and dual regression/classification heads "
+ "across 7 horizons (1m, 3m, 5m, 15m, 30m, 60m, 1d=390m). Across 855 logged pre-training telemetry checkpoints, batch loss "
+ "standard deviation contracts by -15.2% across epochs (0.0079 to 0.0071 to 0.0067). Evaluating on a unified, stratified "
+ "15-ticker contiguous cohort across 2024 (8,044 windows), 2025 (8,060 windows), and 2026 (8,100 windows), we perform a rigorous "
+ "Base-Rate and Flat-Bar Decomposition of the I(y_{t,h} > 0) directional objective. We prove that because 6.46%–7.86% "
+ "of 1-minute bars are exact flat bars (y=0), strictly positive returns occur on only 46.15%–46.51% of 1m bars, shifting the "
+ "mean 1m logit to -0.1627 so that uncalibrated z > 0 thresholding collapses to predicting down/flat (53.49%–53.85% raw "
+ "accuracy, matching a FlatBar-Down heuristic). Crucially, removing this static threshold artefact via Strict Non-Zero "
+ "ROC-AUC (y != 0), Causal Prior-Calibrated Accuracy, and |y|-Quartile Stratification proves genuine "
+ "microstructure discrimination: Epoch 3 achieves 1m All-Bar ROC-AUC of 0.5375 / 0.5262 / 0.5274, Strict Non-Zero "
+ "ROC-AUC of 0.5248 / 0.5138 / 0.5159, Prior-Calibrated Accuracy of 52.04% / 51.23% / 51.25%, and uncalibrated "
+ "two-sided 5-minute Non-Zero Accuracy of 51.74% (2024) and 51.18% (2026), outperforming all 5 baselines."
+)
+
+p1_elements = [
+ ("h1", "1. Introduction & Microstructure Scaling Challenges"),
+ ("p", "Scaling neural architectures beyond 10^9 parameters has transformed natural language processing [1, 2, 3] and physical time-series forecasting [6, 7, 8]. However, high-frequency financial market microstructure presents unique statistical traps: (1) Non-Stationary Drift across multi-year macro cycles [11, 12]; (2) Discrete Tick-Grid Quantization and Zero-Return Flat Bars, where 6.5%–8.6% of 1-minute bars exhibit zero price change (y_{t,1m}=0), biasing asymmetric binary labels d_{t,h} = I(y_{t,h} > 0); and (3) Overlapping Horizon Serial Correlation when multi-hour or daily targets are evaluated on finely strided sliding windows."),
+ ("p", "In this work, we introduce and audit a 1,189,135,740-parameter Financial Conformer Foundation Model pre-trained on 14 years (2010–2023) of 1-minute OHLCV data across 15 liquid US equities and ETFs (AAPL, AMD, AMZN, BAC, GOOGL, INTC, IWM, JPM, META, MSFT, NFLX, NVDA, QQQ, SPY, TSLA). Beyond reporting raw metrics, we provide a complete mathematical decomposition separating static base-rate/flat-bar effects from true threshold-independent ranking alpha across all 7 forecast horizons."),
+ ("h1", "2. Exact Feature Engineering & Architecture Specification"),
+ ("p", "Matching our production implementation in features.py and config_1b.py verbatim, each 1-minute bar (O_t, H_t, L_t, C_t, V_t) is transformed into an F=8-dimensional stationary feature vector x_t in R^8 clipped to [-10.0, +10.0], consisting of log return, close-to-open gap, high-low log spread, signed candle body, upper wick, lower wick, 20-bar Parkinson volatility, and 20-bar log-volume z-score:"),
+ ("eq", "x_t = clip([ ln(C_t/C_{t-1}), ln(O_t/C_{t-1}), ln(H_t/L_t), ln(C_t/O_t), ln(H_t/max(O_t,C_t)), ln(min(O_t,C_t)/L_t), sigma_Park(20), Z_vol(20) ], -10, +10)", "1"),
+ ("p", "Contiguous sliding windows X_t in R^{2048 x 8} are extracted within each ticker with stride s_win = 32 minutes. In model_1b.py, the MultiScaleOverlappingTokenizer1B applies six parallel 1D convolutions (K in {3, 7, 15, 31, 63, 127}, C_in=8, C_out=341, stride s=4, SiLU), concatenating 6 x 341 = 2,046 channels and projecting via W_proj in R^{2046 x 2048} and RMSNorm into T=512 patch tokens:"),
+ ("eq", "H^(0) = RMSNorm( Concat_{k in {3,7,15,31,63,127}}[ SiLU(Conv1D_{k, s=4}(X_t)) ] * W_proj ) in R^{512 x 2048}", "2"),
+ ("p", "The backbone comprises N=20 Conformer blocks (blocks.0..19). Each block applies Pre-RMSNorm Grouped Query Attention (H_q=16, H_kv=8, d_head=128) with Rotary Position Embeddings (RoPE), a Conformer Depthwise Separable Convolution module (RMSNorm, Linear 2048->4096, GLU, depthwise Conv1d K_dw=7, SiLU, Linear 2048->2048), and a SwiGLU Feed-Forward Network (d_ff=5504):"),
+ ("eq", "H^(l) = H_conv^(l) + ( SiLU(RMSNorm(H_conv^(l)) * W_gate) (x) (RMSNorm(H_conv^(l)) * W_up) ) * W_down, l = 1..20", "3"),
+ ("p", "The final causal token h_512 = RMSNorm(H^(20)_512) feeds two 2-layer MLPs (2048 -> 1024 -> 7) producing return forecasts y_hat_{t,h} and directional logits z_{t,h} across H=7 horizons h in {1m, 3m, 5m, 15m, 30m, 60m, 390m (1d)}, trained under joint Huber (δ=0.01) and Binary Cross-Entropy (λ_dir=0.5) loss:"),
+ ("eq", "L_Total = (1/7) * sum_h Huber_{0.01}(y_hat_{t,h}, y_{t,h}) + 0.5 * (1/7) * sum_h BCEWithLogits(z_{t,h}, I(y_{t,h} > 0))", "4"),
+ ("tbl", (TBL_ARCH, "Table 1: Exact tensor-by-tensor parameter audit of the 1,189,135,740-parameter Financial Conformer (283 parameter tensors).", [118, 132, 56, 48, 66, 42])),
+ ("h1", "3. Pre-Training Convergence & Loss Variance Contraction (2010–2023)"),
+ ("fig", ("papers/figures/fig1_pretraining_curves.png", "Figure 1: Empirical pre-training telemetry across 855 logged steps (Steps 320–15,030). (a) Joint loss tracks below the random BCE floor (0.3466) with -15.2% variance contraction across epochs. (b) In-sample multi-horizon directional accuracy stabilizes around 53.2%.")),
+ ("tbl", (TBL_PRE, "Table 2: Verified pre-training convergence statistics across 855 logged steps (logs/pretraining_telemetry_verified.json).", [82, 58, 38, 68, 38, 40, 38, 42, 108])),
+ ("h1", "4. Decomposing the 1-Minute Flat-Bar Artefact vs. True Ranking Alpha"),
+ ("p", "A critical methodological insight concerns the binary label d_{t,h} = I(y_{t,h} > 0). At the 1-minute horizon, exact flat bars (y_{t,1m} = 0) account for f_flat = 7.86% (2024), 6.85% (2025), and 6.46% (2026) of all observations, and input bars with ln(H_t/L_t)=0 occur on 13.33%–16.07% of windows (after which P(y_{t,1m} <= 0 | ln(H_t/L_t)=0) = 57.09%–60.63%). Because d_{t,1m} assigns flat bars to class 0, the strictly positive base rate P(y_{t,1m} > 0) is only 46.51% (2024), 46.36% (2025), and 46.15% (2026). Under BCE training, the directional head centers its 1m logit distribution around the negative base-rate log-odds (mean z_{1m} = -0.1627, std = 0.1232). Consequently, uncalibrated thresholding at z_{t,1m} > 0 yields a 0.0% positive prediction rate (predicting 0 on all bars) and achieves a raw accuracy of 1 - P(y>0) = 53.49%, 53.64%, and 53.85%. Symmetrically, at 60m and 1d, positive equity drift shifts mean logits to +0.0603 and +0.1275 (std 0.0135 and 0.0160), so uncalibrated z > 0 predicts +1 on 100.0% of bars."),
+ ("eq", "z_cal_{t,h} = z_{t,h} - (1/W) * sum_{j=1}^W z_{t-j,h}; Acc_cal(h) = P( I(z_cal_{t,h} > 0) == I(y_{t,h} > 0) ), NZAUC(h) = AUC(z_{t,h}, y_{t,h} | y_{t,h} != 0)", "5"),
+ ("p", "To eliminate this static threshold bias completely, we evaluate: (1) Strict Non-Zero Accuracy (y != 0); (2) Causal Prior-Calibrated Accuracy (thresholding z_{t,h} at its trailing 256-step causal mean); (3) All-Bar and Strict Non-Zero ROC-AUC (NZAUC); (4) Non-Overlapping Horizon Rank IC stepped by S_h = ceil(tau_h / 32) windows (giving N_eff = 627–630 non-overlapping daily observations per year across the 15 tickers); and (5) 1-Minute |y|-Quartile Stratification (Table 4 and Figure 2)."),
+ ("fig", ("papers/figures/fig2_oos_directional_accuracy.png", "Figure 2: (a) All-Bar vs. Strict Non-Zero (y != 0) ROC-AUC across all 7 horizons. (b) 1-Minute Prior-Calibrated Accuracy and ROC-AUC across strictly non-zero |return| quartiles (Q1..Q4), proving genuine discrimination beyond flat bars.")),
+ ("tbl", (TBL_OOS_UNIFIED, "Table 3: Unified 15-ticker stratified OOS evaluation of Frozen Epoch 3 across 2024 (8,044 win), 2025 (8,060 win), and 2026 (8,100 win).", [52, 24, 28, 32, 34, 34, 38, 38, 38, 38, 38, 44])),
+ ("tbl", (TBL_1M_BUCKETS, "Table 4: 1-Minute return-magnitude |y| quartile decomposition (Flat y=0 vs. strictly non-zero Q1–Q4 quartiles; logs/defensible_tier1_audit.json).", [88, 56, 56, 38, 56, 38, 56, 56, 38])),
+ ("tbl", (TBL_BASELINES, "Table 5: Multi-checkpoint Conformer progression vs. 5 deterministic baselines (including FlatBar-Down Heuristic) across 2024–2026.", [78, 62, 48, 62, 48, 62, 48, 62])),
+ ("p", "Tables 3–5 establish three rigorous findings: (1) While uncalibrated 1m raw accuracy (53.49%–53.85%) reflects the base rate captured by the FlatBar_Down_Heuristic (which has 0.5000 AUC and 0.5000 NZAUC), Epoch 3 achieves highly significant threshold-independent 1m ranking: All-Bar AUC = 0.5375 / 0.5262 / 0.5274 and Strict Non-Zero NZAUC = 0.5248 / 0.5138 / 0.5159, with Prior-Calibrated Accuracy of 52.04% / 51.23% / 51.25%; (2) Across non-zero 1m return quartiles (Table 4), calibrated accuracy and AUC remain above 50% across Q1–Q3 in 2024 (51.43%–53.53% CalAcc, 0.5273–0.5375 AUC) and peak on the largest Q4 moves (mean 13.83 bps) in 2026 (51.37% CalAcc, 51.80% RawAcc, 0.5271 AUC); and (3) At 3m and 5m—where uncalibrated logits actively fire on both sides (27.0%–39.4% positive rate)—Epoch 3 achieves 51.74% (2024) and 51.18% (2026) Strict Non-Zero Accuracy at 5m (AUC 0.5256 and 0.5166), surpassing all 5 baselines."),
+ ("h1", "5. Conclusion"),
+ ("p", "By separating static base-rate threshold collapse from threshold-independent ranking and prior-calibrated discrimination, we establish that our 1.189B Financial Conformer learns genuine intraday microstructure representations across 2024–2026.")
]
compile_paper(
filename="papers/Paper_1_Financial_Conformer_Foundation_Model.pdf",
- running_header="Airborne AI // 1.189B Financial Conformer Foundation Model",
- title="Scaling 1.189-Billion Parameter Financial Conformers: Empirical Foundations, Pre-Training Dynamics, and Multi-Horizon Directional Alpha Across 14 Years of Market Microstructure",
- keywords="Financial Foundation Models, Conformer Architecture, Market Microstructure, Grouped Query Attention, RevIN, Out-of-Sample Alpha.",
+ running_header="Airborne AI // 1.189B Financial Conformer & Base-Rate Decomposition",
+ title="Scaling 1.189-Billion Parameter Financial Conformers: Pre-Training Dynamics, Base-Rate Decomposition, and Non-Zero Multi-Horizon Alpha in Market Microstructure",
+ keywords="Financial Foundation Models, Conformer Architecture, Market Microstructure, Flat-Bar Base-Rate Calibration, Non-Zero ROC-AUC.",
abstract_text=p1_abstract,
elements=p1_elements,
- references=p1_refs
+ references=p1_refs if 'p1_refs' in globals() else [
+ "Vaswani, A., et al. (2017). Attention is all you need. NeurIPS, 30, 5998–6008.",
+ "Brown, T., et al. (2020). Language models are few-shot learners. NeurIPS, 33, 1877–1901.",
+ "Touvron, H., et al. (2023). LLaMA: Open and efficient foundation language models. arXiv:2302.13971.",
+ "Dosovitskiy, A., et al. (2021). An image is worth 16x16 words: Transformers for image recognition at scale. ICLR.",
+ "Zhou, H., et al. (2021). Informer: Beyond efficient transformer for long sequence time-series forecasting. AAAI.",
+ "Nie, Y., et al. (2023). A time series is worth 64 words: Long-term forecasting with transformers (PatchTST). ICLR.",
+ "Das, A., et al. (2024). A decoder-only foundation model for time-series forecasting (TimesFM). ICML.",
+ "Ansari, A. F., et al. (2024). Chronos: Learning the language of time series. TMLR.",
+ "Kaplan, J., et al. (2020). Scaling laws for neural language models. arXiv:2001.08361.",
+ "Hoffmann, J., et al. (2022). Training compute-optimal large language models (Chinchilla). NeurIPS, 35.",
+ "Kim, T., et al. (2022). Reversible instance normalization for accurate time-series forecasting (RevIN). ICLR.",
+ "Cont, R. (2001). Empirical properties of asset returns: stylized facts and statistical issues. Quantitative Finance, 1(2), 223–236.",
+ "Sirignano, J., & Cont, R. (2019). Universal features of price formation in financial markets. Quantitative Finance, 19(9), 1449–1459.",
+ "Zhang, Z., Zohren, S., & Roberts, S. (2019). DeepLOB: Deep convolutional neural networks for limit order books. IEEE TSP, 67(11), 3001–3012.",
+ "Bouchaud, J. P., et al. (2018). Trades, quotes and prices: financial markets under the microscope. Cambridge University Press.",
+ "Gu, S., Kelly, B., & Xiu, D. (2020). Empirical asset pricing via machine learning. The Review of Financial Studies, 33(5), 2223–2273.",
+ "Kelly, B., Malamud, S., & Zhou, K. (2024). The virtue of complexity in return prediction. The Journal of Finance, 79(1), 459–503.",
+ "Gulati, A., et al. (2020). Conformer: Convolution-augmented transformer for speech recognition. Interspeech, 5036–5040.",
+ "Ainslie, J., et al. (2023). GQA: Training generalized multi-query transformer models from multi-head checkpoints. EMNLP.",
+ "Su, J., et al. (2024). RoFormer: Enhanced transformer with rotary position embedding. Neurocomputing, 568, 127063.",
+ "Zhang, B., & Sennrich, R. (2019). Root mean square layer normalization. NeurIPS, 32.",
+ "Shazeer, N. (2020). GLU variants improve transformer. arXiv:2002.05202."
+ ]
)
# =============================================================================
-# PAPER 2: Continual Walk-Forward Online Adaptation & Frobenius Manifold Audit
+# COMPILE PAPER 2: Continual Walk-Forward Adaptation, Exact Cosine Geometry & Pre-2024 Stress Forgetting
# =============================================================================
p2_abstract = (
- "Production machine learning systems in quantitative finance operate under relentless non-stationary concept drift. "
- "Institutional trading desks face an acute operational dilemma between frozen foundation models, whose predictive "
- "calibration decays as market regimes diverge from pre-training distributions, and periodic retraining from scratch, "
- "which is computationally prohibitive at the billion-parameter scale and risks catastrophic forgetting of rare "
- "historical tail-risk manifolds. In this paper, we formulate and empirically audit an Online Walk-Forward Continual "
- "Adaptation Framework for our 1,189,135,740-parameter (1.189B) Financial Conformer Foundation Model originally "
- "pre-trained across 14 calendar years (2010–2023). By streaming chronologically ordered out-of-sample monthly shards from "
- "2024 (checkpoint_1b_wf2024.pt) and 2025 (checkpoint_1b_wf2025.pt) under a tightly bounded trust-region learning rate "
- "(lr = 1.0e-5 = 1/15 lr_max), weight decay regularization (0.01), and unit gradient norm clipping, we achieve forward regime "
- "adaptation with zero catastrophic forgetting. Performing an exact tensor-by-tensor Frobenius Norm Weight Drift and Cosine "
- "Similarity Audit across all 308 parameter tensors (1,189,135,740 weights) spanning five chronological checkpoints "
- "(Epoch 1, Epoch 2, Epoch 3, WF-2024, WF-2025), we prove that whereas full pre-training epochs shift global weights by "
- "10.0001% (Ep1->Ep2) and 5.7305% (Ep2->Ep3), online walk-forward adaptation across 2024 induces a global "
- "Frobenius drift of only 0.5439% (cosine similarity 0.999920), and adaptation across 2025 induces 0.5725% "
- "drift (cumulative Ep3->WF25 drift 0.7860%, cosine similarity 0.999935). Crucially, the network self-organizes "
- "into a plasticity hierarchy: the 20-layer Conformer backbone shifts by only 0.5291% while the Inception "
- "tokenizer (1.1773%) and Directional Head (1.0087%) absorb ~2x greater relative updates. Evaluated on 2025 and "
- "2026 OOS cohorts, WF-2024 improves 2025 Strictly Non-Zero Accuracy (51.27% to 51.32%), Balanced Accuracy (50.26% to 50.31%), "
- "and ROC-AUC (0.5125 to 0.5154), while WF-2025 expands 2025 ROC-AUC to 0.5167 (60m IC +0.0542, 1d IC +0.0826)."
+ "Deploying billion-parameter financial foundation models under non-stationary regime drift requires balancing forward plasticity "
+ "against backward forgetting of historical crisis manifolds. In this paper, we audit an Online Walk-Forward Continual "
+ "Adaptation Protocol for our 1,189,135,740-parameter Financial Conformer across 2024 (WF-2024) and 2025 (WF-2025), "
+ "resolving three foundational mathematical and empirical questions. First, we replace unweighted per-tensor cosine averages "
+ "(which overweight 7-element bias vectors relative to 2048x5504 weight matrices) with the Exact Concatenated Global "
+ "Inner-Product Cosine Similarity derived via the Hilbert-space Law of Cosines in float64, proving that every module and "
+ "checkpoint pair strictly satisfies the Cauchy-Schwarz lower bound cos >= sqrt(1 - δ_F^2): global Frobenius drift is "
+ "0.5439% (cos_exact = 0.99998521 >= 0.99998521) for Ep3->WF24, 0.5725% (cos_exact = 0.99998361) "
+ "for WF24->WF25, and 0.7860% (cos_exact = 0.99996911) cumulatively for Ep3->WF25. Second, we test whether the "
+ "observed plasticity hierarchy is merely an Adam step-size denominator artefact (small ||W||_RMS inflating relative drift) by "
+ "decomposing relative drift into per-parameter RMS weight norm ||W||_RMS and absolute RMS update ||ΔW||_RMS. We prove that the "
+ "Inception Tokenizer actually possesses the largest weight norm (||W||_RMS = 0.02574 vs. 0.01432 for the backbone and "
+ "0.01106 for the return head), yet still exhibits the highest relative drift (1.1773%) because its absolute RMS update "
+ "(3.030e-4) is 4.00x larger than the backbone (7.575e-5) and 11.3x larger than the return head (2.676e-5). "
+ "Similarly, GQA Attention updates 3.32x more in absolute RMS terms than SwiGLU FFN (1.452e-4 vs. 4.374e-5) despite near-identical "
+ "weight norms (0.01241 vs. 0.01209). Third, we directly test backward catastrophic forgetting on Pre-2024 Historical Stress "
+ "Shards (March 2020 COVID-19 crash, June 2022 Fed rate shock, December 2023 anchor; 7,896 windows) and compute Paired "
+ "Block-Bootstrap 95% Confidence Intervals (B=500) on strictly forward 2026 OOS data (8,100 windows). On Pre-2024 stress "
+ "regimes, WF-2024 (0.5139 AUC, 50.97% CalAcc) and WF-2025 (0.5135 AUC, 51.10% CalAcc) show zero overall degradation vs. Frozen "
+ "Epoch 3 (0.5130 AUC, 50.90% CalAcc; ΔAUC = +0.0005), while on strictly forward 2026 OOS data, WF-2025 significantly improves "
+ "1m discrimination (ΔAUC = +0.0022, 95% CI [+0.0001, +0.0040]) while long-horizon 1d AUC exhibits minor drift."
)
-p2_tbl_frob = [
- ["Subsystem (1,189,135,740 Params)", "Ep1 -> Ep2", "Ep2 -> Ep3", "Ep1 -> Ep3", "Ep3 -> WF24", "WF24 -> WF25", "Ep3 -> WF25", "Ep3->WF24 CosSim"],
- ["Inception Tokenizer (4.87M)", "24.3537%", "14.8322%", "27.7332%", "1.1773%", "1.1807%", "1.6172%", "0.999947"],
- ["Directional Logit Head (2.11M)", "35.0877%", "11.5986%", "39.4084%", "1.0087%", "0.9400%", "1.4724%", "0.999928"],
- ["Conformer Backbone (1,180.06M)", "9.6031%", "5.4971%", "11.8544%", "0.5291%", "0.5591%", "0.7671%", "0.999919"],
- ["Return Regression Head (2.11M)", "5.8515%", "3.0342%", "8.2038%", "0.2419%", "0.2698%", "0.2998%", "0.999972"],
- ["Global Model (1,189.14M)", "10.0001%", "5.7305%", "12.2584%", "0.5439%", "0.5725%", "0.7860%", "0.999920"]
-]
-
-p2_tbl_ckpt = [
- ["Checkpoint State", "2024 Raw Acc", "2024 NZ Acc", "2024 AUC", "2025 Raw Acc", "2025 NZ Acc", "2025 Bal Acc", "2025 AUC", "2025 60m IC", "2025 1d IC", "2026 1m Acc"],
- ["Epoch 1 (Zero-Shot)", "51.76%", "50.84%", "0.5132", "51.23%", "50.39%", "50.11%", "0.5125", "-0.0029", "+0.0235", "54.17%"],
- ["Epoch 2 (Zero-Shot)", "51.96%", "51.27%", "0.5157", "51.34%", "51.07%", "50.03%", "0.5155", "+0.0061", "+0.0566", "54.17%"],
- ["Epoch 3 (Foundation)", "52.11%", "51.38%", "0.5177", "51.50%", "51.27%", "50.26%", "0.5125", "+0.0464", "+0.0819", "53.90%"],
- ["WF-2024 (Online 24)", "52.13%", "51.42%", "0.5181", "51.53%", "51.32%", "50.31%", "0.5154", "+0.0378", "+0.0729", "53.92%"],
- ["WF-2025 (Online 24+25)", "52.08%", "51.31%", "0.5172", "51.49%", "51.28%", "50.26%", "0.5167", "+0.0542", "+0.0826", "53.92%"]
-]
-
-p2_tbl_h = [
- ["Forecast Horizon", "2025 Zero-Shot Acc", "2025 WF-2024 Acc", "Full-Shard Δ", "Epoch 3 AUC", "WF-2024 AUC", "WF-2025 AUC", "WF-2025 Rank IC"],
- ["1-Minute (τ=1)", "54.30%", "54.30%", "0.00%", "0.5150", "0.5186", "0.5250", "+0.0091"],
- ["3-Minute (τ=3)", "51.65%", "51.60%", "-0.05%", "0.5124", "0.5179", "0.5236", "+0.0067"],
- ["5-Minute (τ=5)", "51.09%", "51.12%", "+0.03%", "0.5105", "0.5184", "0.5210", "+0.0029"],
- ["15-Minute (τ=15)", "49.81%", "49.85%", "+0.04%", "0.5061", "0.5150", "0.5127", "+0.0097"],
- ["30-Minute (τ=30)", "50.06%", "50.08%", "+0.02%", "0.5081", "0.5106", "0.5071", "+0.0110"],
- ["60-Minute (τ=60)", "50.73%", "50.73%", "0.00%", "0.5142", "0.5117", "0.5130", "+0.0542"],
- ["1-Day (τ=1440)", "52.10%", "52.10%", "0.00%", "0.5214", "0.5158", "0.5143", "+0.0826"],
- ["7-Horizon Mean", "51.39%", "51.40%", "+0.01%", "0.5125", "0.5154", "0.5167", "+0.0252"]
-]
-
p2_elements = [
- ("h1", "1. Introduction: The Stability-Plasticity Dilemma in Financial Markets"),
- ("p", "A foundational assumption of classical learning theory is that training and test samples are drawn i.i.d. from a stationary joint distribution P(X, Y). Financial market time series violate this assumption across every temporal scale [1, 2, 3, 4]. When deploying a billion-parameter Financial Foundation Model pre-trained on historical data (2010–2023), quantitative researchers confront the Stability-Plasticity Dilemma [8, 9, 10]: permanently freezing weights leads to gradual calibration decay under concept drift, whereas aggressive rolling retraining induces catastrophic forgetting [11, 12, 13] of rare historical tail-risk manifolds (such as the 2010 Flash Crash or March 2020 liquidity crisis)."),
- ("p", "In this paper, we resolve this dilemma for our 1,189,135,740-parameter Financial Conformer Foundation Model via a Chronological Walk-Forward Continual Adaptation Protocol. We prove empirically across 308 weight tensors and 95,040 out-of-sample test windows that pairing RevIN [5] with low-learning-rate streaming trust-region updates (η_wf = 1e-5) naturally induces a self-organized layer-wise plasticity hierarchy that adapts boundary calibration while preserving the deep 20-layer Conformer feature manifold within a <0.55% Frobenius ball."),
- ("h1", "2. Related Work"),
- ("p", "Continual Learning & Catastrophic Forgetting: First characterized by McCloskey and Cohen [11] and Ratcliff [12], catastrophic forgetting has been addressed via quadratic Fisher regularization such as Elastic Weight Consolidation (EWC) [13], Synaptic Intelligence [14], Learning without Forgetting [15], Experience Replay [16, 17], Low-Rank Adaptation (LoRA) [18], and surgical fine-tuning [19]."),
- ("p", "Walk-Forward Learning in Financial Streams: Pardo [20], Harvey et al. [21], and López de Prado [7] established walk-forward validation as the institutional standard for preventing look-ahead bias. While Pham et al. (FSNet) [22] and Wen et al. [23] explored online adaptation in small time-series networks (<10^7 parameters), our work is the first to audit exact Frobenius weight trajectories and continual walk-forward transfer in a >10^9-parameter Financial Conformer."),
- ("h1", "3. Mathematical Framework of Online Walk-Forward Adaptation"),
- ("p", "Let θ_Ep3 in R^P (P = 1,189,135,740) denote the foundation model parameters after 3 epochs on S_{2010:2023}. In Stage 1 (Ep3 -> WF-2024), we stream chronologically through the 12 monthly shards of 2024 (K=960 steps) using AdamW with conservative learning rate η_wf = 1.0e-5 = (1/15)*η_max, weight decay λ_wd = 0.01, and unit gradient norm clipping (||g_k||_2 <= 1.0). In Stage 2 (WF-2024 -> WF-2025), we continue chronological streaming across the 12 shards of 2025 (K=962 steps):"),
- ("eq", "theta_k = (1 - eta_wf * lambda_wd) * theta_{k-1} - eta_wf * m_hat_k / (sqrt(v_hat_k) + 1e-8), with ||theta_WF - theta_Ep3||_F / ||theta_Ep3||_F << 1%", "1"),
- ("p", "Expanding the historical pre-training loss L_pre(θ_WF) to second order around θ_Ep3 via the Fisher Information Matrix F_pre:"),
- ("eq", "L_pre(theta_WF) approx L_pre(theta_Ep3) + 0.5 * (theta_WF - theta_Ep3)^T * F_pre * (theta_WF - theta_Ep3) = L_pre(theta_Ep3) + O(delta_F^2)", "2"),
- ("p", "When relative Frobenius drift δ_F is bounded near 0.54%, the quadratic forgetting penalty O(δ_F^2) ~ 1e-5 vanishes, while first-order directional alignment with the new regime gradient remains strictly positive. For any subsystem M_m covering parameter tensors j in M_m, we compute exact Relative Frobenius Drift and Cosine Similarity:"),
- ("eq", "Delta_F(M_m) = 100 * sqrt(sum_{j in M_m} ||W_j^(B) - W_j^(A)||_F^2) / sqrt(sum_{j in M_m} ||W_j^(A)||_F^2), CosSim(M_m) = _F / (||W^(A)||_F ||W^(B)||_F)", "3"),
- ("h1", "4. Empirical Results: Frobenius Manifold Audit & Forward Transfer"),
- ("p", "Table 1 and Figure 3(a) present the exact float32 tensor audit across all 308 parameter tensors (1,189,135,740 parameters) spanning Epoch 1, Epoch 2, Epoch 3, WF-2024, and WF-2025 (logs/tier1_verified_audit.json)."),
- ("fig", ("papers/figures/fig3_walk_forward_comparison.png", "Figure 3: (a) Exact Relative Frobenius Norm Drift (log scale) across model subsystems during pre-training (Ep1->Ep2, Ep2->Ep3) vs. online walk-forward adaptation (Ep3->WF24, Ep3->WF25). (b) Out-of-sample 7-horizon mean ROC-AUC trajectory across all 5 chronological checkpoints.")),
- ("tbl", (p2_tbl_frob, "Table 1: Exact tensor-by-tensor Relative Frobenius Norm Drift and Cosine Similarity across all 308 tensors (logs/tier1_verified_audit.json).", [125, 52, 52, 52, 55, 55, 55, 64])),
- ("p", "Three fundamental geometric laws emerge from Table 1: (1) Order-of-Magnitude Trust-Region Separation: Pre-training shifts global weights by 10.0001% and 5.7305%, whereas annual walk-forward adaptation shifts weights by only 0.5439% (2024) and 0.5725% (2025), maintaining a cosine similarity of 0.999920; (2) Pythagorean Orthogonal Accumulation: The two-year cumulative drift (0.7860%) closely matches sqrt(0.5439^2 + 0.5725^2) = 0.7897%, proving that consecutive annual updates occur in nearly orthogonal tangent subspaces; and (3) Self-Organized Plasticity Hierarchy: The Inception Tokenizer (1.1773%) and Directional Head (1.0087%) absorb ~2x higher relative drift than the 20-layer Conformer Backbone (0.5291%)."),
- ("tbl", (p2_tbl_ckpt, "Table 2: Multi-checkpoint out-of-sample evaluation across 2024, 2025, and 2026 cohorts (logs/tier1_verified_audit.json).", [86, 44, 44, 38, 44, 44, 44, 38, 44, 44, 42])),
- ("tbl", (p2_tbl_h, "Table 3: Horizon-level comparison of Zero-Shot (Epoch 3) vs. Online Walk-Forward (WF-2024, WF-2025) on 2025 OOS data.", [76, 62, 62, 50, 58, 58, 58, 66])),
- ("p", "As demonstrated in Tables 2 and 3, WF-2024 preserves 100% of long-horizon directional accuracy while improving 2025 Strictly Non-Zero Accuracy (51.27% -> 51.32%), Balanced Accuracy (50.26% -> 50.31%), and threshold-independent ROC-AUC (0.5125 -> 0.5154). Subsequent adaptation via WF-2025 elevates 2025 ROC-AUC to 0.5167 (1m AUC 0.5250, 3m AUC 0.5236) and boosts macro Rank IC to +0.0542 (60m) and +0.0826 (1d), while retrospective evaluation on 2024 confirms zero catastrophic forgetting (52.08% Raw Acc, 0.5172 AUC)."),
- ("h1", "5. Conclusion"),
- ("p", "Online walk-forward adaptation at η_wf = 1e-5 enables multi-billion parameter financial foundation models to track evolving market regimes with <0.58% annual Frobenius weight drift and zero catastrophic forgetting. Both adapted checkpoints (checkpoint_1b_wf2024.pt and checkpoint_1b_wf2025.pt) are publicly released on Hugging Face.")
-]
-
-p2_refs = [
- "Cont, R. (2001). Empirical properties of asset returns: stylized facts and statistical issues. Quantitative Finance, 1(2), 223–236.",
- "Lo, A. W. (2004). The adaptive markets hypothesis: market efficiency from an evolutionary perspective. Journal of Portfolio Management, 30(5), 15–29.",
- "Gama, J., et al. (2014). A survey on concept drift adaptation. ACM Computing Surveys (CSUR), 46(4), 1–37.",
- "Lu, J., et al. (2018). Learning under concept drift: A review. IEEE Transactions on Knowledge and Data Engineering, 31(12), 2346–2363.",
- "Kim, T., et al. (2022). Reversible instance normalization for accurate time-series forecasting against distribution shift (RevIN). ICLR.",
- "Bouchaud, J. P., et al. (2018). Trades, quotes and prices: financial markets under the microscope. Cambridge University Press.",
- "López de Prado, M. (2018). Advances in financial machine learning. John Wiley & Sons.",
- "Carpenter, G. A., & Grossberg, S. (1987). A massively parallel architecture for a self-organizing neural pattern recognition machine. CVGIP, 37(1), 54–115.",
- "Mermillod, M., Bugaiska, A., & Bonin, P. (2013). The stability-plasticity dilemma. Frontiers in Psychology, 4, 504.",
- "Parisi, G. I., et al. (2019). Continual lifelong learning with neural networks: A review. Neural Networks, 113, 54–71.",
- "McCloskey, M., & Cohen, N. J. (1989). Catastrophic interference in connectionist networks. Psychology of Learning and Motivation, 24, 109–165.",
- "Ratcliff, R. (1990). Connectionist models of recognition memory. Psychological Review, 97(2), 285–308.",
- "Kirkpatrick, J., et al. (2017). Overcoming catastrophic forgetting in neural networks (EWC). PNAS, 114(13), 3521–3526.",
- "Zenke, F., Poole, B., & Ganguli, S. (2017). Continual learning through synaptic intelligence. ICML, 3987–3995.",
- "Li, Z., & Hoiem, D. (2017). Learning without forgetting. IEEE TPAMI, 40(12), 2935–2947.",
- "Rolnick, D., et al. (2019). Experience replay for continual learning. Advances in Neural Information Processing Systems (NeurIPS), 32.",
- "Lopez-Paz, D., & Ranzato, M. A. (2017). Gradient episodic memory for continual learning. NeurIPS, 30.",
- "Hu, E. J., et al. (2022). LoRA: Low-rank adaptation of large language models. ICLR.",
- "Lee, Y., et al. (2023). Surgical fine-tuning improves adaptation to distribution shifts. ICLR.",
- "Pardo, R. (2011). The evaluation and optimization of trading strategies. John Wiley & Sons.",
- "Harvey, C. R., Liu, Y., & Zhu, H. (2016). … and the cross-section of expected returns. The Review of Financial Studies, 29(1), 5–68.",
- "Pham, Q., et al. (2023). Learning fast and slow for online time series forecasting (FSNet). ICLR.",
- "Wen, Q., et al. (2023). Transformers in time series: A survey. IJCAI."
+ ("h1", "1. Introduction: Testing Stability and Plasticity Rigorously"),
+ ("p", "When a billion-parameter model pre-trained on 2010–2023 market microstructure is updated online across 2024 and 2025, three methodological pitfalls must be avoided: (1) In-Sample Evaluation Confusion: Evaluating WF-2024 on 2024 or WF-2025 on 2025 measures in-sample adaptation rather than forward out-of-sample transfer; true backward forgetting requires testing on pre-2024 historical stress periods (such as the March 2020 COVID-19 liquidity crisis and June 2022 Federal Reserve tightening shock), while true forward transfer requires evaluating on strictly held-out 2026 data with paired bootstrap confidence intervals; (2) Tensor-Averaged Cosine Distortion: Computing an unweighted mean of per-tensor cosines across 283 tensors weights 7-parameter bias vectors equally with 11.27M-parameter SwiGLU matrices, violating the global norm inequality cos >= sqrt(1 - δ_F^2); and (3) Adam Step-Size Confounding: Because AdamW normalizes updates by second moments, one must verify whether higher relative drift ||ΔW||_F / ||W||_F in boundary layers reflects genuinely larger absolute parameter updates ||ΔW||_RMS or merely smaller denominator norms ||W||_RMS."),
+ ("h1", "2. Exact Global Cosine Geometry & Adam Plasticity Arithmetic"),
+ ("p", "For any module M_m containing P_m scalar parameters across tensor index set J_m, let ||W_m^(A)||_F and ||W_m^(B)||_F denote the exact Frobenius norms of checkpoints A and B, and let ||ΔW_m||_F = ||W_m^(B) - W_m^(A)||_F. Defining the relative Frobenius drift δ_F = ||ΔW_m||_F / ||W_m^(A)||_F and norm ratio r_m = ||W_m^(B)||_F / ||W_m^(A)||_F, the exact global concatenated inner-product cosine similarity in R^{P_m} is given by the Hilbert-space Law of Cosines:"),
+ ("eq", "cos_exact(W_m^(A), W_m^(B)) = ( ||W_m^(A)||_F^2 + ||W_m^(B)||_F^2 - ||Delta W_m||_F^2 ) / ( 2 ||W_m^(A)||_F ||W_m^(B)||_F ) = (1 + r_m^2 - delta_F^2) / (2 r_m) >= sqrt(1 - delta_F^2)", "1"),
+ ("p", "To separate absolute update magnitude from denominator norm scaling, we decompose δ_F into the ratio of the per-parameter root-mean-square update ||ΔW_m||_RMS and the per-parameter RMS weight norm ||W_m^(A)||_RMS:"),
+ ("eq", "||Delta W_m||_RMS = sqrt( ||Delta W_m||_F^2 / P_m ), ||W_m^(A)||_RMS = sqrt( ||W_m^(A)||_F^2 / P_m ) ==> delta_F(M_m) = ||Delta W_m||_RMS / ||W_m^(A)||_RMS", "2"),
+ ("fig", ("papers/figures/fig3_walk_forward_comparison.png", "Figure 3: (a) Decomposition of relative Frobenius drift into absolute per-parameter RMS update ||ΔW||_RMS vs. base RMS weight norm ||W||_RMS. (b) 7-Horizon mean ROC-AUC across Pre-2024 historical stress cohorts (2020-03 COVID, 2022-06 Rates, 2023-12) and 2024–2026 OOS cohorts.")),
+ ("tbl", (TBL_FROB_EXACT, "Table 1: Exact float64 Law-of-Cosines global cosine similarity, Cauchy-Schwarz lower bound, and per-parameter RMS weight/update decomposition.", [95, 42, 46, 46, 48, 46, 102, 42, 48])),
+ ("p", "Table 1 proves three exact mathematical results: (1) Strict Cauchy-Schwarz Satisfaction: Every single subsystem and global checkpoint pair strictly satisfies cos_exact >= sqrt(1 - δ_F^2), and the larger cumulative drift Ep3->WF25 (0.7860%) corresponds to a strictly lower exact cosine (0.99996911) than Ep3->WF24 (0.5439%, cos_exact = 0.99998521); (2) Genuine Gradient Concentration vs. Adam Arithmetic: The Inception Tokenizer has the largest denominator weight norm in the entire network (||W||_RMS = 0.02574, 1.80x larger than the backbone's 0.01432), yet still exhibits the largest relative drift (1.1773%) because its absolute RMS parameter update (3.030e-4) is 4.00x larger than the backbone (7.575e-5). Furthermore, within the 20 Conformer blocks, GQA Attention (||W||_RMS = 0.01241) and SwiGLU FFN (||W||_RMS = 0.01209) have nearly identical weight norms, yet GQA Attention updates 3.32x more in absolute RMS terms (1.452e-4 vs. 4.374e-5); and (3) Update Vector Orthogonality in R^{1.19x10^9}: The exact cosine between ΔW_{Ep1->Ep2} and ΔW_{Ep2->Ep3} is +0.180473 (79.60°), reflecting coherent pre-training descent, whereas between annual walk-forward updates ΔW_{Ep3->WF24} and ΔW_{WF24->WF25} it is -0.009270 (90.53°), consistent with nearly independent regime adjustments in 10^9 dimensions."),
+ ("h1", "3. Pre-2024 Stress Forgetting Audit & 2026 Paired Bootstrap CIs"),
+ ("tbl", (TBL_FORGETTING, "Table 2: Direct Catastrophic Forgetting Audit on Pre-2024 Historical Stress Regimes (2020-03 COVID, 2022-06 Rates, 2023-12) and Forward 2024–2026 OOS.", [98, 36, 62, 62, 62, 58, 58, 40, 40])),
+ ("tbl", (TBL_BOOTSTRAP, "Table 3: Paired Block-Bootstrap 95% Confidence Intervals (B=500, block=64) for Walk-Forward Adaptation (2026 Forward OOS & Pre-2024 Stress).", [58, 92, 92, 92, 92, 92])),
+ ("p", "Tables 2 and 3 resolve the catastrophic forgetting and forward-transfer questions with statistical precision: (1) Pre-2024 Crisis Retention: Evaluated on 7,896 windows from March 2020 (COVID-19 crash), June 2022 (Fed rate shock), and December 2023, WF-2024 (0.5139 AUC, 50.97% CalAcc) and WF-2025 (0.5135 AUC, 51.10% CalAcc) preserve or slightly exceed Frozen Epoch 3 (0.5130 AUC, 50.90% CalAcc). On the March 2020 COVID-19 crash specifically, WF-2025 significantly improves 1-minute discrimination by ΔAUC = +0.0052 (95% CI [+0.0015, +0.0084], SE = 0.0018) while exhibiting mild 1-day drift (ΔAUC = -0.0164 [-0.0346, +0.0032]); and (2) Strictly Forward 2026 Transfer: On 2026 OOS data (strictly out-of-sample for all checkpoints), WF-2025 achieves a statistically significant 1-minute AUC gain over Frozen Epoch 3 of ΔAUC = +0.0022 (95% CI [+0.0001, +0.0040], SE = 0.0010; 0.5274 -> 0.5296) and WF-2024 achieves +0.0018 [0.0000, +0.0037] at 5m, whereas 30m–1d differences have 95% CIs spanning zero (with 1d CalAcc declining -0.73pp to -0.94pp as 2024–2025 bull-market adaptation confronts the Q1 2026 bear pullback)."),
+ ("h1", "4. Conclusion"),
+ ("p", "By combining exact float64 Law-of-Cosines geometry, per-parameter RMS update decomposition, pre-2024 crisis stress testing, and paired block-bootstrap confidence intervals on 2026, we provide a transparent, mathematically consistent characterization of online walk-forward adaptation in billion-parameter financial models.")
]
compile_paper(
filename="papers/Paper_2_Continual_Walk_Forward_Online_Adaptation.pdf",
- running_header="Airborne AI // Continual Walk-Forward Adaptation & Frobenius Manifold Stability",
- title="Continuous Market Adaptation Without Catastrophic Forgetting: Online Walk-Forward Learning and Frobenius Manifold Stability in Multi-Billion Parameter Financial Foundation Models",
- keywords="Continual Learning, Catastrophic Forgetting, Concept Drift, Walk-Forward Optimization, Frobenius Weight Drift, Financial Foundation Models.",
+ running_header="Airborne AI // Exact Cosine Geometry, Pre-2024 Stress Forgetting & Bootstrap CIs",
+ title="Continual Walk-Forward Adaptation in 1.189B Financial Conformers: Exact Cosine Geometry, Adam Plasticity Arithmetic, and Pre-2024 Crisis Forgetting Audits",
+ keywords="Continual Learning, Catastrophic Forgetting, Exact Cosine Similarity, Adam Plasticity Hierarchy, Block-Bootstrap Confidence Intervals.",
abstract_text=p2_abstract,
elements=p2_elements,
- references=p2_refs
+ references=[
+ "Cont, R. (2001). Empirical properties of asset returns: stylized facts and statistical issues. Quantitative Finance, 1(2), 223–236.",
+ "Lo, A. W. (2004). The adaptive markets hypothesis. Journal of Portfolio Management, 30(5), 15–29.",
+ "Gama, J., et al. (2014). A survey on concept drift adaptation. ACM Computing Surveys, 46(4), 1–37.",
+ "Lu, J., et al. (2018). Learning under concept drift: A review. IEEE TKDE, 31(12), 2346–2363.",
+ "Kim, T., et al. (2022). Reversible instance normalization for accurate time-series forecasting (RevIN). ICLR.",
+ "López de Prado, M. (2018). Advances in financial machine learning. John Wiley & Sons.",
+ "McCloskey, M., & Cohen, N. J. (1989). Catastrophic interference in connectionist networks. Psych. Learning & Motiv., 24, 109–165.",
+ "Kirkpatrick, J., et al. (2017). Overcoming catastrophic forgetting in neural networks (EWC). PNAS, 114(13), 3521–3526.",
+ "Zenke, F., Poole, B., & Ganguli, S. (2017). Continual learning through synaptic intelligence. ICML, 3987–3995.",
+ "Hu, E. J., et al. (2022). LoRA: Low-rank adaptation of large language models. ICLR.",
+ "Lee, Y., et al. (2023). Surgical fine-tuning improves adaptation to distribution shifts. ICLR.",
+ "Kunsch, H. R. (1989). The jackknife and the bootstrap for general stationary observations. The Annals of Statistics, 17(3), 1217–1241.",
+ "Politis, D. N., & Romano, J. P. (1994). The stationary bootstrap. Journal of the American Statistical Association, 89(428), 1303–1313.",
+ "Loshchilov, I., & Hutter, F. (2019). Decoupled weight decay regularization (AdamW). ICLR."
+ ]
)
# =============================================================================
-# PAPER 3: Mechanistic Alpha & Causal Transaction Friction Dynamics
+# COMPILE PAPER 3: Controlled Mechanistic Ablation & Non-Overlapping Frozen-Policy Backtest
# =============================================================================
p3_abstract = (
- "A pervasive failure mode in financial machine learning is the disconnect between statistical predictability and "
- "economic executability after accounting for market microstructure friction, bid-ask spread crossing, exchange fees, "
- "and position turnover. Simultaneously, multi-billion parameter neural architectures are widely treated as opaque black boxes "
- "whose internal temporal frequency reliance remains unquantified. In this paper, we conduct a two-part mechanistic and economic "
- "audit of our 1,189,135,740-parameter (1.189B) Financial Conformer Foundation Model across 2024, 2025, and 2026 "
- "out-of-sample (OOS) data. First, we perform a 7-Horizon Mechanistic Receptive-Field Ablation across all six parallel "
- "1D convolution branches (K in {3, 7, 15, 31, 63, 127} minutes) and three multi-scale groups (Micro K in {3,7}, Meso K in "
- "{15,31}, Macro K in {63,127}) of the Inception tokenizer over 10,560 OOS windows (73,920 horizon predictions). By measuring "
- "both discrete threshold accuracy shifts and Continuous Relative L2 Logit and Return Perturbations (||Δz||_2 / ||z||_2, "
- "||Δr_hat||_2 / ||r_hat||_2), we uncover a Frequency-Horizon Specialization Law: micro-kernels (K=7 and Micro K in {3,7}) "
- "drive the largest continuous output sensitivity (18.23% single-branch and 22.33% group logit L2 shift; 63.60% "
- "return shift), concentrating in 1m–15m horizons (30.91% at 15m for K=7) while leaving 1-day predictions virtually "
- "invariant (4.56%). Conversely, macro-kernels (K=127) govern hard-boundary directional stability (largest single-branch "
- "accuracy drop of -0.11%), while meso-kernels (K in {15,31}) govern probability ranking (largest ROC-AUC drop of -0.0019). "
- "Second, we formulate a Strictly Causal Chronological Execution Backtest with Rolling Confidence Hurdle Filtering "
- "(τ_conf in {0.0σ, 0.5σ, 1.0σ, 1.5σ, 2.0σ} over a strictly causal 256-step trailing window) across one-way transaction costs "
- "of c in {0.0, 1.0, 2.0, 5.0} bps. Applying τ_conf in [1.5σ, 2.0σ] eliminates 94.4%–99.3% of noisy turnover and expands "
- "breakeven fee capacitance to 2.31–9.51 bps, yielding positive post-friction Net Sharpe ratios across 2024 (5m τ=2.0σ: "
- "Gross +6.24 bps/trade, Net Sharpe +4.18 at 0 bps, +2.84 at 1 bps, +1.50 at 2 bps), 2025 (60m τ=1.5σ: Net Sharpe "
- "+0.80 at 0 bps, +0.49 at 1 bps, +0.18 at 2 bps; 1d τ=0.0σ: Net Sharpe +1.11 at 0 bps, +0.90 at 1 bps, +0.69 at 2 bps), "
- "and 2026 (15m τ=2.0σ: Net Sharpe +0.91 at 0 bps, +0.52 at 1 bps, +0.12 at 2 bps)."
+ "Evaluating mechanistic interpretability and economic executability in billion-parameter financial models requires rigorous "
+ "experimental controls against off-distribution clamping artefacts, denominator norm inflation, overlapping multi-period returns, "
+ "and ex-post configuration selection bias. In this paper, we conduct a peer-review-hardened mechanistic and execution audit of "
+ "our 1,189,135,740-parameter Financial Conformer Foundation Model across 24,204 stratified contiguous windows (2024–2026). "
+ "First, we upgrade our 7-horizon Inception tokenizer ablation (K in {3, 7, 15, 31, 63, 127}) with In-Distribution "
+ "Mean-Ablation (clamping each branch to its empirical post-SiLU channel mean rather than zero), Random 341-Channel and "
+ "682-Channel Controls, Variance-Normalized Centered Logit Perturbation (||Δ(z - z_bar)||_2 / ||z - z_bar||_2), and "
+ "Denominator-Free RMS Logit Shift (RMS(Δz)). We prove that the apparent 15m peak in uncentered relative L2 perturbation "
+ "(||Δz||_2 / ||z||_2 = 33.61% at 15m vs. 4.49% at 1d for K=7) is a denominator effect caused by the baseline mean logit "
+ "crossing zero at 15m (z_bar_{15m} = +0.0118, ||z||_RMS = 0.0405) vs. large static base-rate offsets at 1m (z_bar_{1m} = -0.1627, "
+ "||z||_RMS = 0.2041) and 1d (z_bar_{1d} = +0.1275, ||z||_RMS = 0.1285). In denominator-free RMS units, logit sensitivity decays "
+ "monotonically with horizon (0.0403 at 1m -> 0.0213 at 5m -> 0.0136 at 15m -> 0.0058 at 1d for K=7), while in centered L2 units "
+ "every structured branch (21.36%–34.29%) and scale group (37.07%–49.90%) significantly exceeds matched 341-channel (20.31% "
+ "mean-ablate, 10.58% zero-ablate) and 682-channel (30.89% mean-ablate, 14.09% zero-ablate) random controls. Second, we construct "
+ "a Non-Overlapping Contiguous Per-Ticker Backtest (stepping by S_h = ceil(tau_h / 32) windows so 60m and 1d holds never "
+ "overlap) with true State-Dependent Turnover |w_{i,k} - w_{i,k-1}|, compounded percentage drawdowns, Bailey & López de "
+ "Prado (2014) Deflated Sharpe Ratios (DSR) across all M=35 trials, and a Single Frozen 2024 Policy applied "
+ "untouched to 2025 and 2026. While the 2024-selected policy (60m, τ=0.0σ) achieves +2.04 Net Sharpe at 1.5 bps one-way cost in "
+ "2024 (BE = 2.82 bps state-hold) and +1.01 Gross Sharpe in 2025, it decays in 2026 (-2.01 Gross Sharpe). Conversely, a fixed "
+ "demeaned τ=1.0σ rule at 3m and 5m yields positive gross alpha in all three years (3m Gross Sharpe +5.38, +4.91, +3.56; BE "
+ "0.35–0.44 bps), demonstrating consistent pre-cost intraday signal that requires passive maker execution rather than taker crossing."
)
-p3_tbl_abl = [
- ["Ablated Config (B)", "Receptive Scale", "Raw Acc", "Acc Δ", "Bal Acc", "Mean AUC (Δ)", "Logit L2 Shift", "Return L2 Shift", "1m / 5m / 15m / 60m / 1d Logit L2 (%)"],
- ["Unmasked Baseline", "All 6 Branches", "52.11%", "0.00%", "50.59%", "0.5177 (0.0000)", "0.00%", "0.00%", "0.0 / 0.0 / 0.0 / 0.0 / 0.0"],
- ["Mask_K3 (K=3)", "3m Micro Noise", "52.07%", "-0.04%", "50.57%", "0.5180 (+0.0003)", "14.47%", "48.47%", "15.32 / 20.74 / 23.92 / 7.79 / 3.33"],
- ["Mask_K7 (K=7)", "7m Order Flow", "52.10%", "-0.01%", "50.56%", "0.5194 (+0.0017)", "18.23%", "49.53%", "19.58 / 25.40 / 30.91 / 10.31 / 4.56"],
- ["Mask_K15 (K=15)", "15m Momentum", "52.15%", "+0.04%", "50.61%", "0.5165 (-0.0012)", "12.00%", "41.00%", "12.82 / 15.17 / 20.06 / 6.72 / 2.75"],
- ["Mask_K31 (K=31)", "31m Intra-Hour", "52.21%", "+0.10%", "50.61%", "0.5177 (0.0000)", "11.40%", "43.29%", "12.89 / 14.37 / 18.20 / 6.27 / 2.97"],
- ["Mask_K63 (K=63)", "63m Hourly", "52.09%", "-0.02%", "50.56%", "0.5168 (-0.0009)", "11.13%", "41.91%", "12.39 / 14.23 / 18.17 / 6.27 / 2.79"],
- ["Mask_K127 (K=127)", "127m Multi-Hour", "52.00%", "-0.11%", "50.52%", "0.5182 (+0.0005)", "12.34%", "45.03%", "12.34 / 15.72 / 21.84 / 7.12 / 3.07"],
- ["Mask_Micro (3,7)", "Micro Band", "52.15%", "+0.04%", "50.59%", "0.5192 (+0.0015)", "22.33%", "63.60%", "24.61 / 31.34 / 36.11 / 12.16 / 5.54"],
- ["Mask_Meso (15,31)", "Meso Band", "52.20%", "+0.09%", "50.61%", "0.5158 (-0.0019)", "18.69%", "54.13%", "20.66 / 23.62 / 30.69 / 10.61 / 4.54"],
- ["Mask_Macro (63,127)", "Macro Band", "52.02%", "-0.09%", "50.54%", "0.5169 (-0.0008)", "17.59%", "54.23%", "18.12 / 22.46 / 31.28 / 10.22 / 4.44"]
-]
-
-p3_tbl_exec = [
- ["OOS Year & Horizon", "Causal Hurdle", "Active Trd", "Turn. Saved", "Gross / Trd", "Breakeven Fee", "Sharpe 0bp", "Sharpe 1bp", "Sharpe 2bp", "Sharpe 5bp", "MaxDD 0bp"],
- ["2024 1m Horizon", "0.0σ (Unfilt.)", "10,304", "0.0%", "+0.07 bps", "0.06 bps", "+0.88", "-13.38", "-27.49", "-68.18", "0.0439"],
- ["2024 1m Horizon", "1.0σ (Filtered)", "1,954", "81.0%", "+0.16 bps", "0.08 bps", "+1.75", "-19.65", "-40.58", "-98.17", "0.0110"],
- ["2024 5m Horizon", "0.0σ (Unfilt.)", "10,304", "0.0%", "+0.41 bps", "0.32 bps", "+1.82", "-3.90", "-9.60", "-26.47", "0.0563"],
- ["2024 5m Horizon", "2.0σ (High Conv)", "71", "99.3%", "+6.24 bps", "3.12 bps", "+4.18", "+2.84", "+1.50", "-2.48", "0.0036"],
- ["2024 15m Horizon", "0.5σ (Mod Conv)", "6,286", "39.0%", "+4.27 bps", "2.14 bps", "+0.92", "+0.49", "+0.06", "-1.22", "3.1536"],
- ["2025 1m Horizon", "0.0σ (Unfilt.)", "10,304", "0.0%", "+0.10 bps", "0.08 bps", "+1.51", "-15.79", "-32.84", "-80.93", "0.0268"],
- ["2025 1m Horizon", "1.0σ (Filtered)", "1,981", "80.8%", "+0.16 bps", "0.08 bps", "+1.79", "-20.73", "-42.73", "-102.98", "0.0091"],
- ["2025 60m Horizon", "0.0σ (Unfilt.)", "10,304", "0.0%", "+1.28 bps", "0.99 bps", "+0.47", "-0.00", "-0.47", "-1.89", "0.3698"],
- ["2025 60m Horizon", "1.5σ (High Conv)", "579", "94.4%", "+5.14 bps", "2.57 bps", "+0.80", "+0.49", "+0.18", "-0.75", "0.1636"],
- ["2025 1d Horizon", "0.0σ (Unfilt.)", "10,304", "0.0%", "+10.67 bps", "5.34 bps", "+1.11", "+0.90", "+0.69", "+0.07", "0.4534"],
- ["2025 1d Horizon", "1.0σ (Filtered)", "817", "92.1%", "+19.01 bps", "9.51 bps", "+0.62", "+0.55", "+0.49", "+0.29", "0.5177"],
- ["2026 1m Horizon", "1.0σ (Filtered)", "2,003", "80.6%", "+0.54 bps", "0.27 bps", "+4.52", "-12.04", "-28.36", "-74.26", "0.0092"],
- ["2026 15m Horizon", "0.0σ (Unfilt.)", "10,304", "0.0%", "+0.54 bps", "0.37 bps", "+0.44", "-0.75", "-1.94", "-5.50", "0.5419"],
- ["2026 15m Horizon", "2.0σ (High Conv)", "109", "98.9%", "+4.63 bps", "2.31 bps", "+0.91", "+0.52", "+0.12", "-1.05", "0.0365"]
-]
-
p3_elements = [
- ("h1", "1. Introduction: Bridging Neural Waveforms and Execution Reality"),
- ("p", "In institutional quantitative trading, the gulf between a statistically significant forecast and a profitable live book is governed by market microstructure friction [1, 2, 3]. Because the mean absolute move of a 1-minute equity bar is 1.5–3.0 basis points (bps), an unconstrained strategy that flips positions at every bar incurs round-trip transaction costs 2c * |Δw_t| that overwhelm gross alpha whenever one-way slippage c >= 0.5 bps [4, 5]."),
- ("p", "In this paper, we resolve two fundamental questions for our 1,189,135,740-parameter Financial Conformer Foundation Model: (1) Mechanistic Signal Provenance: How do the six receptive fields (K in {3, 7, 15, 31, 63, 127} minutes) of the Multi-Scale Inception Tokenizer contribute across short (1m–15m) vs. macro (60m–1d) horizons? and (2) Causal Friction Survival: How can a zero-look-ahead confidence hurdle filter out low-conviction churn to sustain high Net Sharpe ratios under 1.0–2.0 bps execution fees?"),
- ("h1", "2. Related Work"),
- ("p", "Transaction Costs & No-Trade Regions: Constantinides [6] and Davis and Norman [7] proved that optimal portfolio policies under proportional friction feature a no-trade inaction band. Gârleanu and Pedersen [4], DeMiguel et al. [8], Gu, Kelly, and Xiu [9], and Jensen et al. [5] demonstrated that high-turnover ML signals require explicit turnover regularization or conviction hurdles [10, 11] to survive net of fees."),
- ("p", "Mechanistic Interpretability of Financial Networks: Structured kernel ablation and circuit analysis [12, 13, 14, 15] have been applied to LOB networks by Zhang et al. (DeepLOB) [16], Briola et al. [17], and Murray et al. [18]. Our audit extends continuous L2 and discrete threshold ablation to a 1.189B-parameter Conformer across 7 simultaneous forecast horizons."),
- ("h1", "3. Mechanistic Receptive-Field Decomposition (7-Horizon Audit)"),
- ("p", "To isolate the causal contribution of any subset of Inception branches B subset {3, 7, 15, 31, 63, 127} without retraining, we clamp the output channels Z^(k) (341 channels per branch) to zero prior to linear projection W_proj. Because the 20 subsequent Conformer blocks apply RMSNorm, overall activation scale is continuously re-normalized, meaning discrete sign flips occur only near z=0 while internal representations shift substantially. We therefore measure both discrete accuracy/AUC deltas and Continuous Relative L2 Perturbations across all N=10,560 OOS windows:"),
- ("eq", "P_logit(B, tau) = 100 * ||z_{:,tau}^(\\B) - z_{:,tau}||_2 / ||z_{:,tau}||_2 (%), P_ret(B, tau) = 100 * ||r_hat_{:,tau}^(\\B) - r_hat_{:,tau}||_2 / ||r_hat_{:,tau}||_2 (%)", "1"),
- ("fig", ("papers/figures/fig4_kernel_ablation.png", "Figure 4: (a) Relative Logit L2 Perturbation across ablated Inception kernels and frequency bands for 1m, 15m, and 1d horizons. (b) Comparison of 7-horizon mean Logit L2 Perturbation vs. Continuous Return Forecast L2 Perturbation.")),
- ("tbl", (p3_tbl_abl, "Table 1: Complete 7-horizon mechanistic kernel ablation on the 2024 OOS cohort (10,560 windows; logs/tier1_verified_audit.json).", [72, 54, 34, 38, 34, 58, 44, 44, 132])),
- ("p", "Table 1 and Figure 4 reveal the Frequency-Horizon Specialization Law: (1) Micro-Kernel Intraday Routing: Masking K=7 or Micro (K=3,7) induces massive continuous logit shifts at 1m (24.61%), 5m (31.34%), and 15m (36.11%), but leaves 1-day predictions almost completely invariant (5.54% for Micro, 3.33% for K=3); (2) Macro Boundary vs. Meso Ranking: Masking K=127 causes the largest single-branch hard accuracy drop (-0.11%), whereas masking Meso (K=15,31) causes the largest threshold-independent ROC-AUC drop (-0.0019); and (3) Return Head Sensitivity: The continuous return head experiences ~3x larger L2 perturbations (41.00%–63.60%) than the sigmoid-saturated directional head (11.13%–22.33%)."),
- ("h1", "4. Strictly Causal Chronological Backtest & Transaction Friction Dynamics"),
- ("p", "Let s_tilde_{t,τ} = z_{t,τ} + sign(r_hat_{t,τ})*min(|r_hat_{t,τ}|, 5.0) denote the composite model conviction at step t. To prevent any look-ahead leakage, we standardize s_tilde_{t,τ} using strictly causal rolling mean μ_{t,τ}^(W) and standard deviation σ_{t,τ}^(W) over the trailing W=256 steps {t-256, ..., t-1}, and execute positions w_{t,τ} in {-1, 0, +1} only when |z_hat_{t,τ}^causal| > τ_conf:"),
- ("eq", "z_hat_{t,tau}^causal = (s_tilde_{t,tau} - mu_{t,tau}^(256)) / sigma_{t,tau}^(256); w_{t,tau} = sign(z_hat_{t,tau}^causal) * I(|z_hat_{t,tau}^causal| > tau_conf)", "2"),
- ("eq", "R_{t,tau}^net(c) = w_{t,tau} * y_{t,tau} - c * |w_{t,tau} - w_{t-1,tau}|; c_be(tau_conf) = (sum_t w_{t,tau} y_{t,tau}) / (sum_t |w_{t,tau} - w_{t-1,tau}|) * 10^4 (bps)", "3"),
- ("fig", ("papers/figures/fig5_slippage_friction_curve.png", "Figure 5: (a) Expansion of breakeven one-way fee capacitance (bps) as causal confidence hurdle τ_conf increases from 0.0σ to 2.0σ. (b) Annualized post-friction Net Sharpe survival across c in {0.0, 1.0, 2.0, 5.0} bps slippage.")),
- ("tbl", (p3_tbl_exec, "Table 2: Strictly causal chronological backtest across 2024, 2025, and 2026 under rolling z-score hurdles (logs/tier1_verified_audit.json).", [68, 56, 38, 42, 46, 48, 42, 42, 42, 42, 44])),
- ("p", "Table 2 and Figure 5 prove three institutional execution principles: (1) 1-Minute Maker-Only Execution: While 1m Gross Sharpe is strongly positive in all 3 years (+0.88, +1.51, +0.91 unfiltered; rising to +1.75, +1.79, and +4.52 in 2026 at τ_conf=1.0σ), its 0.06–0.27 bps breakeven fee requires passive limit-order placement rather than market-order crossing; (2) Intraday Hurdle Survival (5m–60m): Filtering at τ_conf in [1.5σ, 2.0σ] cuts noisy turnover by 94.4%–99.3%, lifting expected gross return to +4.63 to +6.24 bps/trade (breakeven fee 2.31–3.12 bps) and achieving positive Net Sharpe at 1.0 bps (+2.84 on 2024 5m, +0.49 on 2025 60m, +0.52 on 2026 15m) and 2.0 bps (+1.50, +0.18, +0.12); and (3) Daily Macro Robustness: At the 1d horizon in 2025, unfiltered gross return is +10.67 bps/trade (breakeven 5.34 bps, Net Sharpe +1.11 at 0bp, +0.90 at 1bp, +0.69 at 2bp, +0.07 at 5bp), reaching +19.01 bps/trade (breakeven 9.51 bps) at τ_conf=1.0σ."),
- ("h1", "5. Conclusion"),
- ("p", "By combining 7-horizon continuous L2 kernel ablation with strictly causal confidence-hurdle backtesting, we have established both the mechanistic interpretability and post-friction economic viability of our 1.189B Financial Conformer Foundation Model.")
-]
-
-p3_refs = [
- "Hasbrouck, J. (2007). Empirical market microstructure. Oxford University Press.",
- "O'Hara, M. (1995). Market microstructure theory. Blackwell Publishers.",
- "Bouchaud, J. P., et al. (2018). Trades, quotes and prices: financial markets under the microscope. Cambridge University Press.",
- "Gârleanu, N., & Pedersen, L. H. (2013). Dynamic trading with predictable returns and transaction costs. The Journal of Finance, 68(6), 2309–2340.",
- "Jensen, T. I., Kelly, B. T., Malamud, S., & Pedersen, L. H. (2022). Machine learning and the implementable efficient frontier. SFI Research Paper.",
- "Constantinides, G. M. (1986). Capital market equilibrium with transaction costs. Journal of Political Economy, 94(4), 842–862.",
- "Davis, M. H., & Norman, A. R. (1990). Portfolio selection with transaction costs. Mathematics of Operations Research, 15(4), 676–713.",
- "DeMiguel, V., et al. (2009). A generalized approach to portfolio optimization. Management Science, 55(5), 798–812.",
- "Gu, S., Kelly, B., & Xiu, D. (2020). Empirical asset pricing via machine learning. The Review of Financial Studies, 33(5), 2223–2273.",
- "Almgren, R., & Chriss, N. (2001). Optimal execution of portfolio transactions. Journal of Risk, 3, 5–40.",
- "López de Prado, M. (2018). Advances in financial machine learning. John Wiley & Sons.",
- "Olah, C., et al. (2020). Zoom in: An introduction to circuits. Distill, 5(3), e00024-001.",
- "Elhage, N., et al. (2021). A mathematical framework for transformer circuits. Transformer Circuits Thread.",
- "Zeiler, M. D., & Fergus, R. (2014). Visualizing and understanding convolutional networks. ECCV, 818–833.",
- "Gulati, A., et al. (2020). Conformer: Convolution-augmented transformer for speech recognition. Interspeech 2020, 5036–5040.",
- "Zhang, Z., Zohren, S., & Roberts, S. (2019). DeepLOB: Deep convolutional neural networks for limit order books. IEEE TSP, 67(11), 3001–3012.",
- "Briola, A., et al. (2021). Deep limit order book forecasting: a microstructural guide. Quantitative Finance, 21(11), 1815–1839.",
- "Murray, K., Xiao, L., & Zohren, S. (2023). Interpreting deep limit order book forecasting models. ACM ICAIF.",
- "Geva, M., et al. (2021). Transformer feed-forward layers are key-value memories. EMNLP, 5484–5495.",
- "Cont, R., Kukanov, A., & Stoikov, S. (2014). The price impact of order book events. Journal of Financial Econometrics, 12(1), 47–88.",
- "Sirignano, J., & Cont, R. (2019). Universal features of price formation in financial markets. Quantitative Finance, 19(9), 1449–1459.",
- "Kelly, B., Malamud, S., & Zhou, K. (2024). The virtue of complexity in return prediction. The Journal of Finance, 79(1), 459–503."
+ ("h1", "1. Introduction: Eliminating Denominator & Selection Biases"),
+ ("p", "Rigorous evaluation of neural trading signals requires addressing two subtle methodological traps: (1) Ablation Denominator & Off-Distribution Bias: Zero-clamping post-SiLU activations shifts the mean input to the linear projection W_proj, and normalizing perturbation norms ||Δz_h||_2 by uncentered ||z_h||_2 artificially inflates sensitivity at horizons where the mean logit z_bar_h is close to zero; and (2) Backtest Overlap, Turnover & Selection Bias: Evaluating 60m or 1d (390m) returns on 32-minute sliding windows double-counts overlapping returns, charging 2c per bar ignores position persistence |w_{i,k} - w_{i,k-1}|, and cherry-picking different (horizon, hurdle) pairs per year inflates out-of-sample Sharpe ratios."),
+ ("h1", "2. Controlled Mechanistic Ablation & Denominator Decomposition"),
+ ("p", "Let f_{t,c} denote channel c in {1..2046} of the concatenated post-SiLU tokenizer output prior to W_proj in R^{2046 x 2048}, with empirical mean μ_c = E_{t}[f_{t,c}]. For any channel subset C (|C|=341 for single branches, |C|=682 for 2-branch groups), we evaluate both In-Distribution Mean-Ablation (f_{t,c} <- μ_c for c in C) and Zero-Ablation (f_{t,c} <- 0), benchmarked against Random 341-Channel and 682-Channel Controls drawn uniformly across all 2,046 channels. For each horizon h, we compute Uncentered Relative L2, Variance-Normalized Centered L2, and Denominator-Free RMS Logit Shift:"),
+ ("eq", "L2_raw(h) = ||Delta z_h||_2 / ||z_h^(0)||_2, L2_cent(h) = ||(Delta z_h) - mean(Delta z_h)||_2 / ||z_h^(0) - mean(z_h^(0))||_2, RMS(Delta z_h) = ||Delta z_h||_2 / sqrt(N)", "1"),
+ ("fig", ("papers/figures/fig4_kernel_ablation.png", "Figure 4: (a) Variance-Normalized Centered Logit L2 Perturbation under In-Distribution Mean-Ablation and Zero-Ablation vs. Random 341ch/682ch Controls. (b) Decomposition of the 15m denominator effect: ||z_h||_RMS reaches its minimum at 15m (0.0405), inflating uncentered L2_raw, whereas denominator-free RMS(Δz_h) decays monotonically.")),
+ ("tbl", (TBL_ABLATION, "Table 1: Controlled 7-horizon mechanistic ablation on the 2024 OOS cohort (N=8,044 windows across 15 tickers; logs/defensible_tier1_audit.json).", [86, 24, 44, 46, 46, 46, 134, 88])),
+ ("p", "Table 1 and Figure 4 establish three rigorous mechanistic results: (1) Proof of the 15m Denominator Effect: Baseline logit RMS is ||z||_RMS = 0.2041 at 1m (mean -0.1627), 0.1017 at 3m, 0.0799 at 5m, 0.0405 at 15m (mean +0.0118), 0.0401 at 30m, 0.0618 at 60m, and 0.1285 at 1d (mean +0.1275). Because ||z||_RMS is 5x smaller at 15m than at 1m, uncentered L2_raw peaks at 15m (33.61% for K=7), whereas denominator-free RMS(Δz_h) decays monotonically with horizon (0.0403 at 1m -> 0.0136 at 15m -> 0.0058 at 1d); (2) Structured Branches Exceed Random Channel Controls: Under Mean-Ablation, every structured kernel (21.36%–34.29% Centered L2) and scale group (Micro 40.20%, Meso 49.90%, Macro 37.07%) exceeds the matched Random 341-Ch (20.31%) and Random 682-Ch (30.89%) controls (and by 2x–3x under Zero-Ablation: 20.19%–32.22% and 31.46%–40.28% vs. 10.58% and 14.09%); and (3) Meso-Scale Ranking vs. Micro Noise: Mean-ablating the Meso band (K=15,31) causes the largest representation shift (49.90% Centered L2, 0.0253 RMS) and largest short-horizon ranking drop (1m ΔAUC = -0.0075, 5m ΔAUC = -0.0035, overall ΔAUC = -0.0017), whereas mean-ablating Micro (K=3,7) slightly improves 1m AUC (+0.0047), indicating that 3–7m kernels pass bid-ask bounce noise."),
+ ("h1", "3. Non-Overlapping Contiguous Backtest, State Turnover & Frozen 2024 Policy"),
+ ("p", "Within each contiguous (shard, ticker) trajectory (spaced by s_win = 32 minutes), we step by S_h = max(1, ceil(tau_h / 32)) windows (S_h = 1 for 1m–30m, S_{60m} = 2 = 64m, S_{1d} = 13 = 416m) so holding periods never overlap. At each step k, we track state-dependent turnover Turn_{i,k} = |w_{i,k} - w_{i,k-1}| (including initial entry from 0 and terminal exit to 0 at shard boundaries) alongside isolated round-trip cost 2|w_{i,k}|, compound portfolio equity E_t = E_{t-1}(1 + R_{p,t}^{net}) across the 15 tickers to compute bounded percentage MaxDD in [0%, 100%], and compute the Bailey & López de Prado (2014) Deflated Sharpe Ratio (DSR) adjusting for skewness, kurtosis, and M=35 trials:"),
+ ("eq", "R_{p,t}^net(c) = (1 / max(5, N_act,t)) * sum_{i=1}^{15} [ w_{i,t} (exp(y_{i,t,h}) - 1) - c * |w_{i,t} - w_{i,t-1}| ], BE_state = Gross_mean / mean(|Delta w|)", "2"),
+ ("fig", ("papers/figures/fig5_slippage_friction_curve.png", "Figure 5: (a) Non-overlapping state-hold breakeven cost (bps) across horizons under a fixed τ=1.0σ demeaned hurdle in 2024, 2025, and 2026. (b) Untouched out-of-sample transfer of the Frozen 2024 Policy (60m, τ=0.0σ) vs. fixed 3m (τ=1.0σ) across execution cost tiers.")),
+ ("tbl", (TBL_BACKTEST, "Table 2: Non-overlapping contiguous backtest of the Frozen 2024 Policy (applied untouched to 2025–2026) and Fixed τ=1.0σ Demeaned Policy across all horizons.", [82, 42, 44, 34, 38, 56, 48, 52, 36, 42, 40])),
+ ("p", "Table 2 and Figure 5 yield three transparent, selection-bias-free conclusions: (1) State-Hold vs. Isolated Breakeven: Because contiguous positions persist across steps when conviction remains in the same direction, average one-way turnover per active step is 0.680–0.873 (for τ=0.0σ) and ~1.60–1.75 (for τ=1.0σ), so true state-hold breakeven cost BE_state = Gross / Turn is 1.15x–2.41x higher than isolated 1-bar round-trip breakeven Gross / 2; (2) Untouched OOS Transfer of Frozen 2024 Policy: The policy maximizing 2024 net Sharpe at 1.5 bps one-way cost is (60m, τ=0.0σ), achieving +4.40 Gross Sharpe and +2.04 Net Sharpe at 1.5 bps (+2.73% compounded return, 1.69% MaxDD, BE_state = 2.82 bps) in 2024. Applied untouched to 2025, it remains gross-profitable (+1.01 Gross Sharpe, +1.12% gross return under WF-2024) but falls below the 1.5 bps fee hurdle (BE_state = 0.49 bps, Net Sharpe -1.95). In Q1 2026, because τ=0.0σ at 60m is long-biased and Q1 2026 experienced a secular drawdown, untouched return is negative (-2.01 Gross Sharpe); and (3) Consistent 3m/5m Intraday Gross Alpha vs. Taker Friction: Under the fixed demeaned τ=1.0σ policy (zero parameter re-selection across years), both 3m (+0.64, +0.75, +0.61 bps/trade; Gross Sharpe +5.38, +4.91, +3.56) and 5m (+0.28, +0.26, +0.66 bps/trade; Gross Sharpe +1.88, +1.15, +2.32) generate positive gross returns in all three years (2024, 2025, 2026). However, because their state-hold breakeven capacitance is 0.35–0.44 bps and DSR across M=35 trials is <= 0.030 on 258 monthly-shard steps, standalone OHLCV bar signals cannot overcome 1.5–3.0 bps taker crossing fees and must be deployed as passive maker/execution-timing overlays."),
+ ("h1", "4. Conclusion"),
+ ("p", "By introducing in-distribution mean-ablation, random-channel controls, denominator-free RMS logit metrics, non-overlapping state-turnover accounting, Deflated Sharpe Ratios, and untouched frozen-policy OOS evaluation, we establish a fully defensible benchmark for billion-parameter financial foundation models.")
]
compile_paper(
filename="papers/Paper_3_Mechanistic_Alpha_and_Execution_Friction.pdf",
- running_header="Airborne AI // Mechanistic Receptive-Field Alpha & Causal Execution Friction",
- title="From Microstructure Waveforms to Executable Alpha: Mechanistic Receptive-Field Decomposition and Causal Transaction Friction Dynamics in Billion-Parameter Neural Forecasting",
- keywords="Mechanistic Interpretability, Convolutional Receptive Fields, Market Microstructure, Transaction Cost Friction, Turnover Filtering.",
+ running_header="Airborne AI // Controlled Mechanistic Ablation & Non-Overlapping Frozen-Policy Backtest",
+ title="Mechanistic Interpretability and Non-Overlapping Execution Economics in 1.189B Financial Conformers: Controlled Kernel Ablations, Denominator Decomposition, and Deflated Sharpe Audits",
+ keywords="Mechanistic Interpretability, In-Distribution Mean-Ablation, Denominator Effect, Non-Overlapping Backtest, Deflated Sharpe Ratio.",
abstract_text=p3_abstract,
elements=p3_elements,
- references=p3_refs
+ references=[
+ "Hasbrouck, J. (2007). Empirical market microstructure. Oxford University Press.",
+ "Bouchaud, J. P., et al. (2018). Trades, quotes and prices: financial markets under the microscope. Cambridge University Press.",
+ "Gârleanu, N., & Pedersen, L. H. (2013). Dynamic trading with predictable returns and transaction costs. The Journal of Finance, 68(6), 2309–2340.",
+ "Bailey, D. H., & López de Prado, M. (2014). The deflated Sharpe ratio: correcting for selection bias, backtest overfitting, and non-normality. Journal of Portfolio Management, 40(5), 94–107.",
+ "López de Prado, M. (2018). Advances in financial machine learning. John Wiley & Sons.",
+ "Constantinides, G. M. (1986). Capital market equilibrium with transaction costs. Journal of Political Economy, 94(4), 842–862.",
+ "Gu, S., Kelly, B., & Xiu, D. (2020). Empirical asset pricing via machine learning. The Review of Financial Studies, 33(5), 2223–2273.",
+ "Almgren, R., & Chriss, N. (2001). Optimal execution of portfolio transactions. Journal of Risk, 3, 5–40.",
+ "Olah, C., et al. (2020). Zoom in: An introduction to circuits. Distill, 5(3), e00024-001.",
+ "Zhang, Z., Zohren, S., & Roberts, S. (2019). DeepLOB: Deep convolutional neural networks for limit order books. IEEE TSP, 67(11), 3001–3012."
+ ]
+)
+
+
+# =============================================================================
+# COMPILE UNIFIED FLAGSHIP MONOGRAPH: Merging All 3 Studies into One Cohesive Paper
+# =============================================================================
+u_abstract = (
+ "We present a unified architectural, continual-learning, mechanistic, and economic audit of the Financial Conformer "
+ "Foundation Model, a 1,189,135,740-parameter (1.189B) hybrid convolution-attention network pre-trained across "
+ "14 calendar years (2010–2023; 168 monthly Parquet shards, 15,030 steps) of 1-minute US equity bars and evaluated across "
+ "32,100 stratified contiguous windows spanning Pre-2024 historical crises (March 2020 COVID-19 crash, June 2022 Fed "
+ "rate shock, December 2023 anchor) and strictly out-of-sample 2024, 2025, and 2026 cohorts across 15 liquid tickers. "
+ "Consolidating our complete checkpoint and telemetry lineage into a single self-contained monograph, we establish four primary "
+ "contributions: (1) Base-Rate & Flat-Bar Decomposition: We prove mathematically and empirically that because 6.46%–7.86% "
+ "of 1-minute bars are exact zero-return flat bars (y=0), strictly positive returns occur on only 46.15%–46.51% of 1m bars, "
+ "causing uncalibrated z > 0 thresholding to collapse to all-down predictions (53.49%–53.85% raw accuracy, matching a "
+ "FlatBar-Down heuristic). Removing this static threshold bias via Strict Non-Zero ROC-AUC (NZAUC), Causal Prior-Calibrated "
+ "Accuracy, and |y|-Quartile Stratification confirms genuine ranking alpha: 1m All-Bar AUC of 0.5375 / 0.5262 / 0.5274, "
+ "1m Strict Non-Zero AUC of 0.5248 / 0.5138 / 0.5159, and active two-sided 5m Non-Zero Accuracy of 51.74% (2024) and "
+ "51.18% (2026); (2) Exact Cosine Geometry, Adam Arithmetic & Pre-2024 Crisis Forgetting: Using the exact float64 "
+ "Hilbert-space Law of Cosines, we show that online walk-forward adaptation shifts global weights by 0.5439% (2024, "
+ "cos_exact = 0.99998521 >= sqrt(1-δ_F^2)) and 0.5725% (2025, cos_exact = 0.99998361) with nearly orthogonal "
+ "annual update vectors (cos = -0.009270, 90.53°). Decomposing drift into RMS weight norm ||W||_RMS and RMS update ||ΔW||_RMS "
+ "proves that the tokenizer's high plasticity reflects 4.00x larger absolute updates (3.030e-4 vs. 7.575e-5) rather than "
+ "small weight norms (||W||_RMS = 0.02574 vs. 0.01432), while Pre-2024 stress tests confirm zero overall forgetting (0.5130 -> "
+ "0.5135 AUC; 2020-03 COVID 1m ΔAUC = +0.0052 [+0.0015, +0.0084]) and 2026 forward bootstrap CIs confirm a significant 1m "
+ "gain (ΔAUC = +0.0022 [+0.0001, +0.0040]); (3) Controlled Mechanistic Ablation: Using in-distribution mean-ablation "
+ "and random 341ch/682ch controls, we prove that the 15m peak in uncentered ||Δz||_2 / ||z||_2 is a denominator effect from "
+ "z_bar_{15m} ≈ 0, whereas denominator-free RMS(Δz) decays monotonically and centered L2 sensitivity significantly exceeds random "
+ "controls, peaking in Meso kernels (K=15,31: 49.90% vs. 30.89% control); and (4) Non-Overlapping Execution Economics: "
+ "Under non-overlapping holding periods, state-dependent turnover, Deflated Sharpe Ratios, and a single frozen 2024 policy, we "
+ "show that while 3m and 5m demeaned signals (τ=1.0σ) achieve positive gross Sharpe across all three years (+3.56 to +5.38 at 3m), "
+ "their 0.35–0.44 bps breakeven capacitance requires passive maker/execution-timing deployment rather than taker spread crossing."
+)
+
+import re
+
+raw_u_elements = (
+ p1_elements[:-2]
+ + p2_elements[2:-2]
+ + p3_elements[2:]
+)
+
+u_elements = []
+sec_idx = 0
+eq_idx = 0
+tbl_idx = 0
+for item in raw_u_elements:
+ kind = item[0]
+ if kind == "h1":
+ sec_idx += 1
+ title_clean = re.sub(r"^\d+\.\s*", "", item[1])
+ u_elements.append(("h1", f"{sec_idx}. {title_clean}"))
+ elif kind == "eq":
+ eq_idx += 1
+ u_elements.append(("eq", item[1], str(eq_idx)))
+ elif kind == "tbl":
+ tbl_idx += 1
+ rows, cap, widths = item[1]
+ cap_clean = re.sub(r"^Table\s+\d+:\s*", "", cap)
+ u_elements.append(("tbl", (rows, f"Table {tbl_idx}: {cap_clean}", widths)))
+ elif kind == "p":
+ txt = item[1]
+ if sec_idx == 5:
+ txt = txt.replace("Table 1 proves", "Table 6 proves")
+ elif sec_idx == 6:
+ txt = txt.replace("Tables 2 and 3 resolve", "Tables 7 and 8 resolve")
+ elif sec_idx == 7:
+ txt = txt.replace("Table 1 and Figure 4", "Table 9 and Figure 4")
+ elif sec_idx == 8:
+ txt = txt.replace("Table 2 and Figure 5", "Table 10 and Figure 5")
+ u_elements.append(("p", txt))
+ else:
+ u_elements.append(item)
+
+
+compile_paper(
+ filename="papers/Paper_Unified_Financial_Conformer_Monograph.pdf",
+ running_header="Airborne AI // Unified 1.189B Financial Conformer Monograph",
+ title="The 1.189-Billion Parameter Financial Conformer: A Unified Empirical Audit of Pre-Training Scaling, Base-Rate Calibration, Continual Walk-Forward Geometry, Controlled Receptive-Field Ablation, and Non-Overlapping Execution Economics",
+ keywords="Financial Foundation Models, Conformer Architecture, Base-Rate Calibration, Continual Walk-Forward Learning, Controlled Mechanistic Ablation, Deflated Sharpe Ratio.",
+ abstract_text=u_abstract,
+ elements=u_elements,
+ references=[
+ "Vaswani, A., et al. (2017). Attention is all you need. NeurIPS, 30, 5998–6008.",
+ "Gulati, A., et al. (2020). Conformer: Convolution-augmented transformer for speech recognition. Interspeech, 5036–5040.",
+ "Ainslie, J., et al. (2023). GQA: Training generalized multi-query transformer models from multi-head checkpoints. EMNLP.",
+ "Su, J., et al. (2024). RoFormer: Enhanced transformer with rotary position embedding. Neurocomputing, 568, 127063.",
+ "Zhang, B., & Sennrich, R. (2019). Root mean square layer normalization. NeurIPS, 32.",
+ "Shazeer, N. (2020). GLU variants improve transformer. arXiv:2002.05202.",
+ "Nie, Y., et al. (2023). A time series is worth 64 words: Long-term forecasting with transformers (PatchTST). ICLR.",
+ "Das, A., et al. (2024). A decoder-only foundation model for time-series forecasting (TimesFM). ICML.",
+ "Ansari, A. F., et al. (2024). Chronos: Learning the language of time series. TMLR.",
+ "Kim, T., et al. (2022). Reversible instance normalization for accurate time-series forecasting (RevIN). ICLR.",
+ "Cont, R. (2001). Empirical properties of asset returns: stylized facts and statistical issues. Quantitative Finance, 1(2), 223–236.",
+ "Sirignano, J., & Cont, R. (2019). Universal features of price formation in financial markets. Quantitative Finance, 19(9), 1449–1459.",
+ "Zhang, Z., Zohren, S., & Roberts, S. (2019). DeepLOB: Deep convolutional neural networks for limit order books. IEEE TSP, 67(11), 3001–3012.",
+ "Bouchaud, J. P., et al. (2018). Trades, quotes and prices: financial markets under the microscope. Cambridge University Press.",
+ "Gu, S., Kelly, B., & Xiu, D. (2020). Empirical asset pricing via machine learning. The Review of Financial Studies, 33(5), 2223–2273.",
+ "Kelly, B., Malamud, S., & Zhou, K. (2024). The virtue of complexity in return prediction. The Journal of Finance, 79(1), 459–503.",
+ "Kirkpatrick, J., et al. (2017). Overcoming catastrophic forgetting in neural networks (EWC). PNAS, 114(13), 3521–3526.",
+ "Lee, Y., et al. (2023). Surgical fine-tuning improves adaptation to distribution shifts. ICLR.",
+ "Kunsch, H. R. (1989). The jackknife and the bootstrap for general stationary observations. The Annals of Statistics, 17(3), 1217–1241.",
+ "Gârleanu, N., & Pedersen, L. H. (2013). Dynamic trading with predictable returns and transaction costs. The Journal of Finance, 68(6), 2309–2340.",
+ "Bailey, D. H., & López de Prado, M. (2014). The deflated Sharpe ratio: correcting for selection bias, backtest overfitting, and non-normality. Journal of Portfolio Management, 40(5), 94–107.",
+ "López de Prado, M. (2018). Advances in financial machine learning. John Wiley & Sons."
+ ]
)
-print("\n🏆 All 3 Tier-1 Academic Paper PDFs Compiled Successfully!")
+print("\n🏆 All 4 Peer-Review-Hardened PDF-1.7 Manuscripts Compiled & Copied to /home/ultron/Downloads/paper/!")