TAQ: Trade-Aware Quantizer for Behavioral State
Inference and Adaptive Market Design from Trade
Execution Data
Technical Report
TYLER LEONARD
TA QUANT RESEARCH LABS
January 2026
Abstract
Financial markets are traditionally modeled either as stochastic price processes driven by information arrival or as equilibrium outcomes of optimizing agents. Both views abstract away the rich heterogeneity and temporal structure of trader behavior observable at the level of trade execution. In this work, we introduce TAQ (Trade-Aware Quantizer), a pretrained foundation model for multivariate trade execution time series that infers low-dimensional behavioral representations capturing execution style, aggressiveness, stability, and regime sensitivity.
We formalize behavior as a latent variable within a partially observable dynamical system and learn behavioral embeddings through self-supervised sequence modeling on large-scale order flow data. These embeddings enable economically interpretable segmentation of market participants and serve as the basis for adaptive market mechanisms. We further demonstrate how TAQ-derived behavioral states can be mapped into deterministic exchange controls, fee schedules, and incentive mechanisms without relying on price prediction or profit optimization.
Our framework unifies market microstructure, behavioral finance, and modern representation learning, providing both a theoretical lens on endogenous market dynamics and a practical blueprint for behavior-aware market design. TAQ emphasizes interpretability, auditability, and regulatory alignment, establishing behavioral inference as a foundational layer for next-generation financial infrastructure.
1. Introduction
Modern electronic markets generate vast volumes of high-frequency execution data describing how participants interact with prices, liquidity, and one another. Despite this richness, most quantitative models reduce market behavior to aggregate order flow statistics or price-based signals, treating individual trader behavior as either noise or an unobservable externality. This abstraction limits both theoretical understanding and practical market design, particularly in environments characterized by rapid regime changes, liquidity fragmentation, and heterogeneous participant objectives.
Empirical studies in market microstructure have long documented that different classes of traders such as market makers, informed traders, and liquidity demandersexert distinct effects on prices and liquidity. However, these classifications are typically static, coarse, and imposed ex ante. In practice, individual participants frequently shift execution style in response to volatility, risk constraints, or strategic pressure. Capturing such dynamics requires models that treat behavior itself as an object of inference rather than a fixed assumption.
In parallel, recent advances in machine learning have demonstrated the power of sequence models and representation learning for extracting structure from complex temporal data. While these methods have been applied extensively to price forecasting and portfolio construction, their use in modeling trader behavior remains limited. Moreover, most existing approaches focus on predictive accuracy rather than interpretability, economic grounding, or regulatory suitability.
This paper proposes a different perspective. We model financial markets as systems of interacting behavioral agents and focus on inferring latent behavioral states directly from execution-level time series. Rather than predicting future prices or optimizing trading performance, the objective is to understand how participants act under varying market conditions and how these actions collectively shape market outcomes.
Our main contribution is TAQ, a tokenizer-based foundation model pretrained on massive trade execution datasets that produces high-quality behavioral embeddings for downstream market design tasks. Our contributions are threefold:
- We introduce a formal latent-state model of trader behavior inferred from sequences of trade execution events conditioned on market context.
- We demonstrate how learned behavioral embeddings enable stable and economically meaningful segmentation of market participants, capturing both short-term tactical behavior and long-term strategic identity.
- We show how these behavioral signals can be integrated into adaptive yet deterministic market mechanisms, including fee schedules, throttles, and incentive systems, without compromising transparency or fairness.
2. Related Work
The proposed framework draws on and extends several strands of prior research, including classical market microstructure theory, behavioral finance, agent-based modeling, and recent advances in time-series representation learning.
Traditional microstructure models, such as those based on informed trading and inventory risk (Kyle, 1985; Glosten and Milgrom, 1985), characterize order flow using stylized assumptions about trader types and information asymmetry. While analytically tractable, these models typically assume fixed behavioral roles and do not account for within-agent behavioral variation over time.
Behavioral finance relaxes strict rationality assumptions and introduces psychological and institutional frictions (Kahneman and Tversky, 1979; Shleifer, 2000), yet often lacks a direct link to high-frequency execution data. Empirical behavioral studies frequently rely on aggregate statistics or survey-based proxies rather than direct observation of trading actions.
Agent-based models (LeBaron, 2006; Farmer and Foley, 2009) provide a flexible framework for simulating heterogeneous agents but depend heavily on hand-specified strategies and parameters. As a result, their realism and empirical grounding are often limited.
More recently, deep learning models for time-series data have achieved state-of-the-art performance in forecasting and representation learning. The Chronos family of models (Ansari et al., 2024) demonstrated that treating time series as a language and applying transformer architectures enables powerful zero-shot forecasting. Self-supervised contrastive learning approaches, including InfoNCE-based methods (van den Oord et al., 2018) and temporal contrastive coding (Yue et al., 2022), have shown remarkable success in learning representations from unlabeled time series data.
Our work bridges these domains by using modern sequence modeling techniques to infer latent behavioral states from real execution data, while maintaining explicit economic interpretation and applicability to market mechanisms.
3. Framework Overview
At a high level, the proposed system consists of four conceptual layers:
- Raw market and execution data are transformed into event-level feature sequences that separate market context from trader actions.
- A temporal encoder infers latent behavioral representations from these sequences using self-supervised learning.
- Behavioral embeddings are aggregated and segmented to identify persistent behavioral regimes and their dynamics.
- Inferred behavioral states are consumed by deterministic control and incentive mechanisms within the market infrastructure.

