Sub topic 6
Grouping Similar Questions into Topic Clusters
Assume you already have privacy-scrubbed, normalised questions and basic intent labels. A topic cluster is a group of questions about the same subject, even when customers use different words. Clustering helps you see which subjects your prompt set covers and where important gaps remain.
What a topic cluster represents
Consider these questions:
- “How do I change the email on my account?”
- “Can I use a new address for billing?”
- “Where can I update my login email?”
They use different wording, but they concern the same topic: changing an account email address. Their intent may also be the same, such as how_to.
Topic and intent answer different questions:
| Dimension | Question it answers | Example |
|---|---|---|
| Topic | What subject is the customer asking about? | Account email |
| Intent | What does the customer want to do? | Learn how to change it |
| Journey stage | Where is the customer in the decision process? | Existing customer |
Keep these dimensions separate. Combining them into one label makes later analysis harder. For example, account_email_how_to hides whether a new question is about account email or about the “how to” intent.
A useful cluster has:
- A short, specific name, such as
account_email_changes - A description that states what belongs in the cluster
- Representative questions in natural customer wording
- A boundary that states what does not belong
- The number of source questions and their sources
A repeatable clustering workflow
1. Start with a useful representation
A representation is the information used to compare questions. Begin with the cleaned text, intent, product area, language and source. Remove fields that can create accidental similarity, such as ticket IDs or agent notes.
You can compare questions with embeddings, which are numeric representations designed to capture meaning. Embeddings work well for large collections, but they still need human review. Similar wording does not always mean the same topic.
For a small set, token overlap can provide a transparent first pass:
import re
from collections import defaultdict
def words(text):
return set(re.findall(r"[a-z0-9]+", text.lower()))
def similarity(left, right):
a, b = words(left), words(right)
return len(a & b) / len(a | b) if a | b else 0.0
def cluster_questions(questions, threshold=0.35):
clusters = []
for question in questions:
for cluster in clusters:
if max(similarity(question, item) for item in cluster) >= threshold:
cluster.append(question)
break
else:
clusters.append([question])
return clusters
questions = [
"How do I change my account email?",
"Where can I update my login email?",
"How can I export my invoices?",
]
for number, cluster in enumerate(cluster_questions(questions), start=1):
print(number, cluster)This simple method is not a production clustering algorithm. It demonstrates the decision: assign a question to a group when its similarity to an existing member passes a chosen threshold. For larger sets, use an embedding-based method such as hierarchical clustering, then inspect the results.
2. Choose the level of detail
Clusters should be detailed enough to guide prompt coverage but broad enough to contain multiple real questions. “Billing” may be too broad. “Changing the billing email for an annual subscription” may be too narrow if only one question uses that exact case.
A practical hierarchy is:
- Product area:
billing - Topic:
invoice_access - Optional subtopic:
download_invoice_pdf
Use the topic level for the main prompt set. Keep subtopics when they affect the answer, policy, or user journey.
3. Name and review each cluster
After grouping, write a label from the shared meaning rather than copying the most frequent phrase. Read the shortest, longest and most unusual examples in each cluster. Then check:
- Do all questions need the same kind of answer?
- Does one question belong to another cluster?
- Are two clusters different only because of wording?
- Is a large cluster hiding several distinct tasks?
- Does the cluster contain questions from only one source?
Reviewers should be able to explain why each assignment was made. Record uncertain assignments instead of forcing them into a group.
Reading the cluster results
Cluster counts show demand, not quality. A large cluster may reflect a recurring product problem, a seasonal event or one support channel’s reporting habits. A small cluster may represent a safety, legal or high-value question that must still appear in the test set.
Create a cluster register with the label, definition, count, sources and review status. Use it later to sample prompts by frequency while preserving rare but important topics.
Common clustering errors
- Keyword-only grouping: “cancel my order” and “cancel my subscription” share a verb but may require different policies.
- Over-splitting: Separate clusters for “download invoice” and “get an invoice” can reduce coverage clarity.
- Over-merging: Putting password resets and account email changes into one account cluster can hide distinct answers.
- Source bias: Questions from support may dominate while search and community questions remain unseen.
- Ignoring intent: A product topic can contain “how to,” comparison, troubleshooting and eligibility questions.
Exercise
You have 100 questions about payments. Eighty ask how to download an invoice, fifteen ask why a payment failed, and five ask whether a payment method is supported. Should these be one cluster?
Show answer
No. Use separate clusters such as invoice_access, payment_failure_troubleshooting and payment_method_eligibility. They share a product area but have different customer goals and likely require different answers.