YieldSense AI: The Narrative 🌟 Inspiration
Every year, grocery retailers lose billions of dollars to food waste—stock that expires on shelves because it isn’t sold in time. While the standard solution is a “50% OFF” sticker, this creates a perverse incentive. Frequent shoppers become strategic consumers: they stop buying at full price and wait for discounts, slowly destroying retailer margins.
I was inspired to build YieldSense AI to break this cycle. The goal was to create an intelligent bridge between sustainability and profitability. By using AI to determine not just if a discount should be given, but to whom and when, food waste can be reduced without sacrificing revenue.
🏗️ How I Built It
YieldSense is designed as a dual-sided ecosystem:
The Seller Engine: A backend where store managers input the “health” of inventory (expiry, physical condition, and stock levels).
The Behavioral Brain: Powered by Groq (Llama 3.3 70B), the pricing engine analyzes seller data against the specific persona and history of each shopper.
The Shopper Interface: A responsive Streamlit application that acts as a real-time mock storefront, showing personalized pricing at the edge.
📊 The Pricing Logic
I implemented a behavioral pricing model. Instead of a simple linear price decay, the AI calculates a Yield Potential 𝑌 𝑝 Y p
using multiple variables:
𝑃 𝑏 P b
: Base Price
𝐸 𝑟 E r
: Expiry Risk
𝐶 𝑠 C s
: Condition Score
𝐻 𝑢 H u
: User History Multiplier
The final price 𝑃 𝑓 P f
is computed as:
𝑃
𝑓
𝑃 𝑏 × ( 1 − ( 𝐸 𝑟 ⋅ 𝐶 𝑠 ⋅ 𝐻 𝑢 ) ) P f
=P b
×(1−(E r
⋅C s
⋅H u
))
This allows pricing to adapt dynamically based on both product risk and shopper behavior.
🧠 What I Learned
LLMs as Pricing Engines I discovered that large language models are highly effective at qualitative reasoning—for example, reframing a bruised avocado as “perfect for guacamole” for a gourmet user—something rigid algorithms struggle to achieve.
Latency Matters In retail, pricing decisions must be instant. Switching to Groq highlighted the importance of low-latency, edge inference to maintain a smooth user experience.
Context Is King A discount is not just a number—it’s a message. Using AI-generated marketing hooks helps customers feel like they are participating in a food-rescue mission, not simply buying discounted goods.
🚧 Challenges Faced
The API Quota Wall During development, I encountered significant rate limits with several models. This forced a pivot from a vision-first approach (scanning product packaging) to a logic-first architecture using Groq, which ultimately made the system faster and more reliable for the demo.
JSON Reliability Ensuring consistent, valid JSON output from an LLM for a live UI was challenging. I implemented robust JSON repair logic and fallback strategies so the application never crashes during a pricing call.
UI Glitches Mixing raw HTML for price-strikethrough effects with Streamlit components caused rendering issues. I resolved this by switching to custom CSS-injected Markdown blocks for consistent presentation.
🚀 The Future
YieldSense is a proof-of-concept for Behavioral Sustainability. By making it more profitable for stores to sell food than to discard it, the system demonstrates how market incentives—guided by AI—can be leveraged to address a major environmental challenge.
Log in or sign up for Devpost to join the conversation.