DOSSIERS
FLOCANO LABS · DOSSIER-SLM-01

Executive Policy Alignment & Asymmetric Ruin-Weighted SLMs

Microstructure Tokenization, Semantic Prompt Leakage Forensics & Unified-Memory Edge Inference

Published: September 18, 2026  |  By Nicholas Alexander MacAskill — Founder & CTO, Flocano Labs  |  Canonical: https://www.nicholasmacaskill.com/dossier/continuous-expectancy-slm-orderflow-matrix

Validation Loss
0.059
-96.9% Loss Drop
Local Latency
450ms
Sub-Second Execution
Memory RSS
638 MB
Apple Silicon UMA / 0 Swap
Shadow Capital Risk
$0.00
Zero Live Exposure

1. The Core Thesis: Why Naive LLMs Fail at Market Microstructure

In applied artificial intelligence, Low-Rank Adaptation (LoRA) is an established technique, 4-bit quantization is standard practice, and running MLX on an Apple Silicon unified memory bus is accessible.

Yet, when quantitative engineering teams attempt to deploy Large Language Models directly to live market execution, the failure rate approaches 100%.

This breakdown stems from three structural failure modes:

  • The Representation Mismatch (The "Blind Prompt"): Autoregressive transformers process one-dimensional token sequences. They possess no innate spatial perception of candlestick geometry, liquidity pools, or order book depth. Feeding raw numbers (Open: 63200, High: 63450...) forces the attention mechanism to treat arbitrary byte-pair fragments (63, 20, 0) as semantic text, resulting in severe hallucinations and coin-flip accuracy.
  • The Binary Classification Fallacy: Standard machine learning treats trade classification as binary: 1 = WIN, 0 = LOSS. But market returns are governed by continuous, fat-tailed distributions. A setup that reaches +4.5R Maximum Favorable Excursion (MFE) is structurally distinct from a trade that reaches +0.8R before collapsing into a stop-out. Binary labels erase the continuous geometry of alpha.
  • The Semantic Leakage Mirage:When teams report "95% to 100% accuracy" on retrospective historical holdouts, they almost universally fall victim to semantic prompt leakage: post-trade labels or qualitative conclusions sneak into the prompt, turning a predictive challenge into simple text classification.

This dossier documents the production solution: deploying a 1.5B Small Language Model (SLM) on Apple Silicon unified memory as an Executive Policy Validator and Invariant Firewall, paired with an autonomous Shadow Tournament Lab to verify real forward edge with zero capital risk.

┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                CONTINUOUS ORDER BOOK & PRICE ACTION FEED                               │
│                      (Raw Ticks, Tick Volume, High/Low Wicks, Correlated Baskets)                      │
└───────────────────────────────────────────────────┬────────────────────────────────────────────────────┘
                                                    │
                                                    ▼
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                     LAYER 1: DETERMINISTIC QUANTITATIVE EXTRACTION (The Math Engine)                   │
│   Calculates exact mathematical order book and price action metrics:                                   │
│   1. TEMPORAL:      Killzone window (London Open Drive vs. Asian Consolidation)                        │
│   2. SPATIAL:       Dealing Range percentile (Discount < 35% vs. Premium > 65%)                         │
│   3. KINETIC:       Relative Volume expansion ratio (e.g. 1.8x Institutional vs 0.4x)                  │
│   4. RELATIONAL:    Intermarket SMT correlation (BTC Higher-Low vs. ETH Lower-Low)                     │
│   5. MICROSTRUCTURE: Cumulative Volume Delta (CVD) limit absorption confirmation                       │
└───────────────────────────────────────────────────┬────────────────────────────────────────────────────┘
                                                    │
                                                    ▼
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                    LAYER 2: SPATIAL-TO-LINGUISTIC TRANSLATION (5-Pillar Prompt Matrix)                 │
│   Encodes objective pre-trade metrics into an invariant relational schema:                             │
│   • ARCHETYPE, SESSION, PD ARRAY, VOLUME, SMT CONFLUENCE, HTF STRUCTURE                                │
│   • Strict Prohibition: Zero post-hoc narrative strings ("Market Trap" purged)                         │
└───────────────────────────────────────────────────┬────────────────────────────────────────────────────┘
                                                    │
                                                    ▼
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                 LAYER 3: ASYMMETRIC RUIN SLM & INVARIANT FIREWALL (LoRA on MLX Engine)                 │
│   • Base Architecture: Qwen2.5-Coder-1.5B-Instruct (4-Bit Quantized)                                   │
│   • Hardware Allocation: 638 MB Unified RAM (Apple Silicon M4 GPU Bus)                                 │
│   • Deterministic Alignment Objective:                                                                 │
│     - Asymmetric Ruin Clamping: High Type-I penalty (vetoes speculative traps)                         │
│     - JSON Grammar Enforcement: 100% structured schema compliance                                      │
└───────────────────────────────────────────────────┬────────────────────────────────────────────────────┘
                                                    │
                                                    ▼
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                     LAYER 4: RESILIENT SELF-HEALING GRAMMAR DESERIALIZER                               │
│   Guarantees zero execution drops: Isolated regex token scanning recovers the valid decision           │
│   vector even if low-latency token caps truncate the closing brace.                                    │
└───────────────────────────────────────────────────┬────────────────────────────────────────────────────┘
                                                    │
                                                    ▼
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                   LAYER 5: THE SHADOW TOURNAMENT LAB (Zero-Capital Live Proving Ground)                │
│   • Evaluates live streaming market candles in parallel with live fleet champions                      │
│   • Requires N >= 30 forward paper trades with PF > Champion before live keys                          │
│   • Eliminates holdout mirages with $0.00 capital risk                                                 │
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘

