TL;DR
When modeling thousands of time series simultaneously—such as stocks in an equity universe or consumer loans in a credit pool—capturing shared market shocks or contagion without choking on computational costs is a massive challenge. Set-Sequence solves this by inserting a permutation-invariant "Set" pooling module at each time step to summarize cross-sectional dynamics in linear time, then feeding these learned summaries alongside unit features into standard sequence models (e.g., Transformers, S4, or LongConv). The approach eliminates manual feature engineering, scales gracefully to varying numbers of units, and yields substantial empirical gains across synthetic contagion tasks, portfolio optimization, and mortgage default prediction.
What Problem Does This Paper Address?
Predictive modeling in economics, finance, and engineering often involves large cross-sections of individual time series: predicting default for 100,000 mortgages or forecasting returns for thousands of equities. These settings present a difficult two-dimensional challenge:
- Temporal dynamics: How an individual unit evolves over time.
- Cross-sectional dependencies: Shared unobserved factors, peer effects, or market-wide contagion.
Directly modeling the joint distribution across $M$ units with $d$ features over $T$ steps produces an intractable $M \times d$ feature space per step, leading to quadratic computational blowup ($\mathcal{O}((Md)^2)$) if using conventional cross-attention. Consequently, practitioners typically train models on individual units independently, patching cross-sectional effects via hand-engineered macro features (e.g., regional unemployment or aggregate foreclosure rates). This requires deep domain expertise and frequently misses latent, non-linear cross-unit interactions.
Methods
Set-Sequence exploits cross-sectional exchangeability—the premise that individual unit identities (e.g., specific stock tickers or loan IDs) do not dictate dynamics; only their observed features and the state of the broader population matter.
Individual Units X^i_t ────► [Set Module: Linear Pooling] ────► Summary F_t
│
[Unit Features X^i_t , Summary F_t] ──► [Sequence Backbone (LongConv/Transformer)] ──► Prediction Y^i_{t+1}
The model decouples cross-sectional and temporal modeling:
- Set Module (Cross-Sectional Aggregation): At each time step $t$, recent chunks of unit features $X^i_{(t-L, t)}$ pass through an embedding network $\phi$. A permutation-invariant aggregation operator (mean pooling) computes a low-dimensional population state summary: $$F_t = \rho\left(\frac{1}{M} \sum_{i=1}^M \phi(X^i_{(t-L, t)})\right) \in \mathbb{R}^r$$
- Feature Augmentation & Sequence Module: Each unit's covariate vector is concatenated with $F_t$ and projected via $\psi([X^i_t, F_t]^T)$ before being processed independently by an off-the-shelf sequence backbone (such as LongConv, S4, or a Transformer).
Key Architectural Strengths
- Linear Complexity: Cross-sectional pooling runs in $\Theta(TMd)$ time, avoiding the quadratic $\Theta(T M^2 d)$ overhead of multi-head cross-sectional attention.
- Expressivity Guarantee: By Proposition 2 (via the Stone–Weierstrass theorem), pooled polynomial moments up to degree $k$ can approximate any continuous, permutation-invariant cross-sectional statistic on compact domains.
- Dynamic Inference: The architecture natively handles unaligned series and differing pool sizes at test time without retraining.
Datasets
The authors evaluate Set-Sequence across three high-dimensional benchmarks:
- Synthetic Contagion Environment: 1,000 exchangeable units over 100 steps experiencing default contagion governed by a latent rate $\lambda_t$.
- Equity Portfolio Optimization: 36,600 U.S. equities from CRSP (filtering to the top 500 liquid stocks by market cap per 8-year rolling train window, evaluated 2002–2021) with 79 normalized firm-characteristic features.
- Mortgage Risk Classification: CoreLogic Loan-Level dataset spanning 4 major ZIP codes in the greater Los Angeles area (117,523 loans; ~5 million loan-month transitions from 1994 to 2022) with 52 dynamic loan-level and macroeconomic features.
Key Insights and Ideas
- Linear Aggregation Beats Expensive Attention: While multi-head attention across units (MHA-Seq) marginally improves accuracy on small datasets, it costs $3.3\times$ more training time and $3.5\times$ more memory. Simple linear set pooling is far more practical for massive datasets without meaningful performance sacrifice.
- Unsupervised Latent Recovery: The learned low-dimensional set representations automatically reconstruct hidden macroscopic factors. In the synthetic task, the set representation correlated up to $\rho = 0.951$ with the true unobserved contagion factor $\lambda_t$. On mortgage data, the set summary reached a $0.67$ correlation with the actual empirical foreclosure rate without explicit supervision.
- Backbone Agnostic: Augmenting single-unit models with the Set module universally reduced error across five distinct temporal backbones (Transformer, S4, H3, Hyena, and LongConv).
Key Results
- Synthetic Contagion: Set-Sequence reduced KL divergence to true transition probabilities by $4.4\times$ to $10.2\times$ compared to single-unit baselines and approached the performance of an oracle Kalman Filter upper bound.
- Equity Portfolio Construction:
- Over the 2002–2021 test window, Set-Sequence achieved an annualized Sharpe ratio of $4.82 \pm 0.12$, outperforming the best sequence baseline (S4 at 3.94) and LongConv (3.64).
- On the 2002–2016 benchmark, Set-Sequence achieved a Sharpe ratio of 5.91, a 42% improvement over the domain-specific CNN-Transformer benchmark (4.17). Under realistic transaction costs, Set-Sequence retained the highest net Sharpe ratio (2.46).
- Mortgage Default Prediction: Set-Sequence attained a test cross-entropy of 0.200 and an average multi-state AUC of 0.683, outperforming both standard temporal baselines and domain-specific 5-layer neural networks (0.642 AUC), improving AUC in 22 out of 25 state transitions.
Limitations and Future Work
- Assumption of Exchangeability: The architecture assumes unit identities do not matter beyond observed features. While suitable for loans and large pools of liquid equities, this assumption breaks down in systems where specific node identities or fixed sparse topologies dominate (e.g., supply chain graphs).
- Dataset Scope: The mortgage evaluation was restricted to 4 high-volume California ZIP codes due to computational constraints rather than the entire 30,000 ZIP-code dataset.
- Irregular Time Grids: The model currently relies on regular time discretizations with padding for variable start/end dates. Extending the framework to continuous-time event streams remains an open direction.
Summary updated