PIL — Post-Purchase Intelligence Layer

Amazon Nova Hackathon 2024

Prevention Analytics Dashboard

Loading...

PIL Pipeline — Enhanced v2 with Batched Processing

Synthetic Data
1000-2000 orders
Nova Lite Reviews
1200+ reviews (8-40/product)
Nova Pro Validation
Quality audit
Nova Lite Risk Scoring
1800+ orders (batched)
Nova Pro Validation
Quality audit
Titan Embeddings Clustering
1400+ high-risk orders
Nova Pro Interventions
Personalized emails
Simulator
Customer outcomes

Live Prevention Feed

Loading feed...

All Orders (1000-2000 total)

Loading orders...

What is PIL?

Post-Purchase Intelligence Layer (PIL) is an AI-powered system that predicts which customers are likely to return products and proactively intervenes to prevent returns before they happen.

Built with Amazon Nova and Titan Embeddings, PIL analyzes customer reviews, identifies friction patterns, and generates personalized interventions to improve customer satisfaction and reduce logistics costs.

Complete PIL Pipeline

Step 1: Data Generation
Generate 1000-2000 synthetic e-commerce orders across 50 unique products with realistic attributes (price, category, shipping dates, customer emails).
Step 2: Review Generation Nova Lite Nova Pro
• Nova Lite generates 8-40 AI reviews per product in batches
• Reviews include ratings (1-5), sentiment (positive/neutral/negative), and return reasons
• Nova Pro validates 3 random samples per product for quality (target: 70+ score)
• Total: ~1200+ reviews across 50 products
Step 3: Risk Scoring Nova Lite Nova Pro
• Nova Lite analyzes each order in batches of 20
• Considers: price, category, payment method, product history, customer reviews
• Outputs: risk_score (0-100), risk_factors, confidence level
• Nova Pro validates random samples for accuracy
• Result: ~1400 high-risk orders (score > 50) identified
Step 4: Friction Clustering Titan Embeddings Nova Lite
• Titan Embeddings vectorizes negative reviews (1536-dim)
• KMeans clustering groups similar complaints into 3 clusters
• Nova Lite generates human-readable cluster names
• Nova Pro validates cluster quality and distinctness
• Output: Top 3 friction categories per product with percentages
Step 5: Intervention Generation Nova Pro
• Nova Pro analyzes risk score + friction clusters for each high-risk order
• Decides optimal strategy: send_email, offer_discount, priority_support, send_replacement
• Generates personalized email subject + body
• Estimates intervention cost and prevention probability
Step 6: Outcome Simulation
• Simulates customer engagement (email opened/clicked)
• Determines if intervention prevented return (probabilistic)
• Calculates comprehensive savings:
  → Prevented: +$15.93 (logistics) + order price (revenue kept)
  → Returned: -$15.93 (logistics) - order price (refund) - $2.50 (restocking)

Amazon Nova Models Used

Nova Lite $0.06/1M input, $0.24/1M output
• Review generation (batched, 8-40 per product)
• Risk prediction (batched, 20 orders per call)
• Cluster naming
Titan Embeddings $0.10/1M tokens
• Review vectorization (1536-dimensional embeddings)
• Enables semantic clustering of customer complaints
Nova Pro $0.80/1M input, $3.20/1M output
• Quality validation (reviews + risk scores)
• Intervention strategy generation
• Personalized email content creation

Key Metrics

Total Orders: 1000-2000 synthetic e-commerce orders
Products: 50 unique products across multiple categories
Reviews Generated: ~1200+ AI-generated customer reviews
High-Risk Orders: ~1400 orders with risk score > 50
Interventions: Personalized prevention strategies for each high-risk order
Expected Prevention Rate: 60-70% of high-risk returns prevented
Pipeline Cost: ~$0.05 per complete run (with v2 batching)

Tech Stack

Backend: Python, AWS Lambda, API Gateway
Database: DynamoDB (orders, reviews, product metadata)
AI Models: Amazon Nova Lite, Nova Pro, Titan Embeddings
ML: scikit-learn (KMeans clustering)
Frontend: S3 Static Website
Region: us-east-1

Hackathon Info

Event: Amazon Nova Hackathon 2024
Project: PIL - Post-Purchase Intelligence Layer
GitHub: github.com/your-repo
Demo: Live Dashboard