Introduction
Controlled Text Generation (CTG) is a critical task in natural language processing, aimed at ensuring AI-generated text adheres to specific constraints such as sentiment, topic, or safety guidelines. Traditionally, CTG methods require "white-box" access to model weights for fine-tuning or "gray-box" access to output logits for weighted decoding. However, the most advanced modern Large Language Models (LLMs), such as GPT-4, are often "black-boxes" accessible only via text-based APIs. Existing methods for black-box control frequently struggle with a trade-off between effective attribute steering and linguistic fluency.
This paper introduces ScoPE (Score-based Progressive Editor), a novel framework designed to steer black-box models by iteratively editing generated text blocks to maximize domain-specific target scores while maintaining high fluency.
Methodology
Progressive Block-wise Editing
Unlike traditional methods that attempt to modify the internal state of the generator, ScoPE modifies the context the generator perceives. As the backbone black-box LM generates text, ScoPE intercepts the output every $b$ tokens (a "block"). The editor modifies these tokens to better reflect target attributes and feeds the edited version back into the backbone LM as the context for the subsequent generation step.
Score-based Training and Optimization
The editor is trained to maximize a Target Score derived from a Masked Language Model (MLM), such as RoBERTa, fine-tuned on the target domain (e.g., "Camera Reviews"). To preserve the natural quality of the backbone model, ScoPE optimizes for Score Disparity—the difference between the edited text's score and the original input's score. This prevents unnecessary modifications that could degrade fluency. Additionally, a Repetition Score is employed to penalize loopy text, and task-specific classifiers can be integrated for more granular control.
Experimental Results
The researchers evaluated ScoPE using the Amazon Customer Reviews dataset, focusing on category control (e.g., Camera, Videogame) and sentiment control. Testing involved various backbone models, including OpenAI’s davinci-002 and babbage-002.
Quantitative Performance
ScoPE demonstrated significant improvements in both fluency and attribute alignment. As shown in the performance table below, ScoPE consistently achieved lower Perplexity (PPL) and higher MAUVE scores (a measure of similarity to human-written text) compared to the base black-box models across all tested domains.
Multi-Attribute Control
ScoPE also proved effective in multi-attribute scenarios (e.g., generating a "Positive Camera Review"). By employing sequential editing or mixed-logit strategies, the framework outperformed standard black-box models in attribute accuracy without sacrificing the coherence of the generated prose.
Discussion and Limitations
ScoPE offers a powerful solution for steering inaccessible models by leveraging the model's own predictive power through context manipulation. However, the approach introduces certain trade-offs:
- Computational Overhead: Calculating MLM scores for every position is resource-intensive during training.
- Inference Latency: The iterative editing process naturally slows down generation compared to raw backbone output.
- Data Requirements: The system requires a representative corpus of the target domain to train the scoring MLM effectively.
Future work may explore more flexible editing operations, such as token insertion and deletion, to further enhance the editor's capabilities.
Summary updated