[KongchangAI]
· 4 min read· 2,289 words

TimesFM Explained: Google's Time Series Foundation Model and Browser Deployment in Practice

TimesFM Explained: Google's Time Series Foundation Model and Browser Deployment in Practice

Google's open-source time series foundation model TimesFM enables zero-shot forecasting and can be compressed to run in the browser.

TimesFM is a decoder-only time series foundation model open-sourced by Google Research, pre-trained on approximately 100 billion data points, capable of zero-shot forecasting with quantile intervals without training on new series. Version 2.5 supports a 16,384-step context with 200M parameters under the Apache-2.0 license. The community project webTimesFM compresses the model to 261 MB (8-bit) or 146 MB (4-bit) via ONNX quantization, completing 128-step forecasts in 50–300 ms in the browser using WebGPU/WASM. Tests show it excels at regular patterns like trends, seasonality, and cycles, but cannot foresee shocks beyond the data such as pandemics or wars; for price series, uncertainty intervals are often more valuable than point forecasts.

One-Sentence Understanding of TimesFM: ChatGPT for Numbers

TimesFM (Time Series Foundation Model), open-sourced by Google Research, is an AI model specifically designed for time series data. Give it a sequence of numbers arranged in time order—daily sales, monthly rainfall, hourly electricity consumption, or stock prices—and it can predict what will happen next and provide a probability interval.

Its most distinctive feature is that it requires no training. TimesFM has already learned the patterns of trends, seasonality, and cycles from approximately 100 billion real-world data points, and can directly produce forecasts for sequences it has never seen before—this is what's known as zero-shot forecasting. The model originally comes from the ICML 2024 paper "A decoder-only foundation model for time-series forecasting," and the code and weights prior to version 2.5 are open-sourced under the Apache-2.0 license.

In one sentence: TimesFM is like ChatGPT, except what it reads and writes isn't text—it's numbers.

TimesFM time series forecasting illustration

What Is a Time Series Foundation Model

A Foundation Model typically has several characteristics: pre-trained once on ultra-large-scale diverse data, general-purpose rather than tailored to a single task, ready out of the box (zero-shot), and fine-tunable as needed. GPT, Gemini, and Claude are foundation models in the text domain, while TimesFM belongs to the time series domain. Other players in this space include Amazon's Chronos, Salesforce's Moirai, Lag-Llama, and Nixtla's TimeGPT.

Key Differences from Traditional Methods

DimensionTraditional Models (ARIMA/Prophet/ETS)TimesFM
Training approachFit each series individuallyTrain once, generalize
Barrier to entryRequires data scientists to tune parametersPaste numbers and forecast
Knowledge scopeOnly knows the current seriesHas seen millions of patterns
UncertaintySingle line or fitted intervalBuilt-in quantiles (10%–90%)
Suitable scenariosFew critical series with time for tuningMany series, tight deadlines, short histories

This comparison reveals TimesFM's true value proposition: it's not about replacing carefully tuned traditional models, but about driving the marginal cost of forecasting at scale down to near zero.

Zero-shot forecasting refers to a model making predictions directly on entirely new sequences without any additional training or fine-tuning specific to the target series. It relies on cross-domain pattern knowledge accumulated during pre-training, treating the new series as yet another "context" to be completed. This stands in sharp contrast to traditional supervised learning, which typically requires collecting labeled data and retraining for each task. Zero-shot capability allows TimesFM to remain usable in scenarios with extremely short historical data or where there's simply no time for modeling—but it also means its performance is limited by the pre-training distribution: when encountering patterns or structural breaks rarely seen during training, the reliability of zero-shot predictions drops noticeably.

Quantile forecasting outputs the values of future numbers at different probability levels—for example, the 10th, 50th, and 90th percentiles—rather than a single point prediction. A 10%–90% interval means the model believes there's an 80% probability that the future value falls within that range. Compared to giving just a median line, quantiles can directly express uncertainty, making them useful downstream for inventory buffers, risk budgeting, or anomaly alerts. Each output step of TimesFM comes with multiple quantiles built in, which is precisely why it's more valuable than point forecasting on difficult-to-predict series such as prices.

Architecture Breakdown: GPT's Skeleton, Numbers' Flesh and Blood

TimesFM is a decoder-only transformer, belonging to the same architectural family as GPT, Gemini, and Llama—the family pioneered by Google's 2017 paper "Attention Is All You Need." Google's key modification lies in the definition of a "token":

  • In language models, input tokens are words or subwords, and the task is to predict the next word;
  • In TimesFM, input tokens are patches of 32 consecutive numbers, and the task is to predict the next 128 numbers.

