This project showcases an event spine architecture where every customer interaction is stored as an immutable event. The system trains a dual-phase ML model to predict churn risk, forecast lifetime value, and recommend next best actions—all from a single timeline of events.
Uses a composite index (customer_id, event_time DESC) for O(k) range scans with no joins and no sorting. Events are pre-ordered in storage, enabling instant timeline reconstruction. Append-only writes ensure data integrity and audit trails.
A dual-phase attention model (1.8M params) analyzes event sequences to predict churn risk at 30/60/90 day horizons, forecast LTV, assess payment risk, and recommend next best actions. The model uses hierarchical event encoding with time-aware self-attention to capture temporal density patterns that rule-based systems miss. Trained in PyTorch, exported to ONNX, and served directly in Vercel serverless via onnxruntime-node — eliminating a separate inference service and cutting cold-start latency from 30s to under 2s.
The timeline reveals patterns: payment failures signal churn risk, support tickets indicate frustration, digital engagement shows loyalty, and roaming events identify travelers. These insights drive proactive retention strategies.
Event spine architecture with ML churn prediction & next best action
Enter a customer ID and click "Load Journey" to begin