Unsupervised learning interview questions

8 questions across 4 sections, in the order you would learn them. Every answer here is one that works — but an answer you have read is not an answer you can give, so use Test yourself and say it out loud first.

Finding structure without labels

Read the section that teaches this

If this comes up in an interview

You have clustered your customers into five groups. How do you know the groups are real?

I would generate random data with the same shape and range and cluster it the same way. k-means returns k tidy groups from uniform noise, and both the elbow and the silhouette will show a peak on that noise, so the only meaningful comparison is whether my data scores clearly better than the null. After that I would name each cluster from its members, because a cluster nobody can describe in a sentence is not a finding.

Then they push further

Is checking stability across random seeds enough?

No. k-means on uniform random data partitions stably too, because the partition is a property of the region's geometry rather than of structure in the points. Stability rules out one failure and not the one that matters.

What gets marked up. Marked up for comparing against a null rather than reading a score, and for knowing that stability does not distinguish real structure from none.

What does the elbow method actually tell you?

Where adding another cluster stops buying much reduction in within-cluster variance. That is a hint, not an answer: it should be checked against silhouette score and against whether the clusters mean anything in the domain. K-means will produce k tidy groups from data with no cluster structure at all, and an elbow will still appear.

What is PCA doing?

Finding the orthogonal directions of greatest variance and projecting the data onto the first few. It compresses while keeping as much variance as possible, and the components are interpretable as weighted combinations of the original features.

Why should you not interpret distances in a t-SNE plot?

It optimises for preserving local neighbourhoods, so global structure is distorted. Cluster sizes and between-cluster distances in the visualisation carry no reliable meaning.

Anomaly detection and working with embeddings

Read the section that teaches this

If this comes up in an interview

How would you detect anomalies without labelled examples?

Learn what normal looks like rather than training on the rare anomalies. Isolation forests work well on tabular data because anomalies isolate in few random splits; distance to nearest neighbours works well on embeddings.

How do you evaluate clustering when you have no labels?

By inspection and stability. Read samples from each cluster to judge coherence, and rerun with different seeds to see whether the grouping holds.

If this comes up in an interview

How do you choose the number of clusters?

Try a range and compare internal scores such as silhouette and the elbow in within-cluster variance, then check stability across seeds and subsamples, and above all whether the clusters are interpretable and useful for the purpose. There is rarely one correct k.

Then they push further

When would k-means be the wrong choice?

When clusters are elongated or irregular, very different in size or density, or when there are many outliers. Density-based methods such as HDBSCAN, or Gaussian mixtures for elliptical clusters, fit those better.

Unsupervised methods in LLM work

Read the section that teaches this

If this comes up in an interview

How would you find out what users are asking your AI assistant, at scale?

Embed the questions, cluster them with a method that tolerates noise, rank clusters by size and growth, name them from samples with a model, and verify a few by reading. Then compare against what the product was designed for and add the big unexpected clusters to the eval set.

These are the questions for one topic. The whole question bank covers every topic on the site.