Skip to main content

Recovering the Volatility Surface from the VIX

The FinTech notebook Pricing Options with Neural Networks fits the implied volatilities of S&P 500 index options with three models: Black-Scholes with a single volatility, a quadratic regression, and a small neural network. It trains on 2024, validates on January to April 2025 and tests on May to August 2025, so its conclusions rest on a single eight-month stretch. This notebook repeats the same procedure over the whole OptionMetrics sample, from 1996 to August 2025, in rolling windows. The data, inputs, models and error measure are those of the FinTech notebook; only the sample and the windows change.

The question is whether the implied volatility surface can be recovered from its level, the VIX, across very different markets: the late 1990s, the financial crisis of 2008, the COVID crash of 2020 and the tariff turmoil of April 2025. Every model is a fit of each day’s surface given that day’s VIX, not a forecast. The VIX is computed from the same day’s S&P 500 options, so the input already contains information about the surface the models try to recover. This holds for the whole sample: the CBOE introduced the current VIX methodology in 2003 and computed the index back to 1990, and the FRED series VIXCLS is that index.

The notebook then asks two questions about the network itself. The first is whether its activation function matters: it compares networks with Softplus units, as in the FinTech notebook, with networks of ReLU units, each trained from three random starting points. The second is whether the network’s prices are free of static arbitrage, and how to repair them when they are not.

Packages and the WRDS function

The wrds_query function is the one from the FinTech notebook. It runs a SQL query on WRDS and saves the result as a parquet file in _data; delete a file to download it again.

import os
import platform
from pathlib import Path

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import psycopg
import torch
import torch.nn as nn
import cvxpy as cp
from psycopg.types.numeric import FloatLoader
from scipy.stats import norm

pd.set_option("display.max_rows", None)

def wrds_username():
    if platform.system() == "Windows":
        pgpass = Path(os.environ["APPDATA"]) / "postgresql" / "pgpass.conf"
    else:
        pgpass = Path.home() / ".pgpass"
    for line in pgpass.read_text().splitlines():
        if line.startswith("wrds-pgdata"):
            return line.split(":")[3]
    raise RuntimeError(f"No WRDS line in {pgpass}; run the password cell in the WRDS notebook first.")

DATA = Path("../_data")

def wrds_query(name, sql):
    file = DATA / f"{name}.parquet"
    if not file.exists():
        with psycopg.connect(host="wrds-pgdata.wharton.upenn.edu", port=9737,
                             dbname="wrds", user=wrds_username(),
                             sslmode="require") as conn:
            conn.adapters.register_loader("numeric", FloatLoader)
            cur = conn.execute(sql)
            df = pd.DataFrame(cur.fetchall(), columns=[c.name for c in cur.description])
        DATA.mkdir(exist_ok=True)
        df.to_parquet(file)
    return pd.read_parquet(file)

The data

OptionMetrics stores one table of option prices per year, from optionm.opprcd1996 to optionm.opprcd2025, and one table of underlying prices per year, optionm.secprd1996 and so on. The S&P 500 index has security ID 108105, and strikes are stored multiplied by 1,000. The filters are those of the FinTech notebook: Wednesdays only; options with a positive bid and an implied volatility; maturities between 7 and 365 days; strikes between 80% and 120% of the index; and out-of-the-money options only, puts with strikes below the index level and calls with strikes at or above it.

The FinTech notebook selects the standard monthly contracts by their symbol, SPX followed by a space. That filter works only from 2010 on. Before the industry adopted the current option symbols in February 2010, OptionMetrics records the old exchange codes, under which the standard SPX contracts appear under several roots (SPX, SPB and others) and, in the early years of the sample, as coded strings that carry no root at all. The settlement method identifies the standard contracts over the whole sample. Standard monthly SPX options are settled on the opening prices of the index on expiration day, while the weekly, end-of-month and quarterly contracts are settled on the closing price. OptionMetrics marks the first with am_settlement = 1. A few morning-settled quarterly contracts traded in early 2007; OptionMetrics flags them with expiry_indicator = 'm', and the condition expiry_indicator IS NULL removes them. Rows are sorted as in the FinTech data.

query = """
    SELECT o.date, o.exdate, o.cp_flag, o.strike_price / 1000.0 AS strike,
           o.best_bid AS bid, o.best_offer AS ask, o.impl_volatility AS iv,
           s.close AS spot, o.symbol
    FROM optionm.opprcd{year} o
    JOIN optionm.secprd{year} s ON s.secid = o.secid AND s.date = o.date
    WHERE o.secid = 108105
      AND EXTRACT(DOW FROM o.date) = 3
      AND o.am_settlement = 1 AND o.expiry_indicator IS NULL
      AND o.best_bid > 0 AND o.impl_volatility IS NOT NULL
      AND o.exdate - o.date BETWEEN 7 AND 365
      AND o.strike_price / 1000.0 / s.close BETWEEN 0.8 AND 1.2
      AND ((o.cp_flag = 'P' AND o.strike_price / 1000.0 < s.close)
        OR (o.cp_flag = 'C' AND o.strike_price / 1000.0 >= s.close))
    ORDER BY o.date, o.exdate, o.cp_flag, o.strike_price
"""
options = pd.concat([wrds_query(f"optionm_spx_wed_{y}", query.format(year=y))
                     for y in range(1996, 2026)], ignore_index=True)
options["date"] = pd.to_datetime(options["date"])
options["exdate"] = pd.to_datetime(options["exdate"])
print(f"{len(options):,} options on {options['date'].nunique()} days, "
      f"{options['date'].min():%B %d, %Y} to {options['date'].max():%B %d, %Y}")
827,000 options on 1530 days, January 10, 1996 to August 27, 2025

Table 1 checks the filter year by year. Every expiration should fall on the third Friday of its month, on the Saturday after it, which is how OptionMetrics recorded the expiration date of these contracts until 2015, or on the Thursday before it when the Friday is a market holiday (Good Friday in 2019, 2022 and 2025, and Juneteenth in 2026). No two rows should share a date, an expiration, a type and a strike. The last column is the share of rows whose symbol starts with SPX followed by a space; where it equals one, the FinTech notebook’s filter keeps the same rows as this one.

year = options["date"].dt.year
first = options["exdate"].dt.to_period("M").dt.start_time
third_friday = first + pd.to_timedelta((4 - first.dt.day_of_week) % 7 + 14, unit="D")
by_year = pd.DataFrame({
    "Options": options.groupby(year).size(),
    "Wednesdays": options.groupby(year)["date"].nunique(),
    "Expirations": options.groupby(year)["exdate"].nunique(),
})
by_year = by_year.join(pd.crosstab(year, options["exdate"].dt.day_name())
                       .reindex(columns=["Thursday", "Friday", "Saturday"], fill_value=0))
by_year["Off the third week"] = ((options["exdate"] - third_friday).dt.days.abs() > 1).groupby(year).sum()
by_year["Duplicates"] = options.duplicated(["date", "exdate", "cp_flag", "strike"]).groupby(year).sum()
by_year["Share SPX symbol"] = options["symbol"].str.startswith("SPX ").groupby(year).mean()
by_year.index.name = "Year"
options = options.drop(columns="symbol")
by_year.round(2)
Options Wednesdays Expirations Thursday Friday Saturday Off the third week Duplicates Share SPX symbol
Year
1996 5682 50 17 0 0 5682 0 0 0.00
1997 7388 52 18 0 0 7388 0 0 0.00
1998 6937 52 18 0 0 6937 0 0 0.00
1999 7263 52 18 0 0 7263 0 0 0.00
2000 6656 52 18 0 0 6656 0 0 0.00
2001 6067 50 18 0 0 6067 0 0 0.00
2002 5632 51 17 0 0 5632 0 0 0.00
2003 5927 52 18 0 0 5927 0 0 0.00
2004 7438 52 18 0 0 7438 0 0 0.00
2005 7957 52 18 0 0 7957 0 0 0.00
2006 9852 52 18 0 0 9852 0 0 0.00
2007 11804 51 19 0 0 11804 0 0 0.00
2008 13799 53 19 0 0 13799 0 0 0.00
2009 13393 52 19 0 0 13393 0 0 0.00
2010 15664 52 19 0 0 15664 0 0 0.63
2011 16602 52 19 0 0 16602 0 0 1.00
2012 17703 51 19 0 0 17703 0 0 1.00
2013 20439 51 17 0 0 20439 0 0 1.00
2014 22685 52 19 0 3717 18968 0 0 1.00
2015 26490 52 19 0 23036 3454 0 0 1.00
2016 26293 52 19 0 26293 0 0 0 1.00
2017 27546 52 19 0 27546 0 0 0 1.00
2018 38462 50 19 155 38307 0 0 0 1.00
2019 45717 51 21 2371 43346 0 0 0 1.00
2020 56331 52 20 0 56331 0 0 0 1.00
2021 77229 52 24 3702 73527 0 0 0 1.00
2022 84416 52 24 4167 80249 0 0 0 1.00
2023 80074 52 24 0 80074 0 0 0 1.00
2024 87457 50 23 3452 84005 0 0 0 1.00
2025 68097 34 20 4958 63139 0 0 0 1.00
Table 1: Standard monthly SPX options in the sample by year. Expirations counts the distinct expiration dates quoted during the year. The weekday columns count rows by the weekday of the expiration date, and Off the third week counts rows that expire more than one day from the third Friday of the month. Duplicates counts rows that repeat a date, expiration, type and strike.

The number of options grows by a factor of about fifteen over the sample, as more strikes and expirations were listed. The training samples of the early windows are therefore much smaller than those of the later ones.

The VIX comes from FRED.

vix = pd.read_csv("https://fred.stlouisfed.org/graph/fredgraph.csv?id=VIXCLS",
                  parse_dates=["observation_date"], index_col="observation_date")["VIXCLS"]
options = options.join(vix.rename("vix"), on="date").dropna()

Each row of options is one option on one Wednesday and one example for the models. The inputs are three columns: log_m, the log of moneyness, \ln(K/S), with K the strike and S the index level that day; T, the time to maturity in years; and vix_dec, that day’s VIX as a decimal. The output is the column iv, the option’s implied volatility as computed by OptionMetrics from the option’s price. For option i quoted on day t, the network is a function f with weights \pmb{\theta}, \hat{\sigma}_i = f\bigl(\ln(K_i / S_t),\; T_i,\; \text{VIX}_t / 100;\; \pmb{\theta}\bigr), and training chooses the weights that minimize the mean squared difference between the prediction \hat{\sigma}_i and the observed implied volatility \sigma_i, \min_{\pmb{\theta}} \; \frac{1}{n} \sum_{i=1}^{n} \bigl(\sigma_i - \hat{\sigma}_i\bigr)^2.

options["log_m"] = np.log(options["strike"] / options["spot"])
options["T"] = (options["exdate"] - options["date"]).dt.days / 365
options["vix_dec"] = options["vix"] / 100
features = ["log_m", "T", "vix_dec"]

