Abstract
Adapting massive pre-trained models (PTMs) via black-box APIs is often computationally expensive and slow due to the lack of gradient access. Traditional input-side adaptation methods, such as prompt tuning, require thousands of queries to optimize. We present Decoder Tuning (DecT), a novel approach that shifts adaptation to the output side. By training a lightweight prototypical decoder on model outputs, DecT achieves a 200× speedup and a 3% accuracy boost over state-of-the-art black-box methods while requiring only a single API query per training sample.
The Challenge of Model-as-a-Service (MaaS)
In the current era of large language models like GPT-4 or RoBERTa, models are frequently accessed through APIs where internal weights are frozen and gradients are inaccessible. Adapting these models to specific tasks typically involves "black-box" prompt engineering on the input side. However, optimizing prompts without gradient information is inefficient; methods like Black-box Tuning (BBT) or RLPrompt often require tens of thousands of API queries and hours of computation, making them prohibitively expensive for many users.
Methodology: Shifting to the Output Side
DecT proposes moving the adaptation focus from the input to the output. Instead of attempting to find the perfect prompt to elicit a response, DecT focuses on how to interpret the model's existing outputs.
The process involves four primary stages:
- Single Query: The PTM is queried once per sample using a simple manual prompt to extract initial prediction logits and hidden state representations from the final layer.
- Calibration: Output scores are calibrated using a null-input baseline to mitigate inherent model biases toward specific words.
- Prototypical Network (ProtoNet): DecT utilizes a Prototypical Network as the decoder. It maps hidden states into a metric space where each class is represented by a "prototype" hypersphere, calculating class membership based on proximity.
- Hybrid Prediction: The final output is a weighted combination of the PTM’s original prior knowledge and the ProtoNet’s posterior task-specific knowledge.
Because the ProtoNet is extremely lightweight, it can be trained using standard gradient descent in seconds on a single GPU, bypassing the need for black-box optimization of the PTM itself.
Experimental Setup and Datasets
The authors evaluated DecT across 10 diverse Natural Language Understanding (NLU) benchmarks, including sentiment analysis (SST2, Yelp, IMDB), topic classification (AG’s News, Yahoo, DBPedia), Natural Language Inference (RTE, SNLI, MNLI), and entity typing (FewNERD). These datasets range from simple binary classification to complex tasks with up to 66 labels.
Key Results and Efficiency
DecT demonstrates a significant breakthrough in the efficiency-accuracy trade-off for black-box adaptation.
- Speed: DecT reduces adaptation time from approximately 9,800 seconds (for BBTv2) to just 3 seconds.
- Query Efficiency: Competing methods require up to 10,000 queries per sample; DecT requires exactly 1.
- Accuracy: DecT outperformed all baselines by over 3% absolute accuracy on average. On difficult datasets like Yahoo and FewNERD, the performance gap reached 10-20%.
- Stability: Unlike prompt-based methods, which are sensitive to wording and random seeds, DecT showed consistently low variance across different runs.
Discussion and Insights
The success of DecT stems from two core insights. First, gradients are essential: by training a small network outside the black-box PTM, DecT regains the efficiency of backpropagation. Second, hybrid knowledge is superior: many output-side methods fail by treating the PTM as a mere feature extractor. DecT succeeds by explicitly combining the model's internal "prior" knowledge (logits) with new learned representations.
Furthermore, the choice of a Prototypical Network over a standard Multi-Layer Perceptron (MLP) proved crucial for few-shot learning. ProtoNets are more robust in low-data regimes (1, 4, or 16 shots) because they learn a metric space rather than just a classification boundary, preventing overfitting.
Limitations and Future Work
Currently, DecT is optimized for classification tasks with fixed label sets and has not yet been extended to free-form generation tasks like summarization. Additionally, while highly competitive, it still lags behind full fine-tuning on tasks requiring deep logical reasoning with large datasets. Future research will explore combining input-side and output-side adaptation and extending the "tuning as decoding" philosophy to generative models.
Summary updated