You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

CTHULU TNT v2.0

Trading-Native Transformer - A purpose-built neural architecture for financial time-series prediction.

Model Overview

CTHULU TNT (Trading-Native Transformer) v2.0 is a novel neural architecture designed from first principles specifically for financial market prediction. Unlike general-purpose language models adapted for trading, every component is engineered for market dynamics.

Key Innovations

Innovation Description
Temporal-Causal Attention Strict causality with learned temporal decay across micro, trend, and macro timescales
Volatility-Adaptive Temperature Attention softmax temperature adapts to market volatility in real-time
Mixture of Experts (MoE) 3 specialized experts for trending, ranging, and volatile market regimes
Integrated Risk Prediction SL/TP as first-class model outputs, not external calculations
Trading-Specific Embeddings Custom embeddings for price levels, session timing, and market structure

Model Card

Metric Value
Model ID cthulu-tnt-v2.0
Architecture Trading-Native Transformer
Parameters 401,248
Model Size (Q8) ~392 KB
Sequence Length 500 bars
Input Features 27 (OHLCV + Indicators + Sentiment + Time)
Inference Latency <5ms (CPU with AVX2)
Throughput >200 predictions/sec

Architecture

INPUT [Batch, 500, 27]
    β”‚
    β”œβ”€β”€ Price Embedding (5 β†’ 32)
    β”œβ”€β”€ Indicator Embedding (10 β†’ 32)
    β”œβ”€β”€ Sentiment Embedding (7 β†’ 16)
    └── Time Embedding (5 β†’ 16)
           β”‚
           β–Ό
    Combined: 96 dimensions (d_model)
           β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
    β”‚  TRANSFORMER β”‚ Γ— 3 layers
    β”‚  BACKBONE    β”‚
    β”‚  β€’ Pre-LN    β”‚
    β”‚  β€’ 4 heads   β”‚
    β”‚  β€’ RoPE      β”‚
    β”‚  β€’ SwiGLU    β”‚
    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
           β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
    β”‚  MIXTURE OF β”‚
    β”‚   EXPERTS   β”‚
    β”‚  β€’ Trend    β”‚
    β”‚  β€’ Range    β”‚
    β”‚  β€’ Volatile β”‚
    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
           β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
    β”‚   OUTPUT    β”‚
    β”‚   HEADS     β”‚
    β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
    β”‚ Direction   β”‚ β†’ 3-class (long/short/neutral)
    β”‚ Price Delta β”‚ β†’ 3 horizons (1, 5, 20 bars)
    β”‚ Confidence  β”‚ β†’ Bayesian uncertainty
    β”‚ Risk        β”‚ β†’ SL/TP in ATR units
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Parameter Breakdown

Component Parameters
Embeddings 672
Transformer Layers (Γ—3) 360,000
MoE Router 288
Expert FFNs (Γ—3) 39,168
Output Heads 960
Layer Norms 160
TOTAL 401,248

Performance Targets

Metric Target Description
Direction Accuracy >52% Better than random baseline
Profit Factor >1.3 Gross profit / gross loss
Sharpe Ratio >0.5 Risk-adjusted return
Max Drawdown <15% Worst peak-to-trough
Calibration Error <5% Confidence matches accuracy

Usage

Python Integration

from cthulu.model.arch_2.0 import CthulhuTNT, CthulhuConfig

# Load model
config = CthulhuConfig(seq_len=500)
model = CthulhuTNT(config)
model.load("path/to/model.ctml")

# Prepare input: [batch, seq_len, features]
# Features: OHLCV (5) + Indicators (10) + Sentiment (7) + Time (5) = 27
input_data = prepare_market_data(...)

# Inference
outputs = model.forward(input_data)

# Results
direction = outputs['direction_probs']  # [batch, 3] - long/neutral/short
price_delta_1 = outputs['price_delta_1']  # [batch, 1] - 1-bar ahead
price_delta_5 = outputs['price_delta_5']  # [batch, 1] - 5-bars ahead
price_delta_20 = outputs['price_delta_20']  # [batch, 1] - 20-bars ahead
confidence = outputs['confidence']  # [batch, 1] - prediction confidence
stop_loss = outputs['stop_loss']  # [batch, 1] - suggested SL in ATR
take_profit = outputs['take_profit']  # [batch, 1] - suggested TP in ATR

MetaTrader 5 Integration

from cthulu.model.arch_2.0.mt5_bridge import MT5TNTBridge