Using patches rather than single-value inputs (PatchTST takes a similar approach) makes reading long histories cheap; outputting a long output patch of 128 steps at once makes forecasting faster and more stable.

TimesFM 2.5 Internal Configuration

According to the model's public configuration, version 2.5 has approximately 200 million parameters, 20 transformer layers, a model width of 1280 with 16 attention heads, an input patch of 32 steps, a single output of 128 steps, and a maximum context of 16,384 data points. Each output step produces 9 quantiles, and there's an optional quantile head supporting forecasts up to 1,024 steps. When the forecast horizon exceeds 128 steps, the model feeds its own predictions back in and runs another round—similar to how chatbots generate text token by token.

The training data mixes Google Trends search interest, Wikipedia page views, synthetic data, and public datasets from electricity, transportation, weather, retail, and economics—this diversity is precisely why a single model can simultaneously forecast CO2, sunspots, store sales, and oil prices.

On the tech stack side, Google trained with JAX (the initial version was based on PaxML), version 2.5 released both Flax (JAX) and PyTorch implementations, running on custom TPUs, with weights hosted on Hugging Face in safetensors format (925 MB for 2.5).

Decoder-only transformer is a Transformer variant that retains only the decoder stack, generating outputs token by token through causal attention (each position can only see left-side context). The GPT series adopts this structure. TimesFM follows this paradigm but replaces "the next word" with "the next segment of numbers," thereby inheriting the scalability of large-model pre-training plus autoregressive generation.

Patch refers to packing consecutive time steps into a single input unit. Language models use subwords as tokens; TimesFM uses 32 consecutive observations as an input patch and 128 values as an output patch. The benefit: the length of attention computation is reduced to 1/32 of the original, dramatically lowering the cost of reading long histories; meanwhile, the output patch provides multi-step forecasts at once, avoiding the error accumulation of point-by-point recursion. Models like PatchTST have also validated the effectiveness of patching for time series modeling.

Version Evolution: Trade-offs from 1.0 to 3.0

VersionScaleMax HistoryKey ChangesWeight License
1.0200M512Original ICML paper versionApache-2.0
2.0500M2048Larger model, more dataApache-2.0
2.5200M16384Smaller but longer memory; continuous quantile head; removed frequency setting; covariate support via XRegApache-2.0
3.0LargerLongerNative multivariate forecasting and covariates; according to Google, leads on fev-bench, TIME, and GIFT-EvalDownloaded weights non-commercial; commercial use via BigQuery ML

This evolution path is worth pondering: 2.5 halved the parameters while extending context by 8x, indicating that Google's judgment is that "long memory + small size" better fits practical deployment needs than "stacking parameters." And 3.0's shift to a non-commercial weight license channels the commercial monetization path into the Google Cloud ecosystem.

Browser Test: Fitting a 200M-Parameter Model into a Webpage

The community project webTimesFM runs TimesFM 2.5 entirely in the browser—no server, no Python, no registration, and data never leaves your machine. Its technical pipeline is: Google's PyTorch weights (safetensors, 925 MB) → converted to ONNX → quantized to 8-bit (261 MB) or 4-bit (146 MB) → ONNX Runtime Web → WebGPU (using the GPU) or WASM (using the CPU) → timesfm.js + GitHub Pages.

On a laptop GPU, a 128-step forecast takes approximately 50–300 milliseconds. The 8-bit version's output is nearly identical to Google's original; the 4-bit version downloads smaller but may drift on short sequences. The project also provides a "Run self-test vs PyTorch" button that uses Google's official Python code to run a comparison verification on your machine—this step is crucial because quantization and the browser-side reimplementation of pre/post-processing can introduce subtle deviations.

Embedding into your own webpage only requires including timesfm.js, loading the ONNX model, and calling model.forecast(history, 128) to obtain the median forecast and quantile arrays.

ONNX (Open Neural Network Exchange) is an open model exchange format used to migrate models between different deep learning frameworks. Weights trained in PyTorch can be exported as an ONNX computation graph and then executed by ONNX Runtime on various hardware backends. ONNX Runtime Web is the browser version of that runtime, supporting both WebGPU and WASM execution paths. WebGPU allows webpages to directly call the GPU for parallel computation, suitable for matrix-multiplication-intensive transformer inference; WASM (WebAssembly) runs on the CPU at near-native speed, serving as a fallback in GPU-less environments. Quantization (8-bit/4-bit) compresses weight size while maintaining numerical approximation, and is the key to fitting a 925 MB model into a browser download budget.

Capability Boundaries: Strong on Patterns, Blind to Events

