AWS Builder Center

Why Did My Store Get Zero Units? Building Trust Between Allocators and Optimization Engines

How generative AI on AWS can translate solver mathematics into business language, and why explainability, not accuracy, is the real adoption barrier for supply chain optimization.

Every morning, in every large retailer, the same scene plays out. An allocation optimizer, a linear programming engine, has spent the night distributing hundreds of thousands of units across thousands of stores. It has produced a mathematically optimal plan. And within an hour of the plan landing, an allocator is staring at their screen asking a question the system cannot answer:
"Why did store 4172 get zero units of our top seller?"
The optimizer knows the answer. It is encoded in the solver output: in binding constraints, shadow prices, and reduced costs. But that answer is written in the language of operations research, and the person who needs it speaks the language of retail. So the allocator does what allocators everywhere do: they override the system, ship the units manually, and trust the optimizer a little less than they did yesterday.
Multiply that by hundreds of allocators and thousands of overrides, and you get the quiet failure mode of supply chain optimization: the math is right, but nobody believes it.
This post walks through how we approached that problem, building an explainability and simulation layer on top of an allocation solver using Amazon Bedrock, AWS Lambda, and Amazon Athena. More importantly, it covers the design decisions that made business users actually trust it.

The allocator persona

If you have not worked in retail supply chain, here is the person we are building for. An allocator owns a set of product categories and a region. Their job is to make sure the right inventory lands in the right stores at the right time. They are measured on fill rates, sell-through, and stockouts. They are experts in their products and their stores. They know that the downtown location cannot take full pallets and that the suburban flagship runs promotions the forecast never quite captures.
What they are not is operations researchers. When the optimization engine gives store 4172 zero units, the raw explanation might be:
Constraint DC_OUTBOUND_CAP_EAST_WK27 binding, shadow price 4.20; store 4172 reduced cost positive at optimum; allocation dominated by higher-priority demand nodes.
That sentence is precise, complete, and useless to the person who needs it. So they escalate, or override, or build a shadow spreadsheet. Industry surveys consistently find that planners override a large share of system recommendations, and most of those overrides destroy value rather than add it. The overrides do not happen because planners are careless. They happen because the system gave them no reason to trust it.

The three questions that build trust

Working backwards from the allocator, we found that trust is built by answering three questions, in order:
1. What happened? Before any AI, allocators need clean visibility: what was allocated, where, against what demand, with what fill rate, and where the exceptions are. This is dashboards and SQL, not gen AI. Getting this right first matters. If your descriptive layer is wrong, nobody will believe your explanatory layer.
2. Why did it happen? This is where the solver's own mathematics becomes an asset. An LP solver does not just produce an answer; it produces a proof. Binding constraints tell you exactly which rule prevented a better outcome. Shadow prices tell you exactly how much the objective would improve if you relaxed that rule by one unit. This is where generative AI earns its place: not making decisions, but translating the proof into language:
Store 4172 received zero units because the East DC hit its weekly outbound capacity. Stores with higher priority scores (based on sell-through and stockout risk) consumed the available capacity first. If outbound capacity increased by 500 units, store 4172 would be next in line to receive an allocation.
Same information. Completely different outcome. The allocator now knows the system had a reason, and can judge whether the reason is acceptable or whether the constraint itself needs a business conversation.
3. What if we changed something? The final trust-builder is agency. "The DC capacity was the bottleneck. What happens if we raise it?" Letting allocators simulate constraint changes and see the network-level impact turns them from passengers into pilots. Critically, the simulation re-runs deterministic computation against solver data. The AI never invents the numbers.
What/Why/What-If maps cleanly onto the classic analytics maturity curve (descriptive, diagnostic, prescriptive), but the framing that resonated with business users was simpler: these are the three questions you already ask every morning.

The architecture

The platform is organized as a multi-agent conversation platform, phased around those same three questions. A super agent classifies the user's intent and routes the question to the right specialist: a knowledge and historical agent for "what happened," an explainability agent for "why," and a what-if agent for simulation.
Allocation Explainability Architecture: a super agent routes user questions to phase-specific agents for What Happened, Why, and What-If, backed by a shared data and compute layer