# Initialize bridge
bridge = MT5TNTBridge(
    model_path="model.ctml",
    symbol="EURUSD",
    timeframe="H1"
)

# Get trading signal
signal = bridge.get_signal()
# Returns: direction, confidence, stop_loss, take_profit

# Full prediction with all outputs
prediction = bridge.predict()

Input Features

Price Features (5)

  • Open, High, Low, Close, Volume (normalized)

Technical Indicators (10)

  • RSI (14-period)
  • MACD (12, 26, 9)
  • ADX (14-period)
  • ATR (14-period)
  • Bollinger Band %B
  • Stochastic %K, %D
  • Volume MA ratio
  • Price momentum
  • Volatility ratio

Sentiment Features (7)

  • Market regime indicator
  • Trend strength
  • Volatility state
  • Session activity
  • Correlation factor
  • News sentiment (if available)
  • Order flow imbalance

Time Features (5)

  • Hour of day (cyclical)
  • Day of week (cyclical)
  • Session indicator (Asian/London/NY)

Training

Data Requirements

  • Minimum: 5 years of M1/M5 data
  • Recommended: 10+ years across multiple pairs
  • Format: OHLCV with timestamps

Training Command

cd model/arch_2.0
python train_tnt.py \
    --epochs 100 \
    --batch-size 64 \
    --learning-rate 0.0001 \
    --data-source mt5 \
    --symbols EURUSD,GBPUSD,USDJPY \
    --dashboard

Training Configuration

TrainingConfig(
    learning_rate=1e-4,
    weight_decay=0.01,
    batch_size=32,
    epochs=100,
    lr_schedule="warmup_cosine",
    warmup_epochs=5,
    early_stopping=True,
    patience=10
)

File Format: CTML

Custom binary format optimized for trading models:

CTML File Structure:
β”œβ”€β”€ Header (64 bytes)
β”‚   β”œβ”€β”€ Magic: "CTML"
β”‚   β”œβ”€β”€ Version
β”‚   β”œβ”€β”€ Section offsets
β”‚   └── CRC64 checksum
β”œβ”€β”€ Metadata (JSON)
β”‚   β”œβ”€β”€ Architecture config
β”‚   β”œβ”€β”€ Training info
β”‚   └── Performance metrics
β”œβ”€β”€ Feature Config (JSON)
β”‚   β”œβ”€β”€ Input normalization
β”‚   └── Output specifications
β”œβ”€β”€ Tensor Index
β”‚   └── Name, shape, dtype, offset
└── Tensor Data
    └── Quantized weights (Q8_0)

Deployment Options

Option Use Case Performance
Python FastAPI Development, prototyping Good
C/C++ Library Production, low-latency Best
WebAssembly Browser deployment Good
MT5 DLL Direct MetaTrader integration Best

Comparison with Other Models

Model Params Latency Trading-Native Risk Output
CTHULU TNT v2.0 401K <5ms βœ… Yes βœ… Yes
TimeGPT 200M ~100ms ❌ No ❌ No
Chronos 710M ~500ms ❌ No ❌ No
PatchTST 1M ~10ms ❌ No ❌ No
Informer 10M ~50ms ❌ No ❌ No

CTHULU Advantages

  1. Purpose-Built: Every component designed for trading, not adapted
  2. Low Latency: Sub-5ms inference enables real-time trading
  3. Compact: 401K params vs millions in generic models
  4. Risk-Aware: Native SL/TP prediction, not post-hoc calculation
  5. Regime-Adaptive: MoE handles different market conditions

Limitations & Risks

⚠️ Trading Financial Instruments Carries Substantial Risk

  • Model predictions are probabilistic, not certain
  • Past performance does not guarantee future results
  • Always use proper risk management
  • Test thoroughly on demo accounts before live trading
  • The authors are not responsible for trading losses

Known Limitations

  • Requires quality data preprocessing
  • Performance may degrade in extreme market conditions
  • Not designed for HFT (sub-millisecond) applications
  • Sentiment features require external data sources

Citation

@software{cthulu_tnt_2026,
  title = {CTHULU TNT: Trading-Native Transformer},
  author = {Shakil, Ali A. and Artifact Research},
  year = {2026},
  version = {2.0.0},
  url = {https://huggingface.co/amuzetnoM/CTHULU}
}

License

AGPL-3.0 - See LICENSE

Links


Built on the Gladius Architectural Mandate

πŸ‘Ύ CTHULU - Autonomous Trading Intelligence

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support