Machine Learning–Based Freight Cost Estimation

ML Engineering

Building a scalable machine learning solution for logistics cost estimation

Context

The challenge

Global logistics pricing is volatile and complex.

Rule-based cost estimation systems struggle to keep pace with fluctuating carrier rates, shifting surcharges, and evolving service structures. As volumes grow, static logic fails to capture the full range of pricing dynamics.

  1. 01deliver accurate cost estimates on the fly
  2. 02handle hundreds of thousands of requests per day
  3. 03support multiple carriers and service levels
  4. 04remain extensible as new models and data sources are introduced

The client needed a solution that could:

Requirements

Understanding the operational constraints

Freight cost depends on a wide range of factors that interact in non-obvious ways:

  1. 01dimensions, weight, and packaging type
  2. 02delivery zones and carrier rate structures
  3. 03special handling requirements
  4. 04promotional pricing and negotiated discounts
  5. 05non-standard or edge-case scenarios

The system needed to account for all of these while maintaining low latency at scale.

Data

Data quality: the hidden bottleneck

Before any modeling could begin, significant effort went into data preparation.

The underlying data had accumulated over years without consistent governance, leading to:

  1. 01inconsistent master data across systems
  2. 02missing product dimensions for a significant share of SKUs
  3. 03non-normalized pricing tables with overlapping rules

Addressing these issues was essential before any ML approach could produce reliable results.

Models

Model strategy and experimentation

The prediction task required handling several complexities simultaneously:

  1. 01nonlinear interactions between input features
  2. 02varying numbers of items per shipment
  3. 03frequent missing values
  4. 04strict real-time inference requirements

We evaluated multiple approaches across a range of model families:

  1. 01statistical baselines for benchmarking
  2. 02tree-based gradient boosting models
  3. 03sequence-aware neural network architectures

After structured experimentation, gradient-boosted trees (XGBoost) emerged as the best balance of accuracy, speed, and maintainability.

Rollout

Integration and deployment

The model was deployed behind an API-driven inference layer, designed for seamless integration with existing logistics workflows:

  1. 01lightweight API for real-time cost queries
  2. 02business rule orchestration layer for policy overrides
  3. 03extensible architecture to onboard new carriers without retraining the full pipeline
Impact

Business outcomes

The deployed system delivered measurable improvements across the logistics operation:

  • accurate cost prediction at scale, even for complex multi-item shipments
  • faster quoting and pricing decisions
  • improved pricing consistency across carriers and service tiers
Summary

Lessons learned

This project reinforced several principles that apply broadly to ML in operational contexts:

Future

Looking ahead

This project is part of a broader shift toward AI-driven logistics optimization.

By replacing rigid rule engines with adaptive ML models, organizations can unlock meaningful cost savings and operational agility, while building a foundation for continuous improvement.

Work with us

Ready to build an AI system your team will actually use?

Let's discuss how we can help transform your business with AI.

Get in touch