What is semantic similarity and how do you build a sentence similarity system?
Semantic similarity measures how close two sentences are in meaning. Approaches: (1) Sentence-BERT (SBERT) — fine-tunes BERT with siamese network on NLI pairs, produces sentence embeddings; cosine similarity gives semantic score, (2) Cross-encoder — concatenates two sentences, outputs similarity score; more accurate but O(n²) for large datasets, (3) Bi-encoder (SBERT) for retrieval (fast), cross-encoder for reranking top-k results. Production pattern: FAISS index with SBERT embeddings for fast approximate search, then cross-encoder reranker for top-10. Used in: duplicate detection, semantic search, FAQ matching.
What is coreference resolution and why is it hard?
Coreference resolution identifies which mentions in text refer to the same entity — "Elon Musk founded Tesla. He is also CEO of SpaceX." (He = Elon Musk). Hard because: (1) Pronouns are ambiguous — "The trophy wouldn't fit in the bag because it was too big" (it = trophy), (2) Long-distance dependencies, (3) World knowledge required. Modern approaches: SpanBERT (spans as entities), e2e-coref (end-to-end neural). Critical for: multi-document QA, dialogue systems, information extraction. Often an unsolved bottleneck in production NLP pipelines.
How do you build a production text classification pipeline that handles drift?
Production pipeline: (1) Preprocessing — standardize encoding, handle HTML/emoji, language detection, (2) Model serving — ONNX-exported model on FastAPI, batching requests for throughput, (3) Monitoring — log predictions + confidence scores, (4) Data drift detection — track input text distributions (embedding centroid shift, vocabulary drift), (5) Label drift — monitor prediction distribution changes over time with Evidently or NannyML, (6) Feedback loop — collect corrections, add to training set, retrain monthly, (7) Canary deployment — test new model on 5% traffic before full rollout. Model performance degrades silently in production without monitoring.
Know your weak spots before the interview
10-question AI readiness assessment → personalized study plan.
Take Free Assessment →Unlock 3,000+ Interview Questions
Get full access to all interview questions with detailed answers, explanations, and real company context
Enroll NLP Pack →