2. The Forensic Discovery: Semantic Prompt Leakage & The Holdout Mirage

During initial R&D benchmarking, the fine-tuned LoRA model delivered what appeared to be an extraordinary result across a 204-trade holdout set: 100.0% Trap Veto Specificity (115 out of 115 retail traps blocked) and 100.0% Win Detection Sensitivity (61 out of 61 winners captured).

In institutional quantitative finance, a 100% holdout score is not celebrated; it triggers an immediate forensic audit for data leakage.

The Forensic Smoking Gun (Dataset Curation Script)
# Forensic source: dataset curation logic
if is_win:
    pd_array_str = "Discount FVG / Bullish Order Block (Wholesale Discount < 35% of dealing range)"
    orderflow_str = "Verified HTF POI Draw on Liquidity, Passive CVD Absorption (Clean Displacement)"
else:
    orderflow_str = f"Market Trap: {trap_match.group(1).strip()}"
    pd_array_str = "Unfavorable Dealing Range (Attempted Long near Equilibrium / Premium)"
Those fields were placed directly into the prompt evaluated by the model:
EVALUATE INSTITUTIONAL SETUP:
PD ARRAY: Unfavorable Dealing Range (Attempted Long near Equilibrium / Premium)
ORDERFLOW: Market Trap: Low SMT divergence or intra-candle friction breached entry zone

The Analytical Breakdown

The model had not developed psychic predictive vision over chaotic price action. It was performing text summarization and rule mapping:

  • When the prompt contained the English token "Market Trap", the model output score: 0.0, verdict: REJECTED.
  • When the prompt contained "Verified HTF POI Draw", the model output score: 9.0, verdict: FLOW_GO.

The Live Execution Vulnerability

In live forward trading, the market's outcome has not yet occurred. The live scanner cannot know in advance whether a developing setup will result in a trap or a clean expansion. If this model had been deployed directly to manage live capital, it would never have encountered the explicit token "Market Trap" in real-time prompts, creating a severe false-positive blind spot that could threaten account drawdown floors.

3. Architectural Innovation: The Two-Tier System & Decoupled Metrics

To resolve the leakage mirage, the architecture was restructured into a strict two-tier separation of concerns:

[Live Streaming Ticks] ──► [Tier 1: Deterministic Math] ──► [Tier 2: Cognitive Invariant SLM] ──► [Trade Vector]
(Extracts Raw Floats)                                    (Applies Policy & Risk Logic)

Tier 1: Deterministic Math Engine

Machine learning models should never calculate percentages or indicator divergences. Deterministic Python modules extract pure numerical floats:

  • DISCOUNT_PERCENTILE: 0.28 (Dealing range % location)
  • RELATIVE_VOLUME: 1.82 (Volume expansion ratio)
  • SMT_DIVERGENCE_STRENGTH: 0.65 (Normalized intermarket delta)
  • SWEEP_WICK_RATIO: 0.72 (Wick length as % of candle)

Tier 2: Cognitive Invariant SLM

The 1.5B SLM receives only objective pre-trade numbers with zero narrative hints:

  • Rule Synthesis: Validates multi-asset confluence during active killzones.
  • Asymmetric Ruin Gating: Clamps high-risk or borderline configurations to 0.00x risk.
  • Structured Output: Emits clean, deterministic JSON with invalidation thesis.

4. The Production Safeguard: The Shadow Tournament Lab ($0 Capital Risk)