Rolling windows

Each window has the lengths of the FinTech split: the models are trained on 12 months, the network’s stopping point is chosen on the next 4 months, and all three models are tested on the 4 months after that. The windows then move forward by 4 months, so that the test periods cover the sample from May 1997 to August 2025 without gaps or overlap. The first window trains on calendar 1996, and the window that trains on calendar 2024 has exactly the FinTech split. Windows whose test months are not all in the data are dropped.

last_month = options["date"].max().to_period("M")
windows, start = [], pd.Timestamp("1996-01-01")
while True:
    edges = [start + pd.DateOffset(months=m) for m in (0, 12, 16, 20)]
    if (edges[3] - pd.Timedelta(days=1)).to_period("M") > last_month:
        break
    windows.append(edges)
    start += pd.DateOffset(months=4)

labels = [f"{e[2]:%b}-{e[3] - pd.Timedelta(days=1):%b %Y}" for e in windows]

def split(edges):
    d = options["date"]
    return [options[(d >= a) & (d < b)] for a, b in zip(edges[:-1], edges[1:])]

print(f"{len(windows)} windows, testing on {labels[0]} to {labels[-1]}")
85 windows, testing on May-Aug 1997 to May-Aug 2025

The error measure is the mean absolute difference between predicted and actual implied volatility, in volatility points: an error of 1.0 means, for example, predicting 16% when the market says 15%.

mae = lambda actual, predicted: 100 * np.mean(np.abs(actual - predicted))

The first two models of the FinTech notebook are fitted by the function baselines. The first is Black-Scholes with one volatility for every option, the VIX. The second is a linear regression of the implied volatility on 1, x, x^2, T, \sqrt{T}, xT, v and xv, with x the log moneyness and v the VIX as a decimal, fitted by least squares on the training sample.

def design(df):
    x, T, v = df["log_m"].to_numpy(), df["T"].to_numpy(), df["vix_dec"].to_numpy()
    return np.c_[np.ones(len(df)), x, x**2, T, np.sqrt(T), x * T, v, x * v]

def baselines(samples):
    beta = np.linalg.lstsq(design(samples["train"]), samples["train"]["iv"], rcond=None)[0]
    return {"Black-Scholes, one volatility": {n: df["vix_dec"].to_numpy() for n, df in samples.items()},
            "Quadratic regression": {n: design(df) @ beta for n, df in samples.items()}}

The third model is the network of the FinTech notebook: inputs standardized with the training sample’s means and standard deviations, two hidden layers of 32 units, and Adam with a learning rate of 0.003 on the full-batch mean squared error for 6,000 epochs, keeping the weights with the lowest validation loss. Each window has six networks: one with Softplus units, \ln(1 + e^z), and one with ReLU units, \max(0, z), for each of three random seeds. Both activations train for the same number of epochs, so that a difference between them cannot come from a difference in training time.

The six networks of a window see the same data, so they are trained together on the GPU. Their weights are stacked along a first dimension, and one batched computation evaluates all six. The loss is the sum of the six mean squared errors. Each network’s weights affect only its own term, and Adam updates each weight using only its own gradient, so training the six together gives the same steps as training each alone. The starting weights are drawn exactly as in the FinTech notebook, by setting the seed and building the network with nn.Sequential, so the Softplus network with seed 0 in the window that trains on 2024 starts from the FinTech notebook’s weights. Without a GPU, the same code runs on the CPU, more slowly.

device = "cuda" if torch.cuda.is_available() else "cpu"
torch.backends.cuda.matmul.allow_tf32 = False
activations = {"Softplus": nn.Softplus, "ReLU": nn.ReLU}
seeds = [0, 1, 2]
networks = [(a, s) for a in activations for s in seeds]

def initial_weights(activation, seed):
    torch.manual_seed(seed)
    act = activations[activation]
    net = nn.Sequential(nn.Linear(3, 32), act(), nn.Linear(32, 32), act(), nn.Linear(32, 1))
    return [p.detach().clone() for p in net.parameters()]

softplus = torch.tensor([a == "Softplus" for a, _ in networks], device=device)[:, None, None]

def forward(params, X):
    """All six networks on the inputs X (n by 3); returns a 6 by n matrix."""
    W1, b1, W2, b2, W3, b3 = params
    act = lambda z: torch.where(softplus, nn.functional.softplus(z), torch.relu(z))
    h = act(torch.einsum("nk,mjk->mnj", X, W1) + b1[:, None, :])
    h = act(torch.bmm(h, W2.transpose(1, 2)) + b2[:, None, :])
    return (torch.bmm(h, W3.transpose(1, 2)) + b3[:, None, :]).squeeze(-1)

def train_window(train, valid):
    mu, sd = train[features].mean(), train[features].std()
    to_x = lambda df: torch.tensor(((df[features] - mu) / sd).to_numpy(), dtype=torch.float32, device=device)
    to_y = lambda df: torch.tensor(df["iv"].to_numpy(), dtype=torch.float32, device=device)
    X_train, y_train, X_valid, y_valid = to_x(train), to_y(train), to_x(valid), to_y(valid)

    start = [initial_weights(a, s) for a, s in networks]
    params = [torch.stack([w[i] for w in start]).to(device).requires_grad_() for i in range(6)]
    opt = torch.optim.Adam(params, lr=0.003)
    best = [p.detach().clone() for p in params]
    best_loss = torch.full((len(networks),), np.inf, device=device)
    best_epoch = torch.zeros(len(networks), dtype=torch.long, device=device)
    for epoch in range(6000):
        opt.zero_grad()
        loss = ((forward(params, X_train) - y_train) ** 2).mean(dim=1)
        loss.sum().backward()
        opt.step()
        with torch.no_grad():
            valid_loss = ((forward(params, X_valid) - y_valid) ** 2).mean(dim=1)
            better = valid_loss < best_loss
            best_loss = torch.where(better, valid_loss, best_loss)
            best_epoch = torch.where(better, epoch, best_epoch)
            for kept, p in zip(best, params):
                kept.copy_(torch.where(better.view(-1, *[1] * (p.dim() - 1)), p, kept))
    return {"weights": [p.cpu().numpy().astype(float) for p in best],
            "best_epoch": best_epoch.cpu().numpy(), "mu": mu, "sd": sd}

The code below trains the six networks of every window, 510 networks in all. Training them took about 40 minutes with an NVIDIA RTX 5000 Ada GPU, so the trained weights are saved in _data and read from there on later runs, as the WRDS data are. Delete the file to train the networks again, which is necessary after any change to the data, the windows or the training code.

file = DATA / "iv_surface_networks.pkl"
if file.exists():
    trained = pd.read_pickle(file)
else:
    trained = {w: train_window(*split(edges)[:2]) for w, edges in enumerate(windows)}
    pd.to_pickle(trained, file)

After training, the function predict evaluates network m of window w with NumPy, so that the evaluation below can run in several processes on the CPU.

def predict(w, m, df):
    t = trained[w]
    X = ((df[features] - t["mu"]) / t["sd"]).to_numpy()
    W1, b1, W2, b2, W3, b3 = (p[m] for p in t["weights"])
    act = (lambda z: np.logaddexp(0, z)) if networks[m][0] == "Softplus" else (lambda z: np.maximum(z, 0))
    h = act(act(X @ W1.T + b1) @ W2.T + b2)
    return (h @ W3.T + b3).ravel()

Static arbitrage is checked on a grid of call prices built from the network’s implied volatilities with the Black-Scholes formula, on every test day. The strikes are 5 index points apart, from 80% to 120% of the index, and the maturities are that day’s quoted expirations, so that every quoted option sits on the grid. As in the FinTech notebook, the interest rate and the dividend yield are set to zero. The forward price then equals the index level, and two calls with the same strike have the same moneyness at every maturity.

Each of three portfolios of calls has a payoff that is never negative, so its price must not be negative either. The first is a call spread, long a call at one strike and short a call at the next strike up. It pays between zero and the difference in strikes, so the call price must fall as the strike rises, but by no more than that difference. The second is the butterfly of the FinTech notebook, whose price is nonnegative when call prices are convex in the strike. The third is a calendar spread, long a call with a later expiration and short a call with the same strike and an earlier expiration. With no interest or dividends, the later call is worth at least as much.

Carr and Madan (2005) show that these three conditions exclude every static arbitrage from a rectangular grid of call prices, provided the grid includes a call with strike zero. That call is the index itself, worth S. It adds one butterfly to the check: long the index, short K_1/\Delta K calls at the first grid strike K_0, and long K_0/\Delta K calls at the second strike K_1, with \Delta K the strike spacing. Its payoff equals the index at maturity up to K_0, falls linearly to zero at K_1 and stays at zero above it, so it is never negative. Its price, S - (K_1/\Delta K)\, C_0 + (K_0/\Delta K)\, C_1, must therefore not be negative either. The strike-zero call also requires the first call to be worth between its intrinsic value and the index level, which every Black-Scholes price satisfies. The grid stops at 120% of the index, so the check says nothing about higher strikes.

Carr, Peter, and Dilip B. Madan. 2005. “A Note on Sufficient Conditions for No Arbitrage.” Finance Research Letters 2 (3): 125–30. https://doi.org/10.1016/j.frl.2005.04.005.

The function conditions returns the prices of all these portfolios, and violations counts the negative ones. It ignores violations smaller than a hundredth of a cent, which are below the precision of the optimization used to repair them.

TOL = 1e-4

def bs_call(S, K, T, sigma):
    d1 = (np.log(S / K) + sigma**2 * T / 2) / (sigma * np.sqrt(T))
    return S * norm.cdf(d1) - K * norm.cdf(d1 - sigma * np.sqrt(T))

def bs_vega(S, K, T, sigma):
    d1 = (np.log(S / K) + sigma**2 * T / 2) / (sigma * np.sqrt(T))
    return S * norm.pdf(d1) * np.sqrt(T)

def conditions(C, K, S):
    """Call spreads, butterflies and calendar spreads on a grid with equally
    spaced strikes K in rows and maturities in columns, including the butterfly
    with the strike-zero call worth S; each must be nonnegative."""
    dK = K[1] - K[0]
    spread = C[:-1] - C[1:]
    out = {"Call spread": [spread, dK - spread],
           "Butterfly": [C[:-2] - 2 * C[1:-1] + C[2:],
                         S - K[1] / dK * C[0] + K[0] / dK * C[1]]}
    out["Calendar"] = [C[:, 1:] - C[:, :-1]] if C.shape[1] > 1 else []
    return out

def violations(C, K, S):
    return {k: int(sum((x < -TOL).sum() for x in xs)) for k, xs in conditions(C, K, S).items()}

