ByGPT5: End-to-End Style-conditioned Poetry Generation with Token-free Language Models

Jonas Belouadi, Steffen Eger · DOI

Introduction

Generating high-quality poetry remains one of the most challenging tasks for artificial intelligence. Unlike standard prose, formal verse requires strict adherence to character-level constraints, including rhyme schemes, rhythmic meters, and phonetic patterns like alliteration. While modern Large Language Models (LLMs) excel at general language tasks, they often struggle with these formal constraints due to their underlying architecture.

The Tokenization Bottleneck

Most contemporary LLMs, such as GPT-4, utilize subword tokenization methods like Byte Pair Encoding (BPE). While efficient for processing large volumes of text, tokenization effectively "blinds" models to the internal character and phonetic structure of words. For a model to understand that "cat" rhymes with "hat," it must learn these relationships indirectly, as the tokens themselves do not explicitly represent the shared phonetic ending.

To overcome this, researchers have introduced ByGPT5, a token-free, byte-level decoder-only language model. By operating directly on raw bytes, ByGPT5 can "see" the individual letters and sounds, allowing it to learn the structural "soul" of poetry alongside its semantic content.

Methods and Architecture

ByGPT5 is a decoder-only Transformer designed for end-to-end poetry generation. The model is "warm-started" using weights from the decoder of ByT5, a pre-existing byte-level encoder-decoder model, providing a strong foundation for language understanding.

The model is conditioned using specific style tags, such as <ABBA> <iambus> <high>, which dictate the rhyme scheme, meter, and level of alliteration. This allows for precise control over the generated output. Unlike traditional pipeline systems that generate content and then attempt to "fix" the style, ByGPT5 generates the entire poem in a single pass, learning the direct relationship between style prompts and text structure.

Training perplexity for ByGPT5 models of different sizes on English and German datasets.

The QuaTrain Dataset

Training a model to master poetic style requires vast amounts of labeled data. The researchers developed QuaTrain, a massive corpus containing 2.7 million English and 5.9 million German quatrains. Because manual labeling at this scale is infeasible, the team employed automated high-accuracy classifiers (such as Canine-C) to label rhyme and meter, alongside phonetic formulas to quantify alliteration.

Key Results and Evaluation

ByGPT5 demonstrates superior performance in stylistic accuracy compared to much larger subword-based models. In automatic evaluations, ByGPT5 outperformed GPT-2 and mT5 significantly, particularly in maintaining rhyme schemes, where it showed a 5% to 20% improvement over GPT-2.

Comparison of Rhyme, Alliteration, Meter, and Coherence scores across various models for English and German.

In head-to-head comparisons with ChatGPT, ByGPT5's poems were preferred by a rhyme scorer in 85% of cases. Human evaluations using Best-Worst Scaling also ranked ByGPT5 as the closest to human-written poetry in terms of rhyme quality. Notably, the "small" version of ByGPT5, with only 73.5 million parameters, remains highly competitive, showcasing the efficiency of byte-level modeling for specialized creative tasks.

Limitations and Future Directions

Despite its success, ByGPT5 faces challenges regarding inference speed. Because byte-level models treat every character as a token, the resulting sequences are significantly longer than those in subword models, leading to slower generation times. Additionally, the current research focuses exclusively on quatrains. Future work aims to extend the model to more complex forms like sonnets and limericks, and to improve the narrative depth of the generated content.

Conclusion

ByGPT5 represents a significant step forward in end-to-end creative text generation. By removing the barrier of subword tokenization, the model achieves a level of formal precision that eludes much larger general-purpose LLMs, proving that for tasks requiring phonetic awareness, the byte-level approach is superior.

Summary updated

BibTeX
@inproceedings{belouadi2023bygpt,
  author = {Jonas Belouadi and Steffen Eger},
  title = {{ByGPT5: End-to-End Style-conditioned Poetry Generation with Token-free Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-long.406},
}
Figure