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…
More Apple interview questions
- LLM conceptual questions
- Implement a Two-Hidden-Layer MLP with Backpropagation in NumPy
- Compare PPO, DPO, and GRPO
- Implement a Vision Transformer (ViT) from Scratch
- Sample from a Gaussian Distribution Using Only Uniform Sampling
- Diagnose a CTR Drop After a Ranking Model Launch