To guarantee that no model touches real capital based solely on retrospective holdout metrics, BayesianPivot implements the Champion vs. Challenger Shadow Tournament Lab (ChampionChallengerLab):

┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                       LIVE MARKET SWEEP SCANNER                                        │
└───────────────────────────────────────────────────┬────────────────────────────────────────────────────┘
                                                    │
                               ┌────────────────────┴────────────────────┐
                               ▼                                         ▼
              ┌─────────────────────────────────┐       ┌─────────────────────────────────┐
              │       LIVE FLEET CHAMPION       │       │    LOCAL MLX SHADOW CHALLENGER  │
              │    (Rule-Engine / Production)   │       │     (Qwen2.5-Coder-1.5B LoRA)   │
              ├─────────────────────────────────┤       ├─────────────────────────────────┤
              │ • Real Capital Execution        │       │ • $0.00 Live Capital Risk       │
              │ • Live Account Allocation       │       │ • Real-Time Forward Evaluation  │
              │ • Upcomers Prop Firm Fleet      │       │ • Counterfactual PnL Tracking   │
              └─────────────────────────────────┘       └────────────────┬────────────────┘
                                                                         │
                                                                         ▼
                                                        ┌─────────────────────────────────┐
                                                        │      MANDATORY PROMOTION GATE   │
                                                        │  • N >= 30 Closed Forward Trades│
                                                        │  • Profit Factor > Champion     │
                                                        │  • Win Rate >= Champion         │
                                                        │  • Max Forward Drawdown <= 2.0R │
                                                        └─────────────────────────────────┘
Zero Capital Exposure
The local challenger model processes sweeps concurrently with $0.00 live risk.
Counterfactual Ledger
Every decision, entry price, and stop is recorded in SQLite via CounterfactualTracker.
Empirical Promotion Gate
Requires N >= 30 live forward paper trades with superior PF before allocation.

5. Edge Hardware Profile: Apple Silicon Unified Memory (UMA)

DimensionLocal MLX ArchitectureOperational Advantage
Hardware TargetApple Silicon M4 GPU (UMA Bus)Shared GPU/CPU memory bandwidth
Inference Servermlx_lm.server (Port 8080)Local HTTP endpoint, zero external latency
RAM Footprint638 MB Resident> 5.8 GB headroom remaining
Disk Swap Debt0 bytesZero SSD wear / zero frame drops
Inference Latency~450ms4x - 10x faster than cloud frontier LLMs

6. Resilient Self-Healing Grammar Engine

In autonomous live trading, an unhandled JSONDecodeError resulting from an incomplete token stream halts execution. Under tight latency constraints, small language models can occasionally drop trailing braces when generating detailed reasoning text.

Two-Tier Extraction Pipeline (LocalLLMHandler)
# Tier 1: Direct JSON parsing
try:
    return json.loads(cleaned_output)
except json.JSONDecodeError:
    # Tier 2: Isolated Token Scanner Fallback
    score = re.search(r'"score"\s*:\s*([0-9.]+)', cleaned_output)
    verdict = re.search(r'"verdict"\s*:\s*"([^"]+)"', cleaned_output)
    risk_mult = re.search(r'"risk_multiplier"\s*:\s*([0-9.]+)', cleaned_output)
    reasoning = re.search(r'"reasoning"\s*:\s*"([^"]+)"', cleaned_output)
In production stress-testing against truncated payloads, this fallback mechanism recovered 100% of decision vectors with zero pipeline crashes and zero dropped trades.

7. Engineering Takeaways for Autonomous AI Systems

  1. Beware the 100% Holdout Trap: In applied machine learning, perfection on retrospective test sets is almost always an artifact of target or semantic prompt leakage. True institutional rigor requires auditing the data generation pipeline down to individual token strings.
  2. Separate Math from Semantic Policy: Never ask a language model to compute numbers that deterministic code can calculate in 2 microseconds. Use deterministic code for math, and use the SLM for structured reasoning, policy alignment, and invariant enforcement.
  3. Shadow Mode is Non-Negotiable: Backtests provide proof of concept; only forward paper tournaments under live, uncurated market feeds provide proof of edge.
  4. Local SLMs Provide Institutional Independence: A 1.5B quantized model running on consumer unified memory delivers sub-second inference, deterministic structured outputs, and zero external dependency risk at zero ongoing token cost.
FLOCANO LABS · SOVEREIGN SYSTEMS ENGINEERING · 2026
SIGNAL_DETECTED:"system online // first dossier lesson logged"//TARGET:sovereign layer////////////////////////
ARCHITECTURELAYER
TASTELAYER
IDENTITYLAYER
ABOUTFOUNDER