How Gateway Uses Hugging Face to Store and Train Its Freight AI Model
Gateway Lines runs its own model for ocean freight rate estimation. It is a gradient boosting model trained on Gateway's own archive of weekly carrier quote pulls, it is versioned on Hugging Face, and it is live in the platform today.
It is not a language model. That was a deliberate choice, and it is the first thing worth explaining.
Why gradient boosting and not an LLM
Rate estimation is a tabular regression problem. The inputs are structured fields, not prose:
Origin and destination port
Container size and type
Service type
Carrier
Month, quarter, season, and year
Given those, the model returns an expected rate. There is no text to interpret and nothing to generate.
Gradient boosted trees are the correct tool for that shape of problem. They handle categorical features natively, train in minutes on modest hardware, and are straightforward to inspect when an estimate looks wrong. On structured tabular data they routinely outperform neural networks at a fraction of the cost.
Gateway uses LightGBM. The trained model is a booster file plus a JSON map of the label encoders, and it runs on ordinary application infrastructure with no GPU involved.
Why the model lives on Hugging Face anyway
Hugging Face is associated with large neural networks, so using it for a gradient boosting model looks like an odd fit. In practice the registry is the useful part, and the registry does not care what produced the artifact.
Versioning. Every trained model is a commit with its own hash. Production pins a specific revision rather than tracking whatever is newest. When a retrained model performs worse on a lane, Gateway pins the previous revision and redeploys. The history stays in the repository.
The model and its encoders stay together. A gradient boosting model is useless without the exact label encoders it was trained with. If the two ever drift apart, every prediction is silently wrong. Keeping both files in the same versioned commit makes that failure impossible.
Private by default. The model is proprietary and the repository is private.
Results
The model is 1,000 trees over 10 features, six of them categorical and label-encoded. The target is port-to-port FCL cost in USD per container. It was trained on 49,946 rows split 39,956 train and 9,990 held out, and the exported checkpoint is 17 GB.
On a held-out split:
Metric | Value |
|---|---|
RΒ² | 0.9664 |
MAE | $321 per container |
RMSE | $518 |
Those numbers only mean something against a baseline. The obvious one is a trailing average of recent rates on the same lane, which is roughly how the problem gets solved without a model:
Metric | Trailing average | Gateway AI |
|---|---|---|
MAE (USD/container) | $652 | $273 |
Median absolute error | $226 | $173 |
Within $250 of the next read | 51.4% | 62.8% |
The two tables use different populations, which is worth stating plainly. The first is the standard held-out split. The second runs on 5,836 lanes with at least three reads, holding out each lane's newest read and predicting it from the reads before it. That second setup is the question the model is actually asked in production, which is why it gets its own table.
The gap between those two rows is the part worth reading closely. Mean absolute error falls 58%, but median absolute error falls only 24%.
That difference says the model is not dramatically better on a typical lane. It is dramatically better at not being badly wrong. A trailing average works fine while a lane is stable and fails hard when it moves, and those failures are the expensive ones. A $50 miss costs nothing. A $2,000 miss costs the booking.

What the model is for
Gateway Machine Learning does one thing: given a lane, an equipment type, and a month, it returns an expected port-to-port FCL cost in dollars per container. Coverage is 82 origin ports, 84 destination ports, and five equipment types.
It is a fallback layer rather than the source of truth. Lanes with a fresh carrier read are served from the published rate board. The model fills the gap for lanes without a current quote, and flags when a returned rate looks far enough off an expected range to check twice.
That narrow focus is deliberate. Ocean freight pricing is opaque. Published rate indices are lagging weekly averages that describe where the market was, not what a specific container will cost next week. The rate an importer actually receives depends on carrier relationships and volume commitments that never appear in any public feed.
Why it matters
Rate estimation is one part of a platform that also handles customs coordination, cargo insurance, drayage, and container tracking. Better rate estimates mean faster, more accurate quotes for importers and exporters.
The broader point is that not every AI problem needs a foundation model. A 17 GB tree ensemble over ten well-chosen features, trained on an archive built one weekly pull at a time, beats the obvious alternative by 58% and runs on a laptop in single-digit milliseconds.
Gateway is an FMC-licensed NVOCC and ocean freight forwarder. The platform is at gatewaylines.com.
Read our Hugging Face article at https://huggingface.co/blog/gatewaylines/how-gateway-lines-uses-huggingface