Every example on the site includes a "Hold back" feature: hide the most recent data, let the model forecast, then score it against the simplest "no change" baseline.

What it excels at is regular patterns. For the CO2 concentration series at Mauna Loa, Hawaii (steady rise + annual cycle), TimesFM's five-year forecast is nearly perfect, beating the "no change" baseline by 95%. For the sunspot cycle of approximately 11 years, the model can read 85 years of history and predict the rise and peak of the next cycle a decade in advance.

Where it fails is shocks beyond the data. In the global extreme poverty rate series, TimesFM sees the steady decline before 2018 and expects it to continue, unable to foresee that the 2020 pandemic would stall progress. The pattern is clear: TimesFM excels at patterns (trend, seasonality, cycles), but for events (pandemics, wars, policy changes) it can only wait until they are reflected in the numbers. For price series, the "no change" baseline is itself extremely hard to beat, and in such cases the uncertainty interval is actually the most valuable output.

Current Affairs Forecasting in Practice: World Series, Oil, and Bitcoin

The "Current affairs" tab points TimesFM at the week's news, with data automatically refreshed daily by GitHub Actions.

World Series win probabilities are composed in three steps: compute Elo strength ratings from every MLB game this season → TimesFM forecasts each team's strength and provides uncertainty intervals → simulate the playoffs 100,000 times in the browser, starting from the actual series score. After the Brewers swept the Dodgers on October 17, the model gave Milwaukee approximately a 71% chance of winning the championship. One detail: TimesFM's intervals only move the odds slightly—the series score and season record do most of the work, and the page honestly states this.

Oil and Bitcoin provide 30-day forecasts with uncertainty intervals, and the page also explains why prices are difficult to predict.

News Sentiment: A Warning Light, Not a Steering Wheel

TimesFM only reads numbers, so the project uses another small model to read headlines: each day, up to 100 Google News headlines per topic (oil, Bitcoin, each playoff team) are scored with VADER and averaged into a "news tone" ranging from −10 to +10.

The key point is that tone does not equal direction. "War escalation" sounds negative, yet it drives oil prices up. Therefore, news never participates in forecasting and serves only as a warning light: when the latest day's tone exceeds twice its normal fluctuation, a ⚠ alert triggers, and a purple "storm interval" is overlaid on the forecast chart, constructed based on the volatility magnitude of the most turbulent period in that price's history.

Replaying the no-hindsight test from August to October, three of five oil news alerts occurred before major Brent crude moves (+7%, +10%, +18%), missing one large jump. Even the storm intervals were too narrow for war-induced spikes. The conclusion: news can tell you when to worry, but not always how much.

VADER (Valence Aware Dictionary and sEntiment Reasoner) is a lightweight sentiment analysis tool based on dictionaries and rules, designed specifically for short social media texts. It combines sentiment lexicons, negations, degree adverbs, punctuation, and capitalization cues to output positive, neutral, negative, and compound scores, usable without training. The article averages its compound scores on headlines into a "news tone" from −10 to +10, precisely leveraging VADER's robustness to short sentences and colloquial expressions. However, VADER only judges the sentiment polarity of text and cannot understand causal directions like "negative news may drive oil prices up," so the project treats tone only as a volatility warning signal, not as forecast input.

Getting Started and Important Disclaimers

To try it directly, open webTimesFM and click "Load model" (a one-time 261 MB download), select an example, and press "Forecast"—all computation happens locally. If you don't want to write code, the Tutorial tab demonstrates how to paste a column of data from Excel/Google Sheets, upload a CSV, choose context and forecast horizon, and use Hold back to check accuracy. Python users can directly use Google's official package at github.com/google-research/timesfm.

A few things must be made clear: webTimesFM is an independent, unofficial community project and is not affiliated with Google; the browser model is an ONNX-quantized conversion of the official weights, not retrained or fine-tuned, and outputs may differ slightly from the official code; price forecasts for oil, Bitcoin, etc. are educational demonstrations, not investment advice—in testing, the model roughly tied with the "no change" guess; World Series odds ignore starting pitchers, injuries, and many other factors, and are likewise not betting advice. Forecasts will be wrong, and often.

The real space TimesFM opens up is this: when a 200M-parameter time series foundation model can be compressed to 261 MB and deliver quantile-bearing forecasts in 50 milliseconds in a browser, the barrier to entry for "forecasting" is completely rewritten. It won't turn everyone into a data scientist, but it will give everyone who has numbers a chance at a serious forecast.

#TimesFM#time series foundation model#zero-shot forecasting#ONNX quantization#browser deployment
Share:

Related articles