A surface with violations is repaired by moving its call prices as little as possible. The function repair_prices minimizes a weighted sum of squared price changes, subject to the conditions above and to each price lying between the call’s intrinsic value and the index level. The constraints are linear in the prices, so this quadratic program always has a solution. A small change \Delta\sigma in an implied volatility changes the call price by about \mathcal{V} \Delta\sigma, where \mathcal{V} = \partial C / \partial \sigma is the option’s vega. The weights are 1/\mathcal{V}^2, which makes a price change of \mathcal{V} \Delta\sigma cost (\Delta\sigma)^2, so the repair moves implied volatilities as little as possible to first order. The vegas are computed at the day’s VIX rather than at the network’s own volatilities, so that a point where the network’s output is wrong does not acquire a large weight through a small vega. They are floored at $0.05 per volatility point, the smallest price increment of most SPX options. The program is solved in the variables \Delta C / \mathcal{V}, which turns the objective into a plain sum of squares. Written in prices, the weights differ by a factor of several thousand across the grid, and the solver stops short of full precision. The repaired prices are then converted back into implied volatilities by bisection, at every grid point whose price changed, however little. A threshold below which changes are ignored would not be safe: the butterfly with the strike-zero call multiplies the first call price by K_1/\Delta K, which is about 0.16 times the index level and exceeds 700 in recent years, so a change too small to matter for one call can create a violation in that butterfly. When the solver finds no solution, the function returns None.

def implied_vol(C, S, K, T):
    lo, hi = np.full_like(C, 1e-4), np.full_like(C, 5.0)
    for _ in range(80):
        mid = (lo + hi) / 2
        above = bs_call(S, K, T, mid) < C
        lo, hi = np.where(above, mid, lo), np.where(above, hi, mid)
    return (lo + hi) / 2

def repair_prices(S, K, Ts, sigma0, vix):
    KK, TT = np.broadcast_arrays(K[:, None], Ts[None, :])
    C0 = bs_call(S, KK, TT, sigma0) / S
    vega = np.maximum(bs_vega(S, KK, TT, vix), 0.05 * 100) / S
    z = cp.Variable(C0.shape)          # price change divided by vega
    c = C0 + cp.multiply(vega, z)
    constraints = [x >= 0 for xs in conditions(c, K / S, 1.0).values() for x in xs]
    constraints += [c >= np.maximum(1 - KK / S, 0) + 1e-12, c <= 1 - 1e-12]
    try:
        cp.Problem(cp.Minimize(cp.sum_squares(z)), constraints).solve(solver=cp.CLARABEL)
    except cp.SolverError:
        pass
    if z.value is None:
        return None
    sigma = sigma0.copy()
    change = vega * z.value
    moved = change != 0
    sigma[moved] = implied_vol(S * (C0 + change)[moved], S, KK[moved], TT[moved])
    return sigma

The function evaluate_network evaluates one trained network. It computes the errors on the three samples, the number of violations on each test day’s grid, and the result of the repair: the number of days on which the solver found no solution, in which case the surface is left unrepaired, the share of grid points whose volatility moved, the largest move, the violations left, and the test error before and after the repair. Both test errors are measured on the quoted options that sit on the grid, so that their difference comes only from the repair. The network’s implied volatilities are floored at 0.1% before they are turned into prices, and the number of grid points where the floor binds is recorded, since a negative implied volatility is a sign that the network is extrapolating.

def evaluate_network(job):
    w, m = job
    activation, seed = networks[m]
    train, valid, test = split(windows[w])
    samples = {"train": train, "valid": valid, "test": test}
    pred = {name: predict(w, m, df) for name, df in samples.items()}
    out = {"window": w, "activation": activation, "seed": seed,
           "best_epoch": int(trained[w]["best_epoch"][m]),
           **{name: mae(df["iv"], pred[name]) for name, df in samples.items()}}

    totals = {k: 0 for k in ["grid", "floored", "Call spread", "Butterfly", "Calendar",
                             "failed", "moved", "left", "off grid"]}
    largest = 0.0
    errors = {"raw": [], "repaired": []}
    for day, d in test.groupby("date"):
        S, v = d["spot"].iloc[0], d["vix_dec"].iloc[0]
        K = np.arange(np.ceil(0.8 * S / 5) * 5, 1.2 * S, 5)
        Ts = np.sort(d["T"].unique())
        grid = pd.DataFrame({"log_m": np.log(np.repeat(K, len(Ts)) / S),
                             "T": np.tile(Ts, len(K)), "vix_dec": v})
        sigma0 = predict(w, m, grid).reshape(len(K), len(Ts))
        totals["grid"] += sigma0.size
        totals["floored"] += int((sigma0 < 1e-3).sum())
        sigma0 = np.maximum(sigma0, 1e-3)
        found = violations(bs_call(S, K[:, None], Ts[None, :], sigma0), K, S)
        for k, n in found.items():
            totals[k] += n

        fixed = repair_prices(S, K, Ts, sigma0, v) if sum(found.values()) else sigma0
        if fixed is None:
            totals["failed"] += 1
            fixed = sigma0
        repaired = {"raw": sigma0, "repaired": fixed}
        change = 100 * np.abs(fixed - sigma0)
        totals["moved"] += int((change > 1e-3).sum())
        largest = max(largest, change.max())
        totals["left"] += sum(violations(bs_call(S, K[:, None], Ts[None, :], fixed), K, S).values())

        i = np.round((d["strike"].to_numpy() - K[0]) / 5).astype(int)
        on = (i >= 0) & (i < len(K)) & np.isclose(K[0] + 5 * i, d["strike"].to_numpy())
        totals["off grid"] += int((~on).sum())
        j = np.searchsorted(Ts, d["T"].to_numpy())
        for method, sigma in repaired.items():
            errors[method].append(np.abs(sigma[i[on], j[on]] - d["iv"].to_numpy()[on]))

    out.update(totals)
    out["largest move"] = largest
    out["test on grid"] = 100 * np.concatenate(errors["raw"]).mean()
    out["test after repair"] = 100 * np.concatenate(errors["repaired"]).mean()
    if activation == "Softplus" and seed == 0:
        out["test predictions"] = pred["test"]
    return out

The code below runs evaluate_network for every trained network, ten at a time in separate processes on the CPU, where the optimizations run. It uses the fork start method, available on Linux and macOS; on Windows, replace the pool by the loop results = [evaluate_network(job) for job in jobs], which gives the same results more slowly. The table nets holds one row per network. Like the trained weights, the results are saved in _data and read from there on later runs. Delete the file to evaluate the networks again, which is necessary after the networks are retrained or after any change to the code that checks and repairs the surfaces.

import multiprocessing as mp

file = DATA / "iv_surface_evaluation.pkl"
if file.exists():
    results = pd.read_pickle(file)
else:
    jobs = [(w, m) for w in reversed(range(len(windows))) for m in range(len(networks))]
    with mp.get_context("fork").Pool(10) as pool:
        results = pool.map(evaluate_network, jobs, chunksize=1)
    pd.to_pickle(results, file)

nets = pd.DataFrame([{k: v for k, v in r.items() if k != "test predictions"} for r in results])
nets["test period"] = [labels[w] for w in nets["window"]]

The sections that follow, up to the comparison of activations, report the three models of the FinTech notebook, with the network that has Softplus units and seed 0. The function summarize collects, for one window, the errors of the three models on each sample, the test errors by moneyness group and the three-month skew on the last test day.

models = ["Black-Scholes, one volatility", "Quadratic regression", "Neural network"]
groups = ["Deep OTM puts", "OTM puts", "Near-money puts", "At the money", "OTM calls"]
reference = {r["window"]: r for r in results if r["activation"] == "Softplus" and r["seed"] == 0}

def summarize(w):
    train, valid, test = split(windows[w])
    samples = {"train": train, "valid": valid, "test": test}
    preds = baselines(samples)
    r = reference[w]
    errors = pd.Series({(model, name): mae(samples[name]["iv"], pred[name])
                        for model, pred in preds.items() for name in samples})
    for name in samples:
        errors[("Neural network", name)] = r[name]
    preds["Neural network"] = {"test": r["test predictions"]}

    bins = pd.cut(test["log_m"], [-0.23, -0.15, -0.08, -0.02, 0.02, 0.19], labels=groups)
    by_m = pd.DataFrame({model: np.abs(test["iv"] - pred["test"])
                         for model, pred in preds.items()}).mul(100).groupby(bins, observed=True).mean()

    day = test["date"].max()
    d = test[test["date"] == day]
    T = d["T"].unique()[np.argmin(np.abs(d["T"].unique() - 0.25))]
    mask = ((test["date"] == day) & (test["T"] == T)).to_numpy()
    skew = test[mask].assign(**{model: pred["test"][mask] for model, pred in preds.items()}).sort_values("log_m")
    return {"errors": errors, "best_epoch": r["best_epoch"], "by_m": by_m, "skew": skew}

fits = [summarize(w) for w in range(len(windows))]

Reproducing the FinTech results

The window that trains on 2024 uses the same data, the same split and the same starting weights as the FinTech notebook. Table 2 compares its errors with the results table of that notebook.

columns = ["Train (2024)", "Validation (Jan-Apr 2025)", "Test (May-Aug 2025)"]
fintech = pd.DataFrame([[4.79, 5.48, 5.08], [1.61, 2.10, 1.87], [1.05, 1.40, 1.03]],
                       index=models, columns=columns)
k = [e[0] for e in windows].index(pd.Timestamp("2024-01-01"))
here = fits[k]["errors"].unstack().loc[models, ["train", "valid", "test"]].round(2)
here.columns = columns
pd.concat({"This notebook": here, "FinTech notebook": fintech,
           "Difference": here - fintech}).round(2)
Train (2024) Validation (Jan-Apr 2025) Test (May-Aug 2025)
This notebook Black-Scholes, one volatility 4.79 5.48 5.08
Quadratic regression 1.61 2.10 1.87
Neural network 1.02 1.39 1.03
FinTech notebook Black-Scholes, one volatility 4.79 5.48 5.08
Quadratic regression 1.61 2.10 1.87
Neural network 1.05 1.40 1.03
Difference Black-Scholes, one volatility 0.00 0.00 0.00
Quadratic regression 0.00 0.00 0.00
Neural network -0.03 -0.01 0.00
Table 2: Mean absolute error in volatility points for the window that trains on 2024, in this notebook and in the FinTech notebook, and the difference.

Errors by window

Table 3 reports each model’s mean absolute error on the training, validation and test samples of every window, with the epoch at which the network’s validation loss was lowest. Figure 1 plots the same errors against time, each at the midpoint of the period its sample covers. The dotted lines mark the failure of Lehman Brothers on September 15, 2008, the VIX’s record close on March 16, 2020, and the tariff announcements of April 2, 2025.

