When would you choose an instance-based model like k-NN over a model-based algorithm?

Quick Overview

Decide when an instance-based learner such as k-nearest neighbors is a better choice than a model-based algorithm. Tests the lazy versus eager distinction, the data conditions that favor k-NN, its costs in high dimensions and at scale, and the knobs that control it.

When would you choose an instance-based model like k-NN over a model-based algorithm?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

When would you choose an instance-based model like k-NN over a model-based algorithm? ```hint Compare where the work happens Ask when each kind of model does its computation (at training time or at query time) and what each one keeps around after training. ``` ### What a Strong Answer Covers - The difference between instance-based (lazy) and model-based (eager) learning. - The data and problem conditions under which k-NN is a good fit. - The conditions under which it fails, including dimensionality, data size and latency. - The preprocessing it depends on and the main knobs to tune. ### Follow-up Questions - How do approximate nearest-neighbor indexes change the latency and accuracy trade-off for k-NN at scale? - How does the choice of `k` relate to the bias-variance trade-off, and how would you pick it? - Why can k-NN work well on 768-dimensional text embeddings when it fails on 768 raw features? - How would you evaluate a k-NN model without the query point finding itself as a neighbor?

Overview: Decide when an instance-based learner such as k-nearest neighbors is a better choice than a model-based algorithm. Tests the lazy versus eager distinction, the data conditions that favor k-NN, its costs in high dimensions and at scale, and the knobs that control it.

General logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

When would you choose an instance-based model like k-NN over a model-based algorithm?

What a Strong Answer Covers Guidance

  • The difference between instance-based (lazy) and model-based (eager) learning.
  • The data and problem conditions under which k-NN is a good fit.
  • The conditions under which it fails, including dimensionality, data size and latency.
  • The preprocessing it depends on and the main knobs to tune.

Follow-up Questions Guidance

  • How do approximate nearest-neighbor indexes change the latency and accuracy trade-off for k-NN at scale?
  • How does the choice of k relate to the bias-variance trade-off, and how would you pick it?
  • Why can k-NN work well on 768-dimensional text embeddings when it fails on 768 raw features?
  • How would you evaluate a k-NN model without the query point finding itself as a neighbor?