Fine-tuning after Prompting: an Explainable Way for Classification

Zezhong Wang, Luyao Ye, Hongru Wang, Boyang Xue, Yiming Du, Bin Liang, Kam‐Fai Wong2024 · DOI

Introduction

In Natural Language Processing (NLP), researchers often grapple with a fundamental trade-off between predictive performance and model transparency. Standard fine-tuning of pre-trained language models (PLMs) typically yields state-of-the-art accuracy but results in "black box" classifiers. These models rely on millions of uninterpretable parameters, making it difficult to understand the logic behind specific classifications. Conversely, prompting—where a model is tasked with completing a natural language template like "The sentiment is [MASK]"—is inherently intuitive and human-readable. However, prompting often struggles to match the raw performance of full fine-tuning and can be highly sensitive to template wording.

The paper "Fine-tuning after Prompting: an Explainable Way for Classification" introduces F&P (Fine-tuning & Prompting), a novel framework designed to bridge this gap. F&P captures the high performance of fine-tuning while maintaining the explainability of prompting by extracting human-readable "verbalizers" directly from model weights.

The F&P Methodology

The F&P method reformulates classification tasks into a "fill-in-the-blank" format and utilizes a weight-only linear classifier to bridge the gap between continuous weights and discrete words. The process follows a four-step pipeline:

  1. Prompt Construction: Input data is wrapped in a natural language template. For instance, a sentiment analysis sample is transformed into: "[CLS] I like this movie. The sentiment is [MASK]. [SEP]"
  2. Weight-Only Fine-Tuning: Rather than replacing the model's head with a standard linear layer, the authors append a "weight-only" linear classifier to the existing Language Model (LM) head. The model is fine-tuned to predict the target class based on the distribution of words it predicts for the [MASK] token.
  3. Verbalizer Extraction: Once fine-tuned, the weights of the linear classifier are analyzed. Words that receive high weights for a specific class (e.g., "excellent" for "Positive") are extracted to form a "verbalizer" dictionary.
  4. Inference via Lookup: During inference, the model predicts a word for the [MASK] slot. This word is then checked against the extracted verbalizer dictionary to determine the final classification.
Overview of the F&P pipeline, illustrating the transition from weight-only fine-tuning to verbalizer-based inference.

Explainability and Key Insights

A core advantage of F&P is its inherent transparency. By compressing a complex classifier into a simple list of keywords (typically 30-50 words per class), the model's decision-making process becomes visible to human auditors.

The Denoising Effect

The researchers discovered a "denoising" phenomenon: using only the top-k keywords often yields better performance than using the entire vocabulary. This suggests that the weight-only classifier effectively filters out "noisy" tokens that do not contribute to the task's underlying logic.

Visualization of weights assigned to specific tokens, demonstrating how the model identifies sentiment-bearing keywords.

Prompts as Feature Constraints

The use of natural language prompts acts as a constraint, forcing the model's internal attention mechanisms to focus on features relevant to the specific task (e.g., sentiment) rather than irrelevant textual noise. This focus allows the model to leverage its pre-trained linguistic knowledge more effectively than standard fine-tuning.

Experimental Evaluation

The F&P framework was evaluated across two major benchmarks:

  • GLUE (General Language Understanding Evaluation): The standard English benchmark, including tasks like SST-2 (sentiment) and CoLA (linguistic acceptability).
  • CLUE (Chinese Language Understanding Evaluation): A benchmark for Chinese language tasks, ensuring the method's robustness across different linguistic structures.

Key Results

  • Performance Parity: On the GLUE benchmark, F&P achieved results comparable to standard fine-tuning. When paired with automated prompt search (F&AP), it outperformed standard fine-tuning by an average of 2.11% on BERT-base.
  • Efficiency Gains: For BERT-large on the MNLI task, accuracy improved from 85.25% to 86.82% using the F&P approach.
  • Cross-Lingual Robustness: The method proved equally effective on the CLUE benchmark, demonstrating that the logic of extracting keywords from weights is language-agnostic.

Conclusion and Future Work

F&P offers a viable path toward "Glass Box" AI—models that are as powerful as modern black-box systems but far easier to trust and debug. While the current study focused on encoder-only models like BERT and RoBERTa, future research will explore the application of F&P to massive decoder-based Large Language Models (LLMs). By turning mathematical weights into human-readable words, F&P ensures that as AI becomes more capable, it also remains more understandable.

Summary updated

BibTeX
@misc{wang2024fine,
  author = {Zezhong Wang and Luyao Ye and Hongru Wang and Boyang Xue and Yiming Du and Bin Liang and Kam‐Fai Wong},
  title = {{Fine-tuning after Prompting: an Explainable Way for Classification}},
  year = {2024},
  doi = {10.18653/v1/2024.sighan-1.16},
}
Figure