sample_names = {"train": "Train", "valid": "Validation", "test": "Test"}
errors = pd.DataFrame([f["errors"] for f in fits], index=labels).rename(columns=sample_names, level=1)
errors[("Neural network", "Best epoch")] = [f["best_epoch"] for f in fits]
errors.index.name = "Test period"
errors.round(2)
Black-Scholes, one volatility Quadratic regression Neural network
Train Validation Test Train Validation Test Train Validation Test Best epoch
Test period
May-Aug 1997 3.49 3.01 2.58 1.15 1.29 1.75 0.95 0.99 1.81 5755
Sep-Dec 1997 3.36 2.58 4.94 1.06 1.42 2.43 0.76 1.27 2.36 5943
Jan-Apr 1998 3.05 4.94 4.31 1.13 2.92 2.11 1.00 2.90 1.94 1928
May-Aug 1998 3.49 4.31 4.87 1.40 1.87 2.04 1.27 1.33 1.59 5999
Sep-Dec 1998 3.91 4.87 6.36 1.61 1.76 2.85 1.21 1.28 2.65 5869
Jan-Apr 1999 4.71 6.36 4.33 1.62 2.68 2.14 2.30 2.25 1.44 5830
May-Aug 1999 5.15 4.33 4.70 1.68 1.76 2.21 1.51 1.17 1.32 5638
Sep-Dec 1999 5.18 4.70 4.64 1.70 1.91 1.59 1.38 1.12 1.19 5843
Jan-Apr 2000 5.11 4.64 4.23 1.61 1.46 1.88 1.10 1.08 1.68 5716
May-Aug 2000 4.57 4.23 3.41 1.35 1.87 2.03 1.20 1.42 1.94 5693
Sep-Dec 2000 4.54 3.41 4.29 1.50 1.91 2.36 1.17 1.61 1.80 3131
Jan-Apr 2001 4.11 4.29 4.26 1.46 1.86 2.16 1.20 1.35 1.51 5686
May-Aug 2001 3.97 4.26 3.64 1.39 1.54 1.33 0.90 0.94 1.02 5643
Sep-Dec 2001 3.98 3.64 6.08 1.39 1.19 1.99 0.90 0.78 1.12 5834
Jan-Apr 2002 4.07 6.08 3.90 1.24 1.86 1.36 0.74 1.14 1.06 5667
May-Aug 2002 4.64 3.90 5.42 1.49 1.57 1.97 0.81 0.91 1.15 5784
Sep-Dec 2002 4.53 5.42 5.56 1.52 2.12 2.82 0.95 1.15 2.03 5659
Jan-Apr 2003 5.15 5.56 3.96 1.77 2.37 2.14 1.59 1.70 1.51 5351
May-Aug 2003 4.95 3.96 3.13 1.84 1.70 2.03 1.29 1.25 0.86 5901
Sep-Dec 2003 5.01 3.13 3.50 1.77 2.05 2.35 1.28 0.77 0.89 5805
Jan-Apr 2004 4.15 3.50 3.74 1.60 1.94 2.03 0.93 0.94 1.14 5999
May-Aug 2004 3.51 3.74 3.91 1.44 1.55 1.86 0.78 0.95 1.05 5999
Sep-Dec 2004 3.47 3.91 3.69 1.40 1.65 1.60 0.78 0.90 0.84 5849
Jan-Apr 2005 3.72 3.69 3.53 1.46 1.57 1.65 1.10 0.94 1.32 5781
May-Aug 2005 3.78 3.53 3.98 1.43 1.49 1.54 0.92 0.79 0.87 5792
Sep-Dec 2005 3.71 3.98 3.75 1.43 1.51 1.38 0.72 0.78 0.85 5999
Jan-Apr 2006 3.74 3.75 3.54 1.48 1.41 1.45 0.64 0.68 0.64 5870
May-Aug 2006 3.76 3.54 4.17 1.48 1.47 1.47 0.62 0.59 0.96 5999
Sep-Dec 2006 3.76 4.17 4.43 1.47 1.43 1.38 0.63 0.91 0.79 5689
Jan-Apr 2007 3.85 4.43 4.81 1.45 1.42 1.36 0.63 0.71 0.77 5998
May-Aug 2007 4.07 4.81 5.28 1.42 1.33 1.57 0.65 0.70 1.14 5795
Sep-Dec 2007 4.48 5.28 5.00 1.39 1.54 2.10 0.74 0.94 2.10 5782
Jan-Apr 2008 4.86 5.00 4.84 1.43 1.79 2.39 0.92 1.43 1.72 5715
May-Aug 2008 5.03 4.84 4.20 1.44 1.83 2.09 0.98 1.21 1.21 5884
Sep-Dec 2008 5.03 4.20 9.36 1.49 1.74 4.44 1.14 0.95 6.84 5634
Jan-Apr 2009 4.68 9.36 6.08 1.36 4.58 2.77 1.25 5.79 3.01 1014
May-Aug 2009 6.04 6.08 4.78 2.46 2.13 2.11 1.39 2.12 1.51 5889
Sep-Dec 2009 6.50 4.78 4.96 2.66 2.18 2.35 1.78 0.98 1.14 5672
Jan-Apr 2010 6.74 4.96 5.00 2.65 2.51 2.59 1.63 0.89 1.40 5898
May-Aug 2010 5.22 5.00 6.41 1.83 1.75 2.26 1.31 0.89 1.83 5931
Sep-Dec 2010 4.92 6.41 5.25 1.70 2.21 1.79 1.14 1.80 1.27 5675
Jan-Apr 2011 5.47 5.25 5.83 1.76 1.80 2.05 0.90 0.90 1.09 5999
May-Aug 2011 5.56 5.83 6.20 1.70 1.96 2.18 1.04 0.98 1.21 5920
Sep-Dec 2011 5.83 6.20 6.85 1.80 2.09 1.94 1.03 1.13 1.44 5820
Jan-Apr 2012 5.78 6.85 5.67 1.94 2.03 1.72 1.30 1.58 1.25 5824
May-Aug 2012 6.30 5.67 5.22 1.94 1.91 1.92 1.06 0.90 0.97 5540
Sep-Dec 2012 6.23 5.22 4.78 1.89 1.78 1.82 1.02 0.88 0.98 5999
Jan-Apr 2013 5.90 4.78 4.83 1.60 1.76 1.71 1.05 0.99 1.23 5868
May-Aug 2013 5.20 4.83 4.31 1.49 1.58 1.36 1.71 1.09 1.02 5931
Sep-Dec 2013 4.94 4.31 5.07 1.44 1.26 1.66 0.78 0.66 0.80 5818
Jan-Apr 2014 4.62 5.07 5.46 1.32 1.59 1.68 0.62 0.73 0.96 5999
May-Aug 2014 4.71 5.46 5.57 1.38 1.59 1.57 0.60 0.83 0.78 5999
Sep-Dec 2014 4.93 5.57 6.07 1.55 1.61 1.74 0.72 0.69 1.08 5552
Jan-Apr 2015 5.38 6.07 5.70 1.70 1.76 1.61 0.65 0.89 1.14 5944
May-Aug 2015 5.71 5.70 5.75 1.73 1.64 1.69 0.64 1.03 0.90 5999
Sep-Dec 2015 5.78 5.75 6.04 1.64 1.60 1.59 0.72 0.82 0.98 5992
Jan-Apr 2016 5.83 6.04 5.75 1.57 1.56 1.80 0.78 0.89 1.17 5968
May-Aug 2016 5.83 5.75 5.84 1.46 1.62 1.68 0.79 0.87 0.75 5980
Sep-Dec 2016 5.85 5.84 5.65 1.46 1.69 1.66 0.76 0.77 0.86 5896
Jan-Apr 2017 5.88 5.65 5.53 1.49 1.64 1.76 0.71 0.83 1.06 5998
May-Aug 2017 5.75 5.53 6.19 1.53 1.73 1.73 0.96 0.83 1.15 5922
Sep-Dec 2017 5.68 6.19 6.52 1.59 1.65 1.75 0.80 0.83 0.91 5736
Jan-Apr 2018 5.81 6.52 6.18 1.62 1.66 1.88 0.72 0.62 1.66 5906
May-Aug 2018 6.08 6.18 5.92 1.63 2.27 1.66 0.88 1.54 0.73 5372
Sep-Dec 2018 6.28 5.92 6.03 1.79 1.66 2.06 0.61 0.51 1.23 5898
Jan-Apr 2019 6.17 6.03 5.36 1.76 2.03 1.83 0.84 1.16 0.90 5752
May-Aug 2019 6.04 5.36 5.27 1.79 1.79 1.78 0.70 0.69 0.86 5999
Sep-Dec 2019 5.76 5.27 5.65 1.66 1.61 1.98 0.61 0.77 1.18 5979
Jan-Apr 2020 5.53 5.65 9.24 1.57 1.87 3.69 0.85 0.76 3.83 5668
May-Aug 2020 5.43 9.24 6.34 1.44 3.71 2.96 2.94 4.76 4.58 5160
Sep-Dec 2020 6.80 6.34 5.88 2.28 2.38 2.22 2.20 1.93 1.74 4634
Jan-Apr 2021 7.12 5.88 5.92 2.41 2.08 2.13 1.20 1.50 1.24 5877
May-Aug 2021 7.06 5.92 5.97 2.48 2.22 2.15 1.34 1.12 1.11 5999
Sep-Dec 2021 6.02 5.97 6.04 1.81 1.86 1.77 1.21 0.94 1.16 5876
Jan-Apr 2022 5.92 6.04 6.47 1.78 1.67 1.72 0.97 0.88 1.19 5999
May-Aug 2022 5.98 6.47 4.76 1.56 1.79 2.97 0.80 0.91 2.37 5713
Sep-Dec 2022 6.17 4.76 3.98 1.60 2.61 3.39 1.94 1.62 2.32 5769
Jan-Apr 2023 5.77 3.98 4.29 1.71 2.51 1.61 1.88 1.63 2.03 5657
May-Aug 2023 5.12 4.29 5.05 1.73 1.55 2.19 1.41 1.16 1.62 5779
Sep-Dec 2023 4.36 5.05 4.64 1.36 1.73 1.75 1.03 1.06 1.20 5798
Jan-Apr 2024 4.45 4.64 4.39 1.45 1.51 1.83 0.92 0.81 1.00 5617
May-Aug 2024 4.67 4.39 4.73 1.40 1.66 1.80 0.81 0.79 0.84 5983
Sep-Dec 2024 4.69 4.73 5.25 1.48 1.59 1.99 0.74 0.75 1.37 5870
Jan-Apr 2025 4.59 5.25 5.48 1.50 1.76 1.84 0.80 1.10 1.30 5788
May-Aug 2025 4.79 5.48 5.08 1.61 2.10 1.87 1.02 1.39 1.03 5732
Table 3: Mean absolute error in volatility points on the training, validation and test samples of each window, and the epoch with the lowest validation loss. Rows are labeled by the test period.
events = {"Lehman": "2008-09-15", "COVID": "2020-03-16", "Tariffs": "2025-04-02"}
mid = lambda a, b: a + (b - a) / 2

