Introducing tincast: An Open-Source Framework for Geopolitical Modeling of AI-Critical Commodities

A novel forecasting architecture that treats supply-chain fragmentation — the China-West price divergence across the chip metals — as a first-class model input. First target: tin, the solder every AI chip runs on.


tincast is a new open-source framework for forecasting the commodities the AI buildout depends on, built around an input that, to our knowledge, no published forecasting system uses: a daily-computable fragmentation index measuring the geopolitical splitting of the chip-metals supply chain.

The framework is MIT-licensed, runs on numpy and scikit-learn alone, and ships with a full synthetic benchmark, a leakage-free evaluation protocol, and clean interfaces for real market data: https://github.com/Bodhi8/tincast.

This post covers the motivation, a technical introduction to the architecture, and the benchmark results — including one result that cuts against the framework’s own headline feature, reported anyway.

Motivation: one metal no longer has one price

Since 2023, the metals the semiconductor industry depends on have stopped having a single world price. Gallium trades around five times higher in Europe than in China. Germanium costs roughly three times more in the West. Polysilicon selling for under $5/kg in Northeast Asia fetches over $25 in North America.

These are identical materials. The regional gaps are the market-priced footprint of export controls, strategic stockpiling, and the division of the chip supply chain into rival blocs — and they can be computed daily from published price assessments. That computation is the fragmentation index: a live gauge of how weaponized the supply chain is right now. It widens when export controls bite, spikes around escalations, relaxes with de-escalation, and moves before and during exactly the events that break conventional commodity models.

Standard forecasting practice treats such episodes as outliers to be dummied out. tincast’s founding premise is the opposite: geopolitics is now a fundamental, as measurable as inventories, and belongs in the model as a state variable.

The first target is tin. The minor metals themselves cannot be credibly forecast in public — broker-assessed prices, thin liquidity, short history. Tin can: roughly half of global demand is solder (the physical attachment of every chip to every board), it trades on the LME with deep daily history and visible inventories, and its supply is concentrated in genuinely geopolitical chokepoints — Myanmar’s Wa State, Indonesia’s export-permit regime, the DRC. Tin is the purest exchange-traded exposure to semiconductor volume. The design, then: forecast the tradeable metal, using fragmentation measured on its untradeable neighbors as an input.

Technical introduction

tincast extends a stacked-forecasting architecture first developed in its sibling project, regimecast, and consists of four components.

1. A pool of worldview models. Rather than one complex model, the framework runs five simple ones, each encoding a distinct theory of price formation:

  • carry — price stays near its current level (random walk with damped drift); the null hypothesis every other view must beat
  • inventory — price is a convex function of days-of-demand coverage: thin stocks raise prices far more than ample stocks lower them
  • chipcycle — the price trend follows semiconductor demand indicators
  • riskprem — fragmentation carries a price premium that decays as tensions ease
  • balance — a gradient-boosted synthesis of the full state, trained as a direct multi-horizon forecaster with the horizon as a feature

A key design rule: all driver-based views are anchored. Each forecasts the price change implied by its driver’s projected path and adds it to the current price. Regressing price levels on driver levels — the naive formulation — extrapolates catastrophically when drivers trend; an early unanchored version missed by $26,000/t.

2. A ten-dimensional state vector. At every forecast origin the framework computes: fragmentation level and momentum (the novel block); a fragmentation × thin-coverage interaction term (weaponized supply chains with no inventory buffer — the danger zone); chip-cycle trend and anomaly; inventory coverage and momentum; a supply-disruption gap; realized volatility; and price momentum. The repo documents the recipe for building the fragmentation block from published regional assessments.

3. A state-conditioned meta-model. For each pool member, a gradient-boosted regressor learns how that member’s forecast error varies with the state vector. Predicted errors are converted to combination weights via a softmax. Training data comes exclusively from rolling-origin out-of-fold forecasts — the only leakage-safe protocol for time series — so the meta-model never sees any base model’s in-sample fit.

4. Two safety guarantees. Weights are always convex, so a confused meta-model degrades toward a plain average instead of extrapolating. And an out-of-distribution fallback blends weights toward equal whenever the current state drifts outside the meta-training distribution. Geopolitically driven markets reliably produce unprecedented days; on those days the framework is deliberately humble.

Evaluation is regime-stratified by construction: the backtester reports error separately for calm vs. fragmented periods and thin vs. comfortable inventory, because an all-period average is precisely where regime-dependent failures hide.

Benchmark results

The framework ships with an eight-year synthetic daily tin market built to be difficult in realistic ways: a multi-year chip demand cycle with a secular AI trend, mine capacity that chases demand slowly, fragmentation shocks that add risk premium and amplify volatility, and Myanmar-style disruption episodes. Evaluation: strict 70/30 holdout, 63-day horizon — the procurement and hedging horizon.

Two headline results.

The worldview ensemble works. It beat every individual pool member and beat the carry benchmark by ~18%. The pattern matters more than the number: carry degrades most in fragmented regimes — exactly when “tomorrow looks like today” fails — and that is where the diverse pool earns its advantage.

The geopolitical conditioning tied plain equal weighting on this benchmark. The meta-model found no conditional structure to exploit; pool errors were dominated by shared noise. Full disclosure from the author: the generator could have been tuned until the meta-layer looked clever, and was not, because a benchmark rigged to flatter the method is worse than an honest tie. By construction the conditioning layer costs nothing when uninformative — that is what the convexity and fallback guarantees are for — and whether it earns its keep on real divergence data, where regime shifts are sharper than any generator, is the open question this release puts to the community.

A secondary finding useful to any forecasting practitioner: at a 21-day horizon, every driver-based view collapsed toward carry and the ensemble’s edge narrowed. If your drivers cannot move meaningfully within your horizon, you are doing expensive random-walk forecasting.

Roadmap and invitation

Planned next: real-data loaders (LME/SHFE inventories, semiconductor billings, the minor-metals assessments behind the fragmentation index), forward-curve features (tin’s contango/backwardation encodes the market’s own inventory expectations), and conformal prediction intervals.

The larger program travels beyond tin. Sanctioned crude at persistent discounts, politically gated LNG arbitrage, tariff-driven gaps between the same metal’s New York and London prices — fragmentation increasingly appears as durable regional price differences for identical things, and every such gap is a computable regime signal most models ignore. tincast is one instantiation of that thesis; copper, with its 2026 deficit and tariff dislocations, is the planned second target.

Run python examples/demo.py, then bring real data and try to break the tie reported above: https://github.com/Bodhi8/tincast. Whichever way it resolves, the result belongs in public.

Brian James Curry is a Kansas City–based data scientist and applied machine learning researcher working at the intersection of economic modeling, causal inference, and statistical learning — with a standing preference for models where the economics is load-bearing. He is the founder of Vector1 Research, an independent machine learning lab exploring marketing economics, forecasting systems, and cognitive architectures, with research contributions including Papilon, PyCausalSim, and Memory-Node Encapsulation. His twenty-plus years of enterprise work span Koch Industries, Tractor Supply, Vail Resorts, Hallmark, Garmin, and AT&T.

Related research