Semi-Supervised Learning for Prompt Classification in ChatGPT

Alexandru-Gabriel Ilie, Traian RebedeaRoCHI 2023

Introduction

As Large Language Models (LLMs) like ChatGPT become integral to daily workflows, understanding the "actual distribution" of user tasks is critical for developers. Identifying whether a user is seeking code generation, brainstorming, or casual chat allows for more efficient prompt routing to specialized models and the refinement of training data. However, the primary obstacle to building robust classifiers is the high cost and slow pace of manual data labeling. While platforms like ShareGPT provide millions of real-world interactions, labeling them at scale is a significant challenge. This paper explores the use of Semi-Supervised Learning (SSL) to build accurate prompt classifiers using minimal human-labeled data.

Methodology

The researchers employed a Semi-Supervised Learning approach, specifically leveraging the FixMatch (or FixText) framework. This method allows a model to learn from a small set of labeled data while simultaneously extracting patterns from a much larger pool of unlabeled data.

The FixMatch Framework

The core mechanism involves predicting a "pseudo-label" for an unlabeled prompt that has undergone "soft" augmentation (minor changes). The model then attempts to predict the same label for a version of the prompt that has undergone "strong" augmentation (significant changes). Consistency between these predictions increases the model's confidence and accuracy.

Augmentation Strategies

Two primary techniques were used to create these variations:

  1. Easy Data Augmentation (EDA): Involves simple text manipulations such as synonym replacement, random insertion, or word swapping.
  2. Backtranslation: A more sophisticated approach where a prompt is translated from English to a secondary language (e.g., French or Russian) and then back to English. This creates natural-sounding paraphrases that preserve intent while altering linguistic structure.

Dataset and Classification

The study utilized 502 manually labeled prompts and 40,000 unlabeled prompts, all sourced from ShareGPT. Unlike traditional single-label systems, the researchers adopted a multi-label logic, recognizing that human intent is often complex (e.g., a single prompt may involve both brainstorming and coding).

Figure 1: Distribution of prompt categories in the labeled ShareGPT dataset, highlighting the prevalence of Generation and Brainstorming tasks.

The authors defined eight distinct classes: Generation Coding, Generation (Text), Open QA, Chat, Brainstorming, Rewrite, Open QA Coding, and Other. Analysis revealed that real-world usage differs significantly from synthetic benchmarks, with "Generation" and "Brainstorming" appearing much more frequently than previously estimated in literature.

Key Results

The transition from a purely supervised baseline to a semi-supervised model yielded substantial performance improvements. The integration of FixMatch with Backtranslation proved particularly effective, as the model learned to recognize core user intent across diverse paraphrased structures.

Figure 4: Performance metrics (Precision, Recall, and F1) comparing the supervised MMBT baseline against semi-supervised FixMatch variants across different data scales.

As shown in the experimental results, the FixMatchLSimg+bt configuration consistently outperformed the supervised MMBT baseline. With 500 labeled examples per class, the semi-supervised model achieved an F1 score of 0.760, demonstrating that SSL can significantly enhance classification accuracy without requiring massive labeling campaigns.

Conclusion and Future Work

This research demonstrates that semi-supervised learning is a viable and efficient path for categorizing complex, real-world LLM interactions. By using techniques like Backtranslation and FixMatch, developers can achieve high-performing classifiers with a fraction of the labeled data typically required. Future work may involve using these classifiers as front-end "routers" to optimize model performance by directing prompts to specialized downstream architectures. However, challenges remain regarding hyperparameter sensitivity and the increased computational cost associated with processing multiple augmented versions of unlabeled data.

Summary updated

BibTeX
@inproceedings{ilie2023semi,
  author = {Alexandru-Gabriel Ilie and Traian Rebedea},
  title = {{Semi-Supervised Learning for Prompt Classification in ChatGPT}},
  booktitle = {RoCHI},
  year = {2023},
}
Figure