fig, axes = plt.subplots(3, 1, figsize=(8, 8), sharex=True, sharey=True)
for ax, (i, name) in zip(axes, enumerate(["Train", "Validation", "Test"])):
    x = [mid(e[i], e[i + 1]) for e in windows]
    for model in models:
        ax.plot(x, errors[(model, name)], label=model)
    for day in events.values():
        ax.axvline(pd.Timestamp(day), color="0.5", ls=":", lw=1)
    ax.set_ylabel(f"{name}\nMAE (vol points)")
for label, day in events.items():
    axes[0].text(pd.Timestamp(day), 1.02, label, ha="center", fontsize=8,
                 transform=axes[0].get_xaxis_transform())
axes[0].legend(frameon=False, fontsize=8)
plt.show()
Three stacked line charts sharing a time axis from 1996 to 2025, one each for the training, validation and test samples, with one line per model: Black-Scholes with one volatility, the quadratic regression and the neural network. Dotted vertical lines mark September 2008, March 2020 and April 2025. Black-Scholes has the highest error throughout, between about 3 and 9 volatility points on the test samples. The neural network has the lowest error in most windows; on the test samples it rises above the regression in late 2008 and in 2020, when all three models' errors peak.
Figure 1: Mean absolute error of the three models on the training, validation and test samples of each window, in volatility points, plotted at the midpoint of the period each sample covers. Dotted lines mark September 15, 2008, March 16, 2020, and April 2, 2025.

Errors by moneyness

The test errors split by the moneyness groups of the FinTech notebook are in Table 4, Table 5 and Table 6, one table per model, and in Figure 2.

by_m = {model: pd.DataFrame([f["by_m"][model] for f in fits], index=labels).reindex(columns=groups)
        for model in models}
for table in by_m.values():
    table.index.name = "Test period"
