Settle the first-AI-use-case argument with 5,000 support tickets
A laptop pipeline of embeddings, UMAP and HDBSCAN turns raw tickets into named, counted topics, but first ask whether the client lets the data leave.
In brief
- k-means makes you choose the number of clusters up front; HDBSCAN does not, and it also sets aside tickets that fit no topic under the label -1.
- min_cluster_size is the most important parameter: set it low and you get hundreds of fragmented topics, set it high and rare problems get merged away.
- The biggest cluster is not necessarily the first use case; pick one that is large, repetitive and easy to verify.
Take a client with 5,000 support tickets. Nobody in the room has read them all, yet everyone is sure they know what customers complain about. The head of operations is certain it is delivery. The customer support lead thinks it is payment errors.
For an FDE, the question “which AI use case should we build first?” tends to arrive at exactly this moment: the data is there, and every opinion points somewhere different.
This guide walks through a pipeline compact enough to run on a laptop. At the hypothetical scale of 5,000 tickets, an afternoon is a reasonable estimate for the job, not a measured figure. The pipeline turns a pile of raw tickets into a map of topics with names and counts, and from that map you choose the first use case.
Large teams use the same idea. Intercom’s Fin.ai clusters support conversations to discover topics. Anthropic’s Clio groups conversations by topic, then has an LLM write a title and summary for each cluster. Your version is far smaller, but the logic is identical.
What you will build, and what you need
The output is a table: one row per topic, with a readable name, a ticket count and a few representative examples. The pipeline has five steps: create embeddings, reduce dimensions with UMAP, cluster with HDBSCAN, read the noise group, then name the clusters.
You need Python, pandas, the umap and hdbscan libraries, and access to an embedding model and an LLM that the client has approved for use with their data. That last condition matters most. Tickets often contain email addresses, phone numbers and order IDs, so ask about data rules before sending a single row anywhere.
The code below is a simplified sketch of the flow, not production code. The embed() function is a wrapper you write yourself around the approved embedding model.
Steps 1–2: turn text into vectors, then shrink the space
Start by loading the tickets and creating an embedding for each row.
# Simplified: embed() wraps the embedding model the client has approved
import pandas as pd
df = pd.read_csv("tickets.csv") # columns: id, text
X = embed(df["text"].tolist()) # each ticket -> one vector
Check straight away that the number of vectors matches the number of rows, 5,000 in this scenario. If some are missing, the usual cause is empty tickets or tickets that exceed the model’s length limit. Filter or truncate those rows before moving on.
The next step follows Fin.ai’s approach: before clustering, it uses UMAP to project embeddings into a lower-dimensional space, and reports that UMAP works especially well on short texts such as support messages.
The BERTopic documentation explains why: UMAP preserves some of both the local and global structure of the data, so tickets with similar meanings stay close together after the space is shrunk.
import umap
# A starting point, not a standard value: 5 dimensions, cosine distance
X_low = umap.UMAP(n_components=5, metric="cosine").fit_transform(X)
Don’t run UMAP with its default of 2 dimensions. That suits plotting, but for clustering, squeezing into too few dimensions tends to lose information. Cosine is the familiar choice for comparing semantic similarity between text embeddings. Both values should be retested on the client’s data.
Step 3: why not k-means?
OpenAI’s clustering cookbook runs simple k-means on 1,000 rows of precomputed embeddings and leaves readers to choose a number of clusters that suits their use case.
That makes k a subjective decision rather than a number you can compute. With a new client’s tickets, you don’t know whether there are 8 topics or 80.
Guess k and you are imposing your own assumptions on the data.
Fin.ai chose HDBSCAN precisely because it does not need the number of clusters in advance. The BERTopic documentation adds two further strengths: HDBSCAN can find clusters of different shapes, and it separates out outliers instead of forcing every document into some topic.
import hdbscan
df["cluster"] = hdbscan.HDBSCAN(min_cluster_size=15).fit_predict(X_low)
print(df["cluster"].value_counts().head(20))
The most important parameter is min_cluster_size, the minimum number of tickets needed to form a cluster. Fin.ai treats it as the key parameter when tuning. It settled on 15, and on Intercom’s own data that value produced more than 700 small topics.
Apply that to your 5,000 tickets: if 15 gives you hundreds of fragmented clusters, nobody in the meeting will get through them. Rerun with a few larger values, say 30 and 60, and compare the lists. Stop when the clusters at the top match the problems support staff talk about every day.
Step 4: don’t delete the -1 label
HDBSCAN assigns the label -1, meaning noise, to every ticket that does not belong to a stable cluster. The natural reflex is to filter this group out for a cleaner table. Resist it.
noise = df[df["cluster"] == -1]
print(len(noise), "noise tickets")
print(noise.sample(min(30, len(noise)))["text"].tolist())
The noise group may hold long-tail problems: a bug that appeared last week, an enterprise customer with an issue of its own, or a feature request nobody has grouped yet.
Reading 30 rows by hand does not take long, and it shows you details the count table misses. One more check is worth running: compare the size of the -1 group across two runs with different min_cluster_size values, then read which tickets moved from a cluster into noise or the other way round.
Step 5: name the clusters in two layers
A cluster with only a number means nothing to the client. The cheapest approach follows BERTopic: extract the most important words in each cluster with c-TF-IDF to get an immediate rough description of the topic.
The second layer is an LLM. OpenAI’s cookbook sends a random sample of 5 reviews per cluster to gpt-4 to name it. The page has been marked as archived, so the model name may be out of date, but the method still holds. Fin.ai also has a separate LLM step to turn its final topics into readable labels.
# Simplified: llm() wraps the approved LLM and returns a string
names = {}
for c, g in df[df["cluster"] >= 0].groupby("cluster"):
sample = g["text"].sample(min(5, len(g))).tolist()
names[c] = llm("Give this group of tickets a short name:\n" + "\n".join(sample))
df["topic"] = df["cluster"].map(names).fillna("Noise (-1)")
print(df["topic"].value_counts().head(20))
Check after this step that every cluster other than -1 has a name in the topic column. Then put the LLM’s names next to the c-TF-IDF keywords. If they disagree, for example the LLM writes “payment issues” while the keywords are all “password” and “login”, the cluster is not clean or the 5-ticket sample was not representative. Resample.
Is the largest cluster the first use case?
Not necessarily. This is where the FDE’s work begins, because the algorithm can only count. Consider three clusters at the top of the table (the figures below are illustrative):
| Cluster (illustrative) | Tickets | Repetitive answer? | Measurable outcome? |
|---|---|---|---|
| Password resets, account lockouts | 600 | Almost always the same | Yes: self-resolution rate |
| Late delivery complaints | 900 | No, needs a lookup in the shipping system | Hard, depends on partners |
| Refund policy questions | 400 | Yes, based on policy documents | Yes: compare with a reference answer |
The delivery cluster is the largest, but its answers depend on data that will be out of your reach in week one. The password cluster is smaller, but it is repetitive, low-risk and comes with a clear number to prove value.
That makes it a good candidate for the first use case, while the delivery cluster becomes the argument for requesting more access later on.
Common mistakes
The first mistake is running the pipeline once and trusting the result. Clustering is sensitive to min_cluster_size, so always present results from at least two settings, so the client can see which topics hold up when the parameter changes.
The second is treating LLM-generated names as settled conclusions. A name is a hypothesis: have the support lead read it alongside a few sample tickets before it goes on a slide. The third is ignoring sensitive data. Mask personal information before embedding, even when the model runs inside the client’s infrastructure.
Where this skill shows up in real work
In the first week of an engagement, this topic table moves customer discovery from “we think” to “your own data shows”. It also becomes a baseline: once an agent is live, you recluster new tickets to see whether the password cluster has actually shrunk.
If you want to move into an FDE role, do this exercise on a public dataset and write it up as a paragraph on your CV: number of tickets, method, clusters found, proposed use case and the reason for choosing it.
The algorithm does the grouping and counting for you. What the client pays you for is choosing which topic to tackle first, and explaining why.
Was this article useful?
Thanks for the feedback!