This layered architecture ensures that behavioral inference remains modular, interpretable, and decoupled from enforcement logic.
4. Data and Problem Formulation
We assume access to raw trade execution records from a financial market, comprising both market-level price series and user-specific trade events. Concretely, we represent each trading session ( i ) as a multivariate time series
Figure 2: Example order book depth chart for BTC/USD showing bid-ask liquidity distribution, illustrating the market context features captured in our data representation.

Sessions are partitioned from continuous trade logs using fixed-length intervals or sliding windows.
Figure 3: Bitcoin price chart with cumulative volume delta (CVD) profile showing bull/bear divergences, exemplifying the behavioral signals extracted from order flow data.
For self-supervised pretraining, we apply masking and standard time-series augmentations (jittering, scaling, permutation, cropping).
5. Latent Behavioral State Model
We postulate that each session ( i ) is characterized by an unobserved behavioral state ( Z_i ). Formally, the generative model is ( p(Z_i) p(X_i \mid Z_i) ), but we treat the problem as non-generative inference.
We define an encoder ( f_\theta ) and projection head ( g_\phi ):
[ af{H}i = f\theta(X_i, M_i), \quad e_i = g_\phi(\a{H}_i) \in \a{R}^{d_z}. ]
Figure 4: Generalized linear latent variable modeling framework showing the five-stage pipeline from response distribution selection through model diagnostics to final inference.

6. Learning Objective and Training Procedure
We use a combined contrastive + reconstruction objective. For a batch of sessions, we generate two augmented views and apply the InfoNCE loss:
[ \z{L}{\u{contrast}} = -\sum{i=1}^{B} \log \z[ \frac{\exp(\z{sim}(e_i^{(1)}, e_i^{(2)})/\tau)}{\sum_{j=1}^{B} \exp(\z{sim}(e_i^{(1)}, e_j^{(2)})/\tau)} \right] ]
We also add a masked reconstruction (Huber) loss ( \a{L}_{\z{recon}} ). The total loss is
[ \a{L} = \a{L}{\text{contrast}} + \lambda \mathcal{L}{\text{recon}}. ]
Figure 5: Time series tokenization approach inspired by Chronos.

7. Behavioral Segmentation and Dynamics
Embeddings ( {e_i} ) are clustered (HDBSCAN / spectral clustering) to discover behavioral archetypes.
Figure 6: UMAP and t-SNE visualizations of behavioral embeddings showing distinct cluster structures.