by_m[models[0]].round(2)
log_m Deep OTM puts OTM puts Near-money puts At the money OTM calls
Test period
May-Aug 1997 5.12 3.58 1.29 1.17 2.43
Sep-Dec 1997 8.67 5.71 2.23 2.83 6.01
Jan-Apr 1998 10.02 6.55 1.92 1.80 3.75
May-Aug 1998 9.41 6.06 2.31 2.40 5.29
Sep-Dec 1998 10.93 6.28 2.32 3.42 8.07
Jan-Apr 1999 8.92 5.21 1.90 1.85 4.67
May-Aug 1999 10.48 6.80 2.96 2.24 4.03
Sep-Dec 1999 10.29 6.58 2.67 1.86 4.24
Jan-Apr 2000 8.19 4.83 1.80 1.92 4.64
May-Aug 2000 7.58 4.74 2.07 1.41 3.12
Sep-Dec 2000 5.98 3.32 2.02 2.43 5.40
Jan-Apr 2001 5.91 3.48 1.71 2.64 5.44
May-Aug 2001 6.57 4.09 1.22 2.02 4.11
Sep-Dec 2001 8.99 4.92 2.63 4.24 7.68
Jan-Apr 2002 8.18 4.63 1.48 1.94 4.25
May-Aug 2002 7.35 4.62 2.88 3.45 6.57
Sep-Dec 2002 6.98 5.03 3.09 3.64 6.79
Jan-Apr 2003 5.92 3.73 1.96 2.08 4.78
May-Aug 2003 7.51 4.99 1.54 1.03 2.55
Sep-Dec 2003 9.08 5.65 1.63 1.50 2.65
Jan-Apr 2004 9.63 6.01 1.99 1.39 2.35
May-Aug 2004 10.19 6.61 2.74 1.48 2.45
Sep-Dec 2004 9.19 6.60 2.54 1.15 1.86
Jan-Apr 2005 9.04 6.05 2.44 1.12 2.11
May-Aug 2005 10.19 7.76 2.89 1.22 1.89
Sep-Dec 2005 9.68 7.48 2.99 1.16 2.14
Jan-Apr 2006 9.04 7.52 2.81 1.04 1.68
May-Aug 2006 9.70 7.48 2.56 1.43 3.69
Sep-Dec 2006 10.17 7.95 3.35 1.08 1.72
Jan-Apr 2007 10.39 8.17 3.15 1.28 2.93
May-Aug 2007 10.59 7.55 2.85 1.64 4.93
Sep-Dec 2007 10.02 6.87 2.63 1.42 5.06
Jan-Apr 2008 8.87 5.44 2.35 1.55 5.64
May-Aug 2008 9.63 5.97 2.46 1.12 4.03
Sep-Dec 2008 9.29 6.61 5.27 6.64 12.18
Jan-Apr 2009 7.17 3.60 2.07 4.27 8.45
May-Aug 2009 9.68 4.81 1.37 2.05 4.99
Sep-Dec 2009 11.35 6.17 1.86 1.91 3.98
Jan-Apr 2010 12.07 6.71 2.09 1.72 3.53
May-Aug 2010 11.12 5.96 2.10 2.89 7.55
Sep-Dec 2010 12.22 7.03 2.53 1.70 3.68
Jan-Apr 2011 12.52 7.26 2.43 2.15 4.24
May-Aug 2011 11.63 6.69 2.62 2.68 6.33
Sep-Dec 2011 9.77 5.11 2.39 3.70 9.01
Jan-Apr 2012 12.86 7.47 2.49 1.84 3.94
May-Aug 2012 11.46 6.98 2.61 1.65 4.14
Sep-Dec 2012 11.26 6.77 2.21 1.50 3.16
Jan-Apr 2013 11.15 7.36 2.67 1.41 2.52
May-Aug 2013 9.94 6.53 2.37 1.12 2.59
Sep-Dec 2013 11.95 7.29 2.36 1.49 2.78
Jan-Apr 2014 12.66 7.23 2.27 1.75 3.37
May-Aug 2014 12.67 7.93 2.96 1.42 2.49
Sep-Dec 2014 13.28 7.75 2.75 2.02 4.22
Jan-Apr 2015 12.37 7.25 2.63 1.87 4.39
May-Aug 2015 11.76 7.28 3.13 1.74 4.45
Sep-Dec 2015 11.94 6.61 2.30 2.40 6.31
Jan-Apr 2016 11.07 6.58 2.64 1.99 5.68
May-Aug 2016 12.84 7.84 3.00 1.91 3.77
Sep-Dec 2016 12.60 7.93 3.20 1.59 3.37
Jan-Apr 2017 12.88 8.04 2.86 1.91 2.48
May-Aug 2017 14.18 8.97 3.49 1.80 2.46
Sep-Dec 2017 14.92 9.72 3.66 1.78 2.24
Jan-Apr 2018 12.02 6.73 2.42 3.19 5.72
May-Aug 2018 13.37 7.82 2.53 2.07 3.57
Sep-Dec 2018 11.50 6.35 2.43 2.87 5.90
Jan-Apr 2019 11.35 6.79 2.29 1.77 4.06
May-Aug 2019 10.62 6.45 2.32 1.65 4.53
Sep-Dec 2019 11.67 7.78 3.48 1.45 3.27
Jan-Apr 2020 10.17 7.08 4.63 5.73 13.08
May-Aug 2020 10.15 5.55 1.92 3.69 8.07
Sep-Dec 2020 9.80 5.24 1.93 3.42 6.98
Jan-Apr 2021 11.06 6.22 2.25 3.09 5.84
May-Aug 2021 11.97 6.93 2.26 2.76 5.24
Sep-Dec 2021 11.92 7.06 2.56 2.60 5.47
Jan-Apr 2022 9.49 5.33 2.46 3.77 8.41
May-Aug 2022 7.94 4.12 1.77 2.32 5.86
Sep-Dec 2022 7.48 4.10 2.06 1.91 4.23
Jan-Apr 2023 9.20 5.24 1.98 1.27 4.12
May-Aug 2023 12.10 7.38 2.70 1.46 3.14
Sep-Dec 2023 11.62 6.80 2.48 1.31 2.97
Jan-Apr 2024 11.40 6.42 1.93 1.36 2.36
May-Aug 2024 11.09 6.37 2.18 1.78 3.44
Sep-Dec 2024 10.57 5.80 2.27 3.15 5.48
Jan-Apr 2025 8.97 4.83 2.20 3.39 7.21
May-Aug 2025 11.48 6.50 2.15 1.74 4.18
Table 4: Test mean absolute error in volatility points of Black-Scholes with one volatility, by moneyness group and window.
by_m[models[1]].round(2)
log_m Deep OTM puts OTM puts Near-money puts At the money OTM calls
Test period
May-Aug 1997 2.57 1.34 0.92 1.48 2.62
Sep-Dec 1997 3.33 2.82 1.63 1.70 2.79
Jan-Apr 1998 3.75 2.87 1.24 1.67 1.84
May-Aug 1998 3.37 2.72 1.54 1.88 1.57
Sep-Dec 1998 3.68 3.01 2.65 2.65 2.64
Jan-Apr 1999 1.84 1.86 1.98 2.20 2.44
May-Aug 1999 2.36 2.10 2.10 2.20 2.28
Sep-Dec 1999 2.27 1.53 1.40 1.61 1.48
Jan-Apr 2000 4.11 2.52 1.56 1.18 1.42
May-Aug 2000 4.31 2.89 1.60 1.06 1.67
Sep-Dec 2000 4.64 3.32 2.13 1.67 1.91
Jan-Apr 2001 4.42 2.55 1.51 1.36 2.03
May-Aug 2001 2.36 1.36 0.74 1.26 1.28
Sep-Dec 2001 4.00 2.51 1.24 1.39 1.52
Jan-Apr 2002 1.97 1.40 1.10 1.61 1.18
May-Aug 2002 3.20 1.91 1.63 1.68 1.93
Sep-Dec 2002 2.98 2.10 2.21 2.58 3.35
Jan-Apr 2003 2.17 1.25 1.82 2.10 2.55
May-Aug 2003 1.94 1.74 2.21 2.42 1.95
Sep-Dec 2003 1.87 1.81 2.60 3.42 2.08
Jan-Apr 2004 1.84 1.86 1.93 2.93 1.82
May-Aug 2004 1.88 2.02 1.79 2.45 1.58
Sep-Dec 2004 2.23 1.62 1.43 1.77 1.35
Jan-Apr 2005 2.97 1.59 1.20 1.67 1.42
May-Aug 2005 2.09 1.87 1.12 1.67 1.37
Sep-Dec 2005 2.10 1.82 1.02 1.31 1.23
Jan-Apr 2006 2.54 1.76 1.07 1.46 1.24
May-Aug 2006 2.36 1.84 0.91 1.21 1.58
Sep-Dec 2006 1.59 1.46 1.14 1.51 1.32
Jan-Apr 2007 1.82 1.52 0.88 1.46 1.35
May-Aug 2007 2.48 1.69 1.22 1.34 1.43
Sep-Dec 2007 2.19 1.57 1.98 2.23 2.37
Jan-Apr 2008 2.83 1.34 2.04 2.28 2.86
May-Aug 2008 2.69 1.59 1.37 1.61 2.59
Sep-Dec 2008 5.25 4.74 4.07 3.74 4.46
Jan-Apr 2009 2.60 1.84 2.10 2.10 3.59
May-Aug 2009 2.22 1.59 1.93 2.25 2.29
Sep-Dec 2009 2.38 1.80 2.57 3.21 2.24
Jan-Apr 2010 2.38 1.96 2.72 3.74 2.58
May-Aug 2010 2.06 1.49 1.30 1.95 3.07
Sep-Dec 2010 2.26 1.43 1.68 2.16 1.69
Jan-Apr 2011 2.60 1.37 1.41 2.46 2.32
May-Aug 2011 3.58 1.96 1.40 1.83 2.13
Sep-Dec 2011 3.19 1.63 1.63 1.61 1.79
Jan-Apr 2012 1.66 1.31 1.74 2.22 1.79
May-Aug 2012 1.94 1.70 2.02 2.28 1.85
Sep-Dec 2012 2.57 1.54 1.44 1.94 1.74
Jan-Apr 2013 2.35 1.46 1.29 1.98 1.62
May-Aug 2013 2.52 1.14 0.77 1.30 1.25
Sep-Dec 2013 2.88 1.47 0.96 1.62 1.50
Jan-Apr 2014 2.65 1.18 0.84 1.86 1.84
May-Aug 2014 2.29 1.30 1.03 1.87 1.50
Sep-Dec 2014 2.65 1.60 1.14 1.75 1.62
Jan-Apr 2015 1.82 1.23 1.48 1.74 1.76
May-Aug 2015 2.52 1.39 1.47 1.69 1.53
Sep-Dec 2015 2.41 1.16 1.44 1.59 1.49
Jan-Apr 2016 1.77 1.31 1.88 1.95 2.02
May-Aug 2016 1.69 1.23 1.45 2.04 1.97
Sep-Dec 2016 1.77 1.26 1.31 1.77 2.06
Jan-Apr 2017 2.05 1.27 1.53 2.42 1.75
May-Aug 2017 2.20 1.15 1.17 2.61 1.79
Sep-Dec 2017 2.07 1.40 1.09 2.62 1.83
Jan-Apr 2018 2.58 1.57 1.25 1.55 2.11
May-Aug 2018 2.04 1.36 1.34 1.71 1.77
Sep-Dec 2018 3.14 1.44 1.58 1.94 2.12
Jan-Apr 2019 2.41 1.07 1.71 2.04 1.93
May-Aug 2019 2.49 1.19 1.79 2.04 1.63
Sep-Dec 2019 1.84 1.72 2.26 2.42 1.86
Jan-Apr 2020 3.99 3.81 3.90 3.35 3.52
May-Aug 2020 3.37 3.86 3.29 2.58 2.04
Sep-Dec 2020 1.87 1.63 2.04 2.55 2.71
Jan-Apr 2021 1.92 1.65 1.90 2.65 2.51
May-Aug 2021 2.10 1.68 2.00 3.06 2.20
Sep-Dec 2021 2.04 1.31 1.35 2.12 2.00
Jan-Apr 2022 2.43 1.29 1.22 1.37 1.97
May-Aug 2022 2.52 1.15 2.38 3.04 4.15
Sep-Dec 2022 2.96 1.42 2.32 3.45 4.80
Jan-Apr 2023 2.91 1.34 1.10 1.32 1.61
May-Aug 2023 2.36 1.60 2.07 2.78 2.30
Sep-Dec 2023 2.26 1.36 1.61 2.09 1.70
Jan-Apr 2024 3.09 1.72 1.64 1.75 1.38
May-Aug 2024 2.91 1.45 1.33 1.64 1.87
Sep-Dec 2024 3.22 1.62 1.30 1.78 2.26
Jan-Apr 2025 3.46 1.44 1.25 1.41 1.98
May-Aug 2025 1.66 1.78 2.08 2.13 1.78
Table 5: Test mean absolute error in volatility points of the quadratic regression, by moneyness group and window.
by_m[models[2]].round(2)
log_m Deep OTM puts OTM puts Near-money puts At the money OTM calls
Test period
May-Aug 1997 2.00 2.07 1.33 1.27 2.28
Sep-Dec 1997 3.46 2.51 1.49 1.59 2.82
Jan-Apr 1998 3.56 2.71 1.16 1.54 1.57
May-Aug 1998 2.38 1.62 1.11 1.46 1.62
Sep-Dec 1998 4.10 3.37 2.66 2.28 1.92
Jan-Apr 1999 2.05 1.85 1.64 1.29 0.96
May-Aug 1999 1.92 1.74 1.17 1.05 1.16
Sep-Dec 1999 1.50 1.37 0.98 0.91 1.26
Jan-Apr 2000 2.73 2.21 1.67 1.47 1.31
May-Aug 2000 2.82 2.10 1.28 1.68 1.99
Sep-Dec 2000 2.98 2.56 1.92 1.71 1.36
Jan-Apr 2001 1.89 1.46 1.36 1.40 1.52
May-Aug 2001 1.24 1.28 0.94 0.98 0.91
Sep-Dec 2001 2.23 1.11 0.73 1.10 0.87
Jan-Apr 2002 1.56 1.13 0.80 0.89 1.08
May-Aug 2002 1.24 0.87 1.12 1.13 1.22
Sep-Dec 2002 1.94 1.47 1.44 2.08 2.48
Jan-Apr 2003 2.51 1.96 1.28 1.14 1.28
May-Aug 2003 1.39 1.22 0.84 0.69 0.61
Sep-Dec 2003 1.38 1.02 0.67 0.96 0.77
Jan-Apr 2004 1.48 1.34 0.90 1.02 1.08
May-Aug 2004 1.53 1.33 0.97 0.92 0.88
Sep-Dec 2004 1.36 1.07 0.56 0.54 0.84
Jan-Apr 2005 1.92 1.53 1.33 1.02 1.13
May-Aug 2005 1.22 1.25 0.89 0.53 0.73
Sep-Dec 2005 0.85 0.98 0.77 0.71 0.92
Jan-Apr 2006 1.01 0.75 0.47 0.53 0.66
May-Aug 2006 1.11 0.96 0.76 0.82 1.11
Sep-Dec 2006 0.97 1.00 0.78 0.68 0.56
Jan-Apr 2007 0.80 0.77 0.61 0.62 0.99
May-Aug 2007 1.22 1.01 0.97 1.10 1.29
Sep-Dec 2007 2.48 2.03 1.48 2.06 2.36
Jan-Apr 2008 2.45 2.25 1.57 1.37 1.50
May-Aug 2008 1.81 1.63 0.91 0.72 1.20
Sep-Dec 2008 8.07 8.20 6.96 5.91 6.35
Jan-Apr 2009 3.18 2.32 2.19 2.50 3.61
May-Aug 2009 1.79 1.06 1.06 1.11 1.84
Sep-Dec 2009 1.47 0.82 1.15 1.38 1.07
Jan-Apr 2010 1.41 1.19 0.91 1.30 1.73
May-Aug 2010 2.17 1.85 1.59 1.31 1.93
Sep-Dec 2010 1.62 1.38 1.42 1.20 1.01
Jan-Apr 2011 1.10 0.85 0.89 0.96 1.39
May-Aug 2011 1.49 1.25 1.30 1.12 1.05
Sep-Dec 2011 1.37 1.05 1.16 1.54 1.71
Jan-Apr 2012 1.13 0.98 0.99 1.18 1.63
May-Aug 2012 1.38 1.02 0.79 0.86 0.90
Sep-Dec 2012 1.58 1.28 0.77 0.71 0.75
Jan-Apr 2013 1.38 1.59 1.38 1.09 0.87
May-Aug 2013 0.99 0.95 1.21 1.14 0.92
Sep-Dec 2013 1.24 0.80 0.66 0.61 0.69
Jan-Apr 2014 1.47 0.70 0.56 0.83 1.12
May-Aug 2014 0.90 0.57 0.46 0.77 1.11
Sep-Dec 2014 1.74 1.17 0.90 0.70 0.87
Jan-Apr 2015 1.74 1.33 0.93 0.71 0.99
May-Aug 2015 1.28 0.92 0.82 0.77 0.77
Sep-Dec 2015 1.23 1.03 0.90 0.98 0.86
Jan-Apr 2016 1.44 1.22 1.03 1.27 1.03
May-Aug 2016 0.80 0.61 0.54 0.85 0.91
Sep-Dec 2016 0.95 0.78 0.67 0.63 1.10
Jan-Apr 2017 1.13 1.21 1.08 1.08 0.88
May-Aug 2017 1.43 1.20 1.12 1.04 0.99
Sep-Dec 2017 1.16 1.04 0.81 0.68 0.80
Jan-Apr 2018 1.67 1.46 1.74 1.82 1.67
May-Aug 2018 0.56 0.58 0.73 0.87 0.87
Sep-Dec 2018 1.18 0.84 1.03 1.66 1.40
Jan-Apr 2019 1.49 0.95 0.62 0.70 0.75
May-Aug 2019 1.23 0.70 0.77 1.01 0.73
Sep-Dec 2019 1.12 1.20 1.37 1.29 1.02
Jan-Apr 2020 5.29 4.81 4.11 2.78 2.90
May-Aug 2020 7.17 5.62 3.89 2.75 3.33
Sep-Dec 2020 1.74 1.81 1.87 1.77 1.62
Jan-Apr 2021 1.36 1.24 1.28 1.13 1.19
May-Aug 2021 1.32 0.95 0.83 1.10 1.26
Sep-Dec 2021 1.38 1.30 1.29 0.91 0.97
Jan-Apr 2022 0.89 0.82 1.03 1.00 1.59
May-Aug 2022 1.95 1.56 1.53 2.55 3.15
Sep-Dec 2022 3.09 2.32 0.97 1.63 2.85
Jan-Apr 2023 3.59 2.95 1.67 1.15 1.40
May-Aug 2023 2.63 1.94 1.25 0.92 1.45
Sep-Dec 2023 1.31 1.05 0.82 0.95 1.57
Jan-Apr 2024 1.51 1.33 0.90 0.67 0.71
May-Aug 2024 1.16 0.91 0.73 0.65 0.78
Sep-Dec 2024 1.64 1.23 1.25 1.40 1.42
Jan-Apr 2025 1.32 1.13 1.05 1.18 1.54
May-Aug 2025 1.25 1.11 0.93 0.81 1.04
Table 6: Test mean absolute error in volatility points of the neural network, by moneyness group and window.
x = [mid(e[2], e[3]) for e in windows]
fig, axes = plt.subplots(3, 1, figsize=(8, 8), sharex=True)
for ax, model in zip(axes, models):
    for group in groups:
        ax.plot(x, by_m[model][group], label=group)
    for day in events.values():
        ax.axvline(pd.Timestamp(day), color="0.5", ls=":", lw=1)
    ax.set_title(model, loc="left", fontsize=10)
    ax.set_ylabel("MAE (vol points)")
