Online Token Processing, Embeddings, and Classification

Asked at Apple · MLOps & Deployment · Difficulty: Medium · Last asked Dec 11, 2025

Build a text classifier that learns from a stream of labelled records, one record at a time, without ever seeing the whole corpus. Each record is a piece of text and a class label. For each record the model turns the text into token ids, looks up an embedding per token, averages them into a document vector, scores the classes with a linear softmax layer, and takes one stochastic gradient descent (SGD) step on all of its parameters. Memory must stay fixed however many distinct words the stream contains.

Loading the problem…