Behavioral drift is quantified as ( D_t^u = |e_t^u - e_{t-1}^u|_2 ).
Figure 7: Drift exponent (1/E) over years showing temporal stability of behavioral patterns.

8. Behavior-Aware Market Mechanisms
Behavioral embeddings ( z_i ) are mapped deterministically to exchange controls.
Figure 8: Simulated liquidation heatmap for Bitcoin showing concentrated leverage zones.

8.1 Dynamic Fees
[ f_i = f_0 + \alpha \cdt h(z_i) ]
8.2 Adaptive Incentives
Rewards/rebates ( r(z_i) ) encourage desirable behavior (e.g., stable liquidity provision).
8.3 Trust-Based Throttling
Reputation score ( T_i = g(z_i) ) controls order delays and position limits.
9. Theoretical Implications
Markets are modeled as stochastic games with partially observable agents. Behavioral controls bias the evolutionary dynamics of the embedding distribution ( \mu_t ) toward stable equilibria.
10. Methods Appendix
10.1 Detailed Input Encoding
- Market Context Features: mid-price, spread, order-book imbalance, volatility, CVD, trade arrival rate.
- User Action Features: order indicators, side, type, size, cancellation rate, fill rate.
- Temporal Features: time-of-day / day-of-week encodings.
10.2 Augmentation and Masking Strategy
Four augmentations with specified probabilities (jittering, scaling, permutation, masking 15–25 % of timesteps).
Figure 9: TAQ encoder architecture.

10.3 Encoder Architecture
TCN backbone + 4 transformer layers + mean pooling + MLP projection.
10.4 Training Setup
- AdamW, LR warmup to ( 1 \times 10^{-4} ), cosine decay.
- Batch size 4096, 500 k steps on 8×A100 GPUs.
10.7 Pretraining Datasets
| Dataset | Frequencies | # Series | Domain | Source |
|---|---|---|---|---|
| Binance Futures OHLCV | 1s, 1min, 5min, 1h | 8,500 | Crypto Perpetuals | Binance API (2020-2025) |
| Hyperliquid Order Flow | Tick-level, 1s | 150,000 | DeFi Perpetuals | Hyperliquid Archive |
| dYdX Chain Trades | 1s, 1min | 85,000 | DeFi Spot/Perps | dYdX Chain Explorer |
| NASDAQ TAQ (sample) | Millisecond | 12,000 | US Equities | Historical TAQ |
| CME Futures | 10ms, 1s | 6,800 | Traditional Futures | CME Datamine |
| Total | — | ~503,000 | — | — |
Table 1: Real multivariate and univariate datasets used for pretraining TAQ.
10.8 Experimental Evaluation
Table 2: TradeExec-Bench results (MASE).
| Model | Win Rate (%) | Skill Score (%) | Runtime (s) | Failures |
|---|---|---|---|---|
| TAQ (ours) | 89.2 | 52.1 | 1.8 | 0 |
| Chronos-2 | 87.9 | 35.5 | 3.6 | 0 |
| TiRex | 75.1 | 30.0 | 1.4 | 0 |
| TimesFM-2.5 | 74.4 | 30.3 | 16.9 | 0 |
| Stat. Ensemble | 44.2 | 15.7 | 690.6 | 11 |
11. Conclusion and Future Directions
TAQ establishes behavioral inference as a foundational, interpretable layer for next-generation market infrastructure. Three primary contributions:
- Principled latent-state modeling of trader behavior.
- Economically meaningful segmentation and dynamics analysis.
- Deterministic, behavior-aware market mechanisms.
Limitations and Future Directions (multi-agent modeling, portfolio-level inference, real-time deployment, regulatory applications, cross-market transfer) are discussed in the full text.
References
(Full reference list as provided in the original paper, including Kyle (1985), Glosten & Milgrom (1985), Chronos papers, etc.)
Acknowledgments
We thank the Chronos team, public market data archives, and the Hyperliquid / dYdX communities.