axes[0].legend(frameon=False, fontsize=8, ncol=2)
plt.show()
Three stacked line charts sharing a time axis from 1997 to 2025, one per model, each with one line per moneyness group: deep out-of-the-money puts, out-of-the-money puts, near-money puts, at the money and out-of-the-money calls. Dotted vertical lines mark September 2008, March 2020 and April 2025. For Black-Scholes, the error on deep out-of-the-money puts is the largest, between 5 and 15 volatility points. For the regression and the network, most errors in every group lie between half a point and three points, and the highest are in late 2008.
Figure 2: Test mean absolute error by moneyness group, in volatility points, for each model, plotted at the midpoint of each test period. The vertical scales differ across panels. Dotted lines mark September 15, 2008, March 16, 2020, and April 2, 2025.

The skew in four test periods

Figure 3 shows, as in the FinTech notebook, the three-month skew on the last day of the test period as the market priced it and as each model predicted it, for four windows: a calm period, May to August 2017, when the VIX was near its lowest levels on record, and the test periods that contain the failure of Lehman Brothers, the COVID crash and the tariff turmoil of April 2025.

shown = ["Sep-Dec 2008", "May-Aug 2017", "Jan-Apr 2020", "Jan-Apr 2025"]
fig, axes = plt.subplots(2, 2, figsize=(9, 6.5), sharex=True)
for ax, label in zip(axes.flat, shown):
    s = fits[labels.index(label)]["skew"]
    ax.scatter(s["log_m"], 100 * s["iv"], s=8, color="0.4", label="Market")
    for model in models:
        ax.plot(s["log_m"], 100 * s[model], label=model)
    ax.set_title(f"{s['date'].iloc[0]:%B %d, %Y}, {round(s['T'].iloc[0] * 365)} days, "
                 f"VIX {s['vix'].iloc[0]:.0f}", fontsize=10)
for ax in axes[1]:
    ax.set_xlabel("Log moneyness ln(K/S)")
for ax in axes[:, 0]:
    ax.set_ylabel("Implied volatility (%)")
axes[0, 0].legend(frameon=False, fontsize=8)
plt.show()
Four panels of implied volatility against log moneyness, for the last test days of September to December 2008, May to August 2017, January to April 2020 and January to April 2025. Each panel shows the market's quotes as gray dots, a flat line from Black-Scholes with one volatility, and curves from the quadratic regression and the neural network. In 2017 both curves follow the market's skew closely, and only the network follows its upturn at high strikes. In 2008 and 2020 both curves lie below the market's quotes for most strikes, the network's furthest below in 2008. In 2025 both lie somewhat below the quotes at most strikes.
Figure 3: Three-month implied volatility against log moneyness on the last day of four test periods: the market’s quotes and the predictions of the three models.

ReLU or Softplus

This section asks whether the activation function changes how well the network fits the market. Each window has six networks: one per activation and seed. Table 7 reports, by window, the mean and the standard deviation of the test error across the three seeds of each activation, and the difference between the two means. The standard deviation measures how much the result depends on the random starting weights, and gives the scale against which the difference between activations should be judged. Figure 4 plots the mean test error of each activation against time, with a band from the lowest to the highest of its three seeds.

by_seed = nets.pivot_table(index="window", columns="activation", values="test", aggfunc=["mean", "std"])
activation_table = pd.DataFrame({
    ("Softplus", "Mean"): by_seed[("mean", "Softplus")],
    ("Softplus", "Std. dev."): by_seed[("std", "Softplus")],
    ("ReLU", "Mean"): by_seed[("mean", "ReLU")],
    ("ReLU", "Std. dev."): by_seed[("std", "ReLU")],
    ("Difference", ""): by_seed[("mean", "Softplus")] - by_seed[("mean", "ReLU")],
})
activation_table.index = [labels[w] for w in activation_table.index]
activation_table.index.name = "Test period"
activation_table.round(2)
Softplus ReLU Difference
Mean Std. dev. Mean Std. dev.
Test period
May-Aug 1997 1.81 0.04 2.20 0.38 -0.39
Sep-Dec 1997 2.69 0.36 5.98 1.69 -3.29
Jan-Apr 1998 1.87 0.09 2.26 0.63 -0.38
May-Aug 1998 1.58 0.01 1.58 0.03 -0.01
Sep-Dec 1998 2.63 0.02 2.66 0.21 -0.02
Jan-Apr 1999 1.45 0.03 1.81 0.01 -0.36
May-Aug 1999 1.38 0.06 1.47 0.08 -0.08
Sep-Dec 1999 1.17 0.03 1.06 0.01 0.11
Jan-Apr 2000 1.71 0.02 1.85 0.02 -0.14
May-Aug 2000 1.88 0.06 1.88 0.02 -0.01
Sep-Dec 2000 1.82 0.08 2.03 0.02 -0.21
Jan-Apr 2001 1.47 0.03 1.55 0.04 -0.08
May-Aug 2001 0.99 0.04 1.07 0.06 -0.08
Sep-Dec 2001 1.08 0.03 1.22 0.01 -0.14
Jan-Apr 2002 1.04 0.04 0.93 0.06 0.11
May-Aug 2002 1.12 0.03 1.06 0.04 0.06
Sep-Dec 2002 2.06 0.06 2.00 0.08 0.07
Jan-Apr 2003 1.53 0.03 1.84 0.04 -0.31
May-Aug 2003 0.85 0.04 0.74 0.03 0.11
Sep-Dec 2003 0.86 0.03 1.08 0.12 -0.21
Jan-Apr 2004 1.15 0.01 1.62 0.47 -0.47
May-Aug 2004 1.05 0.01 0.94 0.04 0.11
Sep-Dec 2004 0.84 0.07 1.21 0.34 -0.37
Jan-Apr 2005 1.34 0.05 1.99 0.59 -0.65
May-Aug 2005 0.82 0.08 0.88 0.05 -0.06
Sep-Dec 2005 0.83 0.07 0.71 0.04 0.12
Jan-Apr 2006 0.60 0.06 0.55 0.01 0.05
May-Aug 2006 0.83 0.12 0.82 0.07 0.02
Sep-Dec 2006 0.71 0.07 0.66 0.03 0.05
Jan-Apr 2007 0.73 0.04 0.84 0.09 -0.11
May-Aug 2007 1.09 0.04 1.13 0.16 -0.04
Sep-Dec 2007 2.17 0.06 2.24 0.08 -0.08
Jan-Apr 2008 1.78 0.05 1.88 0.18 -0.10
May-Aug 2008 1.18 0.03 1.14 0.07 0.04
Sep-Dec 2008 11.82 6.84 13.50 4.72 -1.68
Jan-Apr 2009 3.94 1.04 4.45 1.56 -0.51
May-Aug 2009 1.41 0.10 1.82 0.06 -0.40
Sep-Dec 2009 1.16 0.03 1.23 0.09 -0.07
Jan-Apr 2010 1.37 0.05 1.93 0.12 -0.56
May-Aug 2010 1.85 0.03 1.97 0.02 -0.12
Sep-Dec 2010 1.16 0.10 0.92 0.03 0.24
Jan-Apr 2011 1.04 0.05 0.95 0.02 0.09
May-Aug 2011 1.23 0.03 1.15 0.03 0.07
Sep-Dec 2011 1.38 0.05 1.30 0.09 0.08
Jan-Apr 2012 1.18 0.15 0.76 0.03 0.42
May-Aug 2012 0.92 0.05 0.88 0.04 0.04
Sep-Dec 2012 0.95 0.02 0.97 0.02 -0.01
Jan-Apr 2013 1.18 0.05 1.67 0.08 -0.48
May-Aug 2013 0.93 0.07 0.95 0.09 -0.02
Sep-Dec 2013 0.77 0.02 0.75 0.01 0.02
Jan-Apr 2014 0.93 0.03 0.80 0.03 0.13
May-Aug 2014 0.70 0.07 0.74 0.06 -0.03
Sep-Dec 2014 0.98 0.09 1.17 0.35 -0.19
Jan-Apr 2015 1.07 0.07 1.08 0.01 -0.01
May-Aug 2015 0.83 0.06 0.78 0.03 0.05
Sep-Dec 2015 0.91 0.07 0.91 0.00 0.00
Jan-Apr 2016 1.11 0.05 1.16 0.11 -0.04
May-Aug 2016 0.69 0.05 0.57 0.01 0.12
Sep-Dec 2016 0.78 0.08 0.70 0.03 0.08
Jan-Apr 2017 1.03 0.03 0.89 0.03 0.14
May-Aug 2017 1.16 0.01 1.43 0.22 -0.27
Sep-Dec 2017 0.88 0.05 0.87 0.14 0.01
Jan-Apr 2018 1.68 0.07 1.49 0.20 0.19
May-Aug 2018 1.04 0.50 0.80 0.15 0.24
Sep-Dec 2018 1.23 0.03 1.26 0.04 -0.03
Jan-Apr 2019 0.92 0.02 0.83 0.01 0.09
May-Aug 2019 0.84 0.02 0.82 0.01 0.02
Sep-Dec 2019 1.13 0.05 1.10 0.01 0.03
Jan-Apr 2020 4.69 1.82 3.13 0.49 1.55
May-Aug 2020 3.60 0.89 3.18 0.72 0.42
Sep-Dec 2020 1.71 0.05 2.32 0.34 -0.61
Jan-Apr 2021 1.18 0.05 1.20 0.03 -0.02
May-Aug 2021 1.12 0.01 1.17 0.07 -0.05
Sep-Dec 2021 1.12 0.04 1.08 0.05 0.04
Jan-Apr 2022 1.13 0.05 1.08 0.07 0.05
May-Aug 2022 2.30 0.06 2.25 0.08 0.05
Sep-Dec 2022 2.39 0.06 2.73 0.10 -0.33
Jan-Apr 2023 1.97 0.05 1.48 0.05 0.50
May-Aug 2023 1.44 0.16 1.44 0.28 0.01
Sep-Dec 2023 1.11 0.09 1.30 0.31 -0.19
Jan-Apr 2024 0.97 0.04 0.87 0.01 0.10
May-Aug 2024 0.80 0.03 0.78 0.04 0.03
Sep-Dec 2024 1.32 0.05 1.54 0.17 -0.22
Jan-Apr 2025 1.36 0.07 1.29 0.09 0.07
May-Aug 2025 0.94 0.09 1.23 0.03 -0.29
Table 7: Test mean absolute error in volatility points of the networks with Softplus and ReLU units, by window: the mean and standard deviation across three seeds, and the difference between the means (Softplus minus ReLU).
x = [mid(e[2], e[3]) for e in windows]
spread_by_seed = nets.pivot_table(index="window", columns="activation", values="test", aggfunc=["mean", "min", "max"])
fig, ax = plt.subplots(figsize=(8, 3.5))
for activation in activations:
    ax.plot(x, spread_by_seed[("mean", activation)], label=activation)
    ax.fill_between(x, spread_by_seed[("min", activation)], spread_by_seed[("max", activation)], alpha=0.25)
