~
← Stack

Surge Pay Automation

Shipt ยท Target Last Mile

  • Keras + JAX
  • Polars
  • FastAPI
  • Feature store
  • GPU
1st
surge model trusted to automate pay
Realtime
market-aware serving, async over FastAPI
Owned E2E
training through production serving

Surge pay on autopilot

A realtime service that prices surge pay for last mile delivery. It is the first surge model trusted to set pay automatically, with no human in the loop.

Building on an earlier version

An earlier version of the calculator already existed, trained offline and run on a schedule. It proved the idea had legs and laid the groundwork. The catch was that an offline, scheduled model was not fresh enough to trust with automated pay, so that piece was still open. That is what I picked up.

A realtime, market-aware rebuild

So I rebuilt it from the ground up as a live service.

  • A Keras model on a JAX backend, served async over FastAPI.
  • Reads fresh features from the feature store at request time.
  • Fast preprocessing with Polars and preloaded scalers to keep latency low.
  • A batched predict endpoint scores a whole set of requests in one call.

Built to be trusted

Automating pay means the bar for safety is high, so the service is built to earn that trust.

  • Schema validation at the edges with Pydantic and Pandera, so bad data never reaches the model.
  • A background worker keeps the realtime features fresh.
  • Every prediction streams metadata to model monitoring, so drift and behavior stay visible.

Why it matters

This is the version that earned automation. Fresh, fast, and observable enough to set real pay on its own, which is the realtime piece an offline model could not cover.

Inspiration

The architecture drew on two papers:

  • Cui, Z., Ke, R., Pu, Z., Wang, Y. (2018). Deep Bidirectional and Unidirectional LSTM Recurrent Neural Network for Network-wide Traffic Speed Prediction. arXiv:1801.02143.
  • Multi-Head Attention-Based Long Short-Term Memory for Depression Detection From Speech (2021). doi.org/10.3389/fnbot.2021.684037.