NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Text Editing by Command

Felix Faltings, Michel Galley, Gerold Hintz, Chris Brockett, Chris Quirk, Jianfeng Gao, Bill Dolan

Abstract

A prevailing paradigm in neural text generation is one-shot generation, where text is produced in a single step. The one-shot setting is inadequate, however, when the constraints the user wishes to impose on the generated text are dynamic, especially when authoring longer documents. We address this limitation with an interactive text generation setting in which the user interacts with the system by issuing commands to edit existing text. To this end, we propose a novel text editing task, and introduce WikiDocEdits, a dataset of single-sentence edits crawled from Wikipedia. We show that our Interactive Editor, a transformer-based model trained on this dataset, outperforms baselines and obtains positive results in both automatic and human evaluations. We present empirical and qualitative analyses of this model's performance.

Introduction

Most modern Large Language Models (LLMs) operate on a "one-shot" basis: a user provides a prompt, and the model generates a block of text in a single pass. While impressive, this approach lacks granular control; if a model deviates from the desired output, users often must restart the prompt from scratch. Furthermore, LLMs are prone to "hallucinations," confidently asserting false information because they rely solely on internal weights rather than external verification.

In contrast, human writing is inherently iterative. We draft, research, and refine. This research introduces a framework for controllable text editing, shifting the AI's role from a solo author to a collaborative editor. By issuing natural language commands, users can steer the model to update facts, improve fluency, or expand on specific points in real-time.

The interactive editing process: a user issues commands like "expand" or "add years in office," which the model executes by grounding the changes in external search results.

Methodology: The Interactive Editor

The proposed Interactive Editor is built on the T5 (Text-to-Text Transfer Transformer) architecture. The core innovation lies in its multi-faceted input processing. Unlike standard generators that only see a prompt, the Interactive Editor's encoder receives a concatenated string containing four distinct elements:

  1. The Command ($q$): A natural language instruction (e.g., "add birth date").
  2. The Grounding ($G$): Snippets of external information retrieved from a search engine to provide factual evidence.
  3. The Context ($D$): The surrounding sentences in the document to ensure coherence.
  4. The Source ($s$): The specific sentence targeted for modification.

By incorporating external "grounding," the model reduces its reliance on internal memory, significantly mitigating the risk of hallucination. The decoder then generates a revised target sentence ($s'$) that satisfies the command while remaining factually accurate.

The T5-based architecture of the Interactive Editor, illustrating how command, grounding, context, and source are encoded to produce the edited sentence.

The WikiDocEdits Dataset

To train this system, the researchers introduced WikiDocEdits, a massive dataset comprising nearly 12 million sentence-level edits extracted from Wikipedia’s revision history. The dataset pairs "before" and "after" versions of sentences, using the original Wikipedia editor's comments as a proxy for user commands. To simulate a real-world assistant, the researchers used a commercial search engine to retrieve relevant web snippets for each edit, providing the necessary "grounding" for content-heavy changes.

Key Results and Insights

The Interactive Editor significantly outperformed several baselines, including standard GPT-2 models. Key findings include:

  • Synergy of Commands and Facts: The model performs best when both commands and grounding are present. Without a command, the model lacks direction; without grounding, it is forced to guess (hallucinate) new information.
  • Performance Metrics: The model achieved a sentence-level accuracy of 30% (matching human edits exactly) and a BLEU score of 0.70.
  • Human Evaluation: In crowd-sourced tests, humans judged the model's edits to be equal to or better than the original human Wikipedia edit 59% of the time regarding command adherence. Additionally, 92% of judges found the retrieved grounding information highly relevant to the task.
  • Fluency vs. Content: While the model excels at fluency edits (grammar and rephrasing), content-heavy edits remain a challenge, requiring precise extraction of facts from grounding snippets.

Conclusion

This work represents a move toward transparent AI writing assistants that users can guide sentence by sentence. Future research will focus on expanding the model's scope beyond single sentences to document-level structural changes and improving the retrieval mechanisms to ensure the most relevant facts are always available to the editor.

Summary updated

BibTeX
@inproceedings{faltings2021text,
  author = {Felix Faltings and Michel Galley and Gerold Hintz and Chris Brockett and Chris Quirk and Jianfeng Gao and Bill Dolan},
  title = {{Text Editing by Command}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2021},
  url = {https://openreview.net/forum?id=r4eWB7XpJ79},
}
Figure