for day in events.values():
    ax.axvline(pd.Timestamp(day), color="0.5", ls=":", lw=1)
ax.set_yscale("log")
ax.set_ylabel("Test MAE (vol points)")
ax.legend(frameon=False)
plt.show()
Line chart of test error against time from 1997 to 2025, with one line for the Softplus networks and one for the ReLU networks, each surrounded by a shaded band showing the range across three seeds. Dotted vertical lines mark September 2008, March 2020 and April 2025. The two lines lie close together and the bands are narrow in most windows. Both rise and their bands widen in late 2008 and in 2020.
Figure 4: Test mean absolute error of the networks with Softplus and ReLU units, in volatility points, plotted at the midpoint of each test period. Lines are means across three seeds; bands run from the lowest to the highest seed. Dotted lines mark September 15, 2008, March 16, 2020, and April 2, 2025.

Table 8 summarizes the comparison by period. A difference between the two activations is counted as clear when it exceeds twice its standard error, computed from the standard deviations across seeds.

diff = activation_table[("Difference", "")]
se = np.sqrt((activation_table[("Softplus", "Std. dev.")] ** 2 + activation_table[("ReLU", "Std. dev.")] ** 2) / len(seeds))
year = pd.Series([int(label[-4:]) for label in activation_table.index], index=activation_table.index)
span = pd.cut(year, [1996, 2002, 2008, 2014, 2020, 2025],
              labels=["1997-2002", "2003-2008", "2009-2014", "2015-2020", "2021-2025"])
periods = pd.DataFrame({
    "Softplus": activation_table[("Softplus", "Mean")].groupby(span, observed=True).mean(),
    "ReLU": activation_table[("ReLU", "Mean")].groupby(span, observed=True).mean(),
    "Windows": diff.groupby(span, observed=True).size(),
    "Softplus clearly lower": (diff < -2 * se).groupby(span, observed=True).sum(),
    "ReLU clearly lower": (diff > 2 * se).groupby(span, observed=True).sum(),
})
periods.loc["All"] = [activation_table[("Softplus", "Mean")].mean(), activation_table[("ReLU", "Mean")].mean(),
                      len(diff), (diff < -2 * se).sum(), (diff > 2 * se).sum()]
periods.index.name = "Test period"
periods.round(2)
Softplus ReLU Windows Softplus clearly lower ReLU clearly lower
Test period
1997-2002 1.63 1.92 17 6 3
2003-2008 1.68 1.88 18 2 3
2009-2014 1.28 1.36 18 4 5
2015-2020 1.41 1.30 18 2 3
2021-2025 1.37 1.39 14 3 2
All 1.48 1.57 85 17 16
Table 8: Mean test error in volatility points of each activation, averaged over the windows whose test period falls in each span of years, the number of windows, and the number in which each activation has the lower mean error by more than two standard errors.

Static arbitrage

This section asks how often each network’s prices allow static arbitrage, and of which kind. Table 9 reports, for each activation and over all windows and seeds, the share of networks with at least one violation of each kind and the average number of violations per network. Figure 5 shows, by window, the share of grid points with a violation of any kind, averaged over the three seeds.

kinds = ["Call spread", "Butterfly", "Calendar"]
nets["Any"] = nets[kinds].sum(axis=1)
arbitrage = pd.concat({
    "Share of networks": (nets[kinds + ["Any"]] > 0).groupby(nets["activation"]).mean().T,
    "Violations per network": nets[kinds + ["Any"]].groupby(nets["activation"]).mean().T,
}, axis=1)
arbitrage.round(2)
Share of networks Violations per network
activation ReLU Softplus ReLU Softplus
Call spread 0.92 0.56 385.04 485.68
Butterfly 1.00 0.09 1403.78 2.57
Calendar 0.88 0.38 255.68 148.30
Any 1.00 0.60 2044.50 636.55
Table 9: Violations of the three static arbitrage conditions on the networks’ test grids, by activation, over all windows and seeds: the share of networks with at least one violation of each kind, and the average number of violations per network.
share = (100 * nets["Any"] / nets["grid"]).groupby([nets["window"], nets["activation"]]).mean().unstack()
fig, ax = plt.subplots(figsize=(8, 3.5))
for activation in activations:
    ax.plot(x, share[activation], label=activation)
for day in events.values():
    ax.axvline(pd.Timestamp(day), color="0.5", ls=":", lw=1)
ax.set_ylabel("Grid points with a violation (%)")
ax.legend(frameon=False)
plt.show()
Line chart of the percentage of grid points with an arbitrage violation against time from 1997 to 2025, with one line for the Softplus networks and one for the ReLU networks. The ReLU line lies above the Softplus line in almost every window, mostly between 5 and 15 percent. The Softplus line is near zero in many windows and peaks in 2017 and in late 2008; in late 2008 both lines reach about 25 percent.
Figure 5: Share of the grid points of each test period with a violation of a static arbitrage condition, in percent, for the networks with Softplus and ReLU units, averaged over three seeds and plotted at the midpoint of each test period.

The strike spacing is fixed at 5 index points, as in the FinTech notebook, while the index rose from about 600 in 1996 to more than 6,000 in 2025. The grids of the early windows therefore have fewer points, each further apart relative to the index.

Repairing the surface

This section asks whether the violations can be removed without spoiling the fit, by the repair defined above. Table 10 reports, for each activation and over all windows and seeds, the number of days on which the repair found no solution, the number of networks with violations left after the repair, the share of grid points whose implied volatility moved by more than a thousandth of a volatility point, the median and the largest of each network’s largest move, and the change in the test error, in volatility points, measured on the quoted options that sit on the grid.

rows = {}
for activation in activations:
    n = nets[nets["activation"] == activation]
    change = n["test after repair"] - n["test on grid"]
    rows[activation] = {
        "Days without a solution": int(n["failed"].sum()),
        "Networks with violations left": int((n["left"] > 0).sum()),
        "Grid points moved (%)": 100 * n["moved"].sum() / n["grid"].sum(),
        "Largest move, median": n["largest move"].median(),
        "Largest move, max": n["largest move"].max(),
        "Error change, mean": change.mean(),
        "Error change, min": change.min(),
        "Error change, max": change.max(),
    }
repairs = pd.DataFrame(rows).T
repairs.round(3)
Days without a solution Networks with violations left Grid points moved (%) Largest move, median Largest move, max Error change, mean Error change, min Error change, max
Softplus 0.0 0.0 3.931 0.331 20.850 0.002 -0.303 0.256
ReLU 0.0 0.0 31.844 1.633 17.672 -0.003 -0.313 0.081
Table 10: The repair, by activation, over all windows and seeds: days without a solution, networks with violations left after the repair, the share of grid points moved, the median and the largest of each network’s largest move in volatility points, and the mean, smallest and largest change in test error in volatility points, on the quoted options on the grid.

When the network extrapolates

A repair can only make a surface consistent; it cannot make it right. Table 11 lists the networks whose implied volatility fell below 0.1% somewhere on a test grid, a sign that the network was evaluated far from its training data. For each window it also reports the highest VIX in the training sample and in the test sample, together with the test error before and after the repair, on the quoted options that sit on the grid.

vix_max = pd.DataFrame([{"window": w, "Training VIX max": split(e)[0]["vix"].max(),
                         "Test VIX max": split(e)[2]["vix"].max()} for w, e in enumerate(windows)])
floored = nets[nets["floored"] > 0].merge(vix_max, on="window")
floored = floored[["test period", "activation", "seed", "floored", "Training VIX max", "Test VIX max",
                   "test on grid", "test after repair"]].rename(columns={
    "test period": "Test period", "activation": "Activation", "seed": "Seed",
    "floored": "Points floored", "test on grid": "Test error", "test after repair": "After repair"})
floored.sort_values(["Test period", "Activation", "Seed"]).round(2)
Test period Activation Seed Points floored Training VIX max Test VIX max Test error After repair
2 Sep-Dec 2008 ReLU 0 1043 30.67 74.26 17.26 16.96
0 Sep-Dec 2008 Softplus 1 1272 30.67 74.26 18.94 18.63
1 Sep-Dec 2008 Softplus 2 217 30.67 74.26 8.99 9.25
Table 11: Networks whose implied volatility fell below 0.1% on some test grid point: the number of such grid points, the highest VIX in the training and test samples, and the test error in volatility points on the quoted options on the grid, before and after the repair.

What we learned

The ranking of the FinTech notebook holds over the whole sample, not only in 2025. The network’s test error is lower than the regression’s in 78 of the 85 windows, and its mean across windows is 1.43 volatility points against 1.99 (Table 3). Black-Scholes with one volatility has the highest test error in every window. The network’s advantage over the regression holds in every moneyness group on average (Table 5 and Table 6). The VIX alone, passed through a flexible function, therefore recovers most of the surface in most markets.

The regression has the lower test error in six windows, and four of them are tied to a crash. In September to December 2008 and January to April 2020, the VIX in the test sample rose far above its highest level in the training sample, so the network was evaluated on inputs unlike any it was trained on. In January to April 2009 and May to August 2020, the crash falls in the validation sample instead, so the stopping epoch is chosen on a market unlike both the training and the test samples. In the other two windows, May to August 1997 and January to April 2023, the gap is less than half a volatility point. The notebook does not test why the regression holds up better in these windows. A plausible guess is that its eight terms fix the shape of the surface outside the training range, while nothing fixes the shape of the network there.

The activation function matters little for the fit. Averaged over windows, the test error is 1.48 volatility points with Softplus units and 1.57 with ReLU units, and each activation has the clearly lower error in about as many windows as the other (Table 8). The starting weights matter little in calm markets, where the standard deviation across seeds is a fraction of a volatility point. In a crisis they can matter more than the activation: in September to December 2008, the three Softplus networks have test errors from 6.8 to 18.9 volatility points (Table 7).

The activation matters for arbitrage. Every ReLU network has a violation somewhere on its test grids, most of them butterflies, while 60% of the Softplus networks do (Table 9). A ReLU network is piecewise linear in its inputs, so its implied volatilities have kinks in the strike, and a kink that bends downward can make call prices locally concave. Softplus units are smooth and do not create kinks. The Softplus surfaces still violate the conditions on many grid points in some windows, notably in 2017, when the VIX was near its lowest levels on record, and in the fall of 2008 (Figure 5).

The repair removes the violations at almost no cost in fit. The solver finds a solution on every test day, no network keeps a violation, and in no network does the test error change by more than a third of a volatility point (Table 10). The repair moves few of the Softplus grid points and about a third of the ReLU ones. A repair cannot make a wrong surface right, though. The networks that extrapolate in the fall of 2008 keep test errors far above the regression’s after the repair (Table 11).