Presenting Precog, Nubank’s Real Time Event AI

Cristiano Breuel, Gabriel Bakiewicz, George Salvino, Mariana Sant’Anna, Luana Campos, Cinthia Tanaka, Pedro Chaves, Allan Garcia, Kevvin Sahdo, Tan Mukhopadhyay21 Jun 2023

Problem

Nubank's support teams need to know in real time what a customer is calling about. The best signal is the app click stream, but each product team defines its own events and attributes, and these change with every app release. Hand-built features for more than ten products could not keep up, so models lagged. Some newer products had no traditional features yet. Calling several REST services to fetch features also gave high worst-case latency.

Example from the article: routing phone calls to the right specialist agent without asking the customer.

Solution in brief

Each click-stream record is turned into a text symbol, and symbols are embedded with a self-supervised contrastive model (StarSpace). A customer is the bag of embeddings of the events in a recent window (3 hours). A downstream classifier uses that vector, plus other features, to rank the product the customer needs help with. Events are cached in Redis for serving.

Questions this case answers
  • How to turn schemaless event logs from many independently owned flows into a reusable entity representation for downstream models without per-use-case feature engineering
  • How to serve fresh features built from a recent window of events at low latency and low storage cost
  • How to predict in real time which product a customer needs help with, using only app click-stream events?
  • How to build reusable customer features from semi-structured event logs without hand-made feature engineering for each product?

Tools and methods

  • Contrastive learning — trains event embeddings without labels (anchor, positive and negatives are described in Core idea)
  • StarSpace — library that learns the entity embeddings
  • Bag-of-words customer vector — aggregated symbol embeddings from the window
  • Redis — low-latency cache of recent events, replaced DynamoDB for cost
  • Amazon DynamoDB — first-version store, dropped as too expensive
  • Apache Kafka — event stream for training and serving paths
Continue reading — it's free

Google or a one-time email code. No password.