Here is the shape of the system on AWS:
  • The solver stays untouched. After each optimization run, the engine writes its full output (allocation decisions, constraint metadata, slack values, shadow prices) as Parquet files to Amazon S3, partitioned by run ID.
  • Amazon Athena provides SQL over that output. No new database, no ETL pipeline. Query results are cached to keep repeat questions fast and cheap.
  • An AI agent on AWS Lambda, built with the open-source Strands Agents SDK and powered by Claude on Amazon Bedrock, answers "why" questions. The agent has tools (look up an allocation, fetch binding constraints for a store/product, compare priority rankings), and every tool resolves to an Athena query against actual solver output.
  • A simulation Lambda handles what-if scenarios asynchronously, with results cached in Amazon DynamoDB and pushed to the team's Slack channel via Amazon SNS and AWS Chatbot.
  • Amazon API Gateway with Amazon Cognito fronts everything, and Amazon CloudFront serves the React frontend.
Two design decisions turned out to matter far more than model choice, and both are trust decisions disguised as engineering decisions.

Decision 1: Route intent before invoking any model

Not every question deserves an LLM. Incoming questions hit a zero-cost, regex-based intent router in Lambda before any model is invoked:
  • Off-topic ("write me a poem") gets a canned rejection. 0 seconds, $0.
  • What-if questions are redirected to the deterministic simulator, because scenario math should never be improvised by a language model.
  • Conceptual questions ("what is a shadow price?") go to a small, fast model (Claude Haiku) with no tools: pure domain explanation in about 3 seconds.
  • Data questions ("why did store 4172 get zero?") go to the full agent (Claude Sonnet) with the complete tool suite, about 12 seconds.
This keeps costs proportional to complexity, but the deeper benefit is behavioral: the system visibly refuses to freelance. When an allocator asks something outside its lane, it says so instead of generating something plausible. Nothing erodes trust faster than a confident wrong answer; nothing builds it faster than an honest "that's not my job."

Decision 2: Ground every claim in solver output

The agent is architecturally incapable of answering a data question from its own general knowledge. Every factual claim (quantities, constraints, priorities) must come from a tool call that resolves to a query against the actual Parquet output of the actual solver run being discussed. The LLM's job is narrow: decide which tools to call, then narrate the results in business language.
This is retrieval-grounding taken to its logical conclusion for structured data: the solver output is the ground truth, and the model is never allowed to speak without citing it. When an allocator spot-checks an explanation against the raw allocation report (and they will, repeatedly, during the first month), the numbers match. That is how trust compounds.

The jargon translation layer

A subtle but crucial piece of the prompt design: the agent maintains a bilingual dictionary between solver-speak and allocator-speak.
Solver says
Allocator hears
Binding constraint
"The rule that stopped a better outcome"
Shadow price
"What one more unit of this resource would be worth"
Slack
"How much headroom is left before this rule bites"
Reduced cost
"How far this store was from making the cut"
Infeasible
"These rules contradict each other, so something has to give"

We learned not to hide the technical terms entirely. Power users grow into them, and hiding them reads as condescension. The pattern that worked: lead with the business phrasing, keep the technical term in parentheses. Over a few weeks, allocators started using "binding constraint" unprompted in meetings with the data science team. That vocabulary convergence is worth more than any dashboard: it means the two groups are finally arguing about the same thing.

What changed for the business

The outcomes worth measuring are not model metrics. They are trust metrics:
·       Override rates fall when every override requires answering "the system said X because Y. What do you know that it doesn't?" Sometimes the allocator does know something the model doesn't, and that surfaces constraint gaps worth fixing. Either way, value is created.
·       Escalations to data science drop. "Why did the solver do X?" tickets that used to take an OR specialist a day to answer become self-service, in seconds.
·       Constraint conversations become business conversations. When the system repeatedly reports the same binding constraint with a high shadow price, that is not a tech artifact. It is a quantified business case ("this DC's capacity limit is costing us this much per week") that a supply chain VP can act on.
·       The optimizer's credibility becomes inspectable. Trust stops being a leap of faith and becomes a habit of verification that keeps paying off.

Lessons if you're building this

1.     Start from the persona's morning, not the model's capability. What/Why/What-If came from watching how allocators actually work, not from an AI feature list.
2.     Let the solver be the source of truth. LP/MIP solvers already produce explainable artifacts: shadow prices, slack, duals. You do not need AI to generate explanations, only to translate ones the math already provides.
3.     Route before you reason. A regex router in front of your models cuts cost and latency, and teaches the system to say "no," which is itself a trust feature.
4.     Keep the deterministic parts deterministic. Simulation, aggregation, and routing are code, not prompts. Reserve the LLM for language.
5.     Expect spot-checking, and welcome it. Design the system so its claims are verifiable against raw data. The first month of adoption is the audit. Pass it, and adoption takes care of itself.
The uncomfortable truth about supply chain optimization is that the last mile is not mathematical. It is human. The solver was never the problem; the silence around it was. Generative AI, used narrowly and grounded rigorously, turns out to be very good at breaking that silence.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article