Teaching an LLM to manage freight crises using GRPO reinforcement learning
COVID vaccines are stranded on Route R1. Election ballots are stuck at Delhi. โน1.8 crore of server hardware is 7 hours late. A human dispatcher needs 30 minutes to triage this. We built an agent that does it in seconds.
Rule-based optimizers. Great at routine scheduling. Fail completely when disruptions cascade. Cannot reason, cannot prioritize, cannot communicate.
Reasons about network congestion, triages by urgency, reroutes strategically, and sends empathetic messages to customers โ all in a single turn.
A real-time Indian freight network crisis simulator. The agent plays a centralized logistics coordinator managing cascading disruptions across JNPT, Delhi, and Mundra.
Shipment states, route congestion (0โ100%), active disruptions, SLA time remaining, carrier availability
get_network_status ยท reroute_shipment ยท set_priority ยท communicate_eta ยท end_turn
EASY (2 ships, 1 disruption) โ MEDIUM (4 ships, 3 disruptions) โ HARD (7 ships, 4 failures)
Background agents compete for the same limited route capacity every turn. The agent must model the network โ not just react to individual shipments.
5โ7 turn episodes. Early decisions cascade. Saving the pharmaceutical shipment on turn 1 changes which routes are available on turn 4.
Partially observable. The agent must call tools to see the network. It cannot assume anything โ it must build its own world model each turn.
ETA messages are scored for empathy, specificity, and cause explanation. A unique test of "soft skills" that no other logistics env tests.
Three independent reward functions. Each has explicit negative penalties to prevent exploitation.
+0.4 Start with status check
+0.3 End with end_turn
-0.5 Duplicate end_turn (spam)
-0.3 Repeated status calls
+0.9 Clear route chosen
+0.5 All ships rerouted
-0.6 Congested route
-0.8 Empty route ID (loophole)
+0.4 Message to delayed ship
+0.2 Empathy keywords
+0.1 Specific ETA given
-0.3 Duplicate message (spam)
Group Relative Policy Optimization โ the same algorithm behind DeepSeek-R1 โ on a free Colab T4 GPU.
Always calls get_network_status first. Builds a mental model of the entire network before acting โ not guessing.
Checks route congestion before rerouting. Avoids the -0.6 penalty for choosing overloaded routes. 3+ reroutes per episode vs 1 before training.
Sends well-formed apologies with specific ETAs and causes. "We sincerely apologise โ your shipment will arrive by 6PM due to port congestion."
Stopped spamming messages and empty routes after Phase 4 correction. Learned that strategic play earns more reward than loopholes.
| Resource | Link |
|---|---|
| ๐ค Live HF Space | spaces/Leavin1611/logistics-hackathon-env |
| ๐ง Trained Model | Leavin1611/logistics-hackathon-model |
| ๐ Training Notebook | Open in Colab |
| ๐ Mini-Blog | HF_BLOG_POST.md |
| ๐๏ธ Environment Code | server/environment.py |
Stack: OpenEnv ยท FastAPI ยท TRL ยท GRPO ยท Unsloth ยท Qwen2.5-1.5B ยท Google Colab T4