← Latest papers
💰 quantitative finance

From Index to Equity: Pre-Training Transformers for Stock Return Prediction

This paper demonstrates that pre-training a transformer model on the Toronto Stock Exchange index significantly improves its ability to predict individual stock return directions and values compared to LSTM and XGBoost benchmarks, despite the latter achieving higher average daily returns in practice.

Original authors: Marie Soehl Coolsaet, Roberto Gallardo, Zhen Gao

Published 2026-05-26
📖 5 min read🧠 Deep dive

Original authors: Marie Soehl Coolsaet, Roberto Gallardo, Zhen Gao

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to predict the weather for a specific, tiny neighborhood. It's incredibly chaotic; one house might be sunny while the one next door is getting hail. Now, imagine trying to predict the weather for an entire country first. The big picture is much smoother and easier to understand because the wild swings of individual neighborhoods average out.

This paper is about using a super-smart computer brain (called a Transformer) to predict stock prices, and the authors discovered that it's best to teach this brain the "country-level" weather before asking it to predict the "neighborhood-level" weather.

Here is the breakdown of their journey:

1. The Problem: The Stock Market is Chaotic

Predicting if a single stock will go up or down tomorrow is like trying to guess the exact path of a single leaf blowing in a hurricane. The market is messy, changes constantly, and is full of noise. Traditional computer models (like LSTMs and XGBoost) have tried to solve this, but they often struggle because they are learning from scratch every time they look at a new stock.

2. The Solution: The "Apprentice" Strategy (Pre-Training)

The authors decided to try a new teaching method called Transfer Learning. Think of it like training a master chef:

  • Step 1 (Pre-Training): Instead of teaching the chef how to cook a specific, weird dish immediately, you first have them practice on a giant, smooth batch of soup (the TSX Market Index). The soup represents the entire stock market. It's less chaotic than a single stock. The chef learns the general rules of cooking (how flavors interact, how heat works) without getting distracted by one weird ingredient.
  • Step 2 (Fine-Tuning): Once the chef understands the basics of the big soup, you hand them a specific, tricky recipe (a single stock). Because they already know the fundamentals, they learn the specific recipe much faster and better than if they had started from zero.

3. The Tools: Transformers vs. The Old Guard

The team used a modern AI architecture called a Transformer (the same kind of technology that powers tools like ChatGPT). They compared it against older, reliable tools:

  • LSTM: An older type of AI good at remembering sequences.
  • XGBoost: A powerful statistical tool that builds many decision trees to find patterns.
  • Ensemble: A "committee" that averages the predictions of all the above models.

4. What They Found (The Results)

The experiment had two main goals: guessing the direction (Up or Down) and guessing the exact value (How much it goes up).

  • The "Direction" Game (Classification):

    • When the Transformer tried to learn a single stock from scratch, it was confused and performed poorly.
    • When they used the "Apprentice Strategy" (pre-training on the big market index first), the Transformer got much better at guessing if a stock would go up or down.
    • However, the old-school XGBoost model was still the best at simply getting the "Up or Down" guess right.
  • The "Exact Value" Game (Regression):

    • When trying to predict the exact percentage of the return, the Fine-Tuned Transformer and the Fine-Tuned LSTM beat the XGBoost model. They were more accurate at calculating the specific number.
    • But here is the twist: Even though the Transformer was more accurate at calculating the number, the Ensemble model (the committee) actually made the most money in a simulated trading test.
    • Why? The Transformer was very careful and predicted numbers very close to zero (safe bets), while the XGBoost/Ensemble models were willing to bet on stocks with bigger swings. In the stock market, sometimes being "safe" means you miss out on the big wins.

5. The Real-World Tool

The researchers didn't just stop at theory. They built a live trading app (using a tool called Streamlit).

  • You can type in a stock ticker (like "TD" or "RY").
  • The app grabs the latest data, runs it through their models, and tells you which 5 stocks look like they will go up the most and which 5 look like they will crash.
  • It's like having a weather app that gives you a daily forecast for your personal portfolio.

The Bottom Line

The paper concludes that while no model is perfect (the stock market is still very hard to predict), teaching the AI on the big market picture first helps it understand the small pictures better.

The Transformer model is a strong contender for understanding the nuance of stock movements, but the "old school" methods (like XGBoost) and "committee" approaches still hold the crown for making the most profit in this specific test. The authors plan to make the Transformer even bigger and smarter in the future, perhaps by teaching it to read global news and economic reports, not just past price charts.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →