Perfect — you can absolutely swap the manual topic labeling step with an LLM-as-Judge pipeline.
That way, you stay consistent with how you already used LLMs to evaluate GCA aspects.
Here’s a concrete plan:
🔹 Pipeline for Group Performance with LDA + LLM Annotation
- Run LDA on your transcripts
Fit an LDA model on all contributions (just as you planned).
Get the top-NNN keywords per topic + representative contribution snippets.
pythonCopy code# Extract top words per topic
def get_top_words(model, feature_names, n_top_words=10):
topics = {}
for idx, topic in enumerate(model.components_):
top_words = [feature_names[i] for i in topic.argsort()[:-n_top_words - 1:-1]]
topics[idx] = top_words
return topics
feature_names = vectorizer.get_feature_names_out()
topic_keywords = get_top_words(lda, feature_names, n_top_words=15)
- Ask the LLM to label topics
Instead of manually deciding on-task vs. off-task, feed the top words + sample contributions to your Judge prompt.
The Judge can classify each topic as “Relevant/On-task” or “Irrelevant/Off-task” given your task definition.
Example Judge prompt:
pgsqlCopy codeYou are a domain expert. The following keywords and excerpts represent a topic discovered by LDA.
Task definition: [insert your group’s discussion domain].
Question: Is this topic relevant to the assigned task, or off-task?
Topic keywords: [list of words]
Sample excerpts: [3–5 short contributions]
Answer: Relevant or Off-task
- Compute topic relevance scores
Once each topic is labeled by the LLM, build sets Q′Q′Q′ (on-task topics) and Q°Q°Q° (off-task).
For each contribution ctc_tct, its on-task score is:
T′(ct)=∑q∈Q′P(topic q∣ct)T′(c_t) = \sum_{q \in Q′} P(\text{topic } q \mid c_t)T′(ct)=q∈Q′∑P(topic q∣ct)
Group performance = average of these scores per group.
pythonCopy code# Suppose llm_labels is {topic_id: "Relevant"/"Off-task"}
on_task_ids = [tid for tid, label in llm_labels.items() if label == "Relevant"]
df['on_task_score'] = topic_distributions[:, on_task_ids].sum(axis=1)
group_perf = (
df.groupby("group_id")['on_task_score']
.mean()
.reset_index()
.rename(columns={'on_task_score': 'group_performance'})
)
- (Optional) Add consistency checks
Run the Judge multiple times and aggregate (e.g., majority vote).
Or, use confidence scoring (e.g., ask for 1–5 relevance rating instead of binary).
✅ That gives you a fully automated group performance metric:
LDA → LLM annotates topics → compute proportion of on-task talk per group.
Do you want me to draft the LLM Judge prompt template (with few-shot examples) so you can apply it directly to your LDA topics?