Pixel-based language models (PLMs) offer a compelling alternative to traditional subword-tokenized models by processing text as images. This approach eliminates the need for a fixed vocabulary, making models inherently robust to typos and diverse scripts. However, the standard "continuous" rendering method—where text is rendered as a single strip and sliced into arbitrary patches—introduces significant representational redundancy. This paper, presented at EMNLP 2023, investigates how structured rendering can mitigate this "representation explosion" and improve model efficiency.
The Challenge of Continuous Rendering
In models like PIXEL, text is typically rendered as a continuous sequence of 16x16 pixel patches. Because these patches are sliced without regard for character boundaries, a single word can appear in numerous visual forms depending on its pixel-offset within a patch. For example, the word "the" shifted by one pixel creates an entirely new set of patches for the model to learn. This redundancy forces the model to dedicate significant capacity to learning visual variations of identical semantic units, hindering training efficiency and representational depth.
Structured Rendering Strategies
To address this, the authors propose four distinct rendering strategies to align text with patch boundaries:
- CONTINUOUS (Baseline): Unstructured slicing of a text image strip.
- WORDS: Aligning each word to start at a new patch boundary.
- MONO: Utilizing monospaced fonts to ensure character-patch alignment.
- BIGRAMS: Rendering exactly two characters per patch, using whitespace padding to maintain alignment.
The BIGRAMS strategy emerged as a "Goldilocks" solution. It provides enough structure to collapse the input space into meaningful units (like common character pairs) without requiring the complex, language-specific logic of a word-level tokenizer.
Collapsing the Input Space
The primary benefit of structured rendering is the dramatic reduction in unique input patches. By forcing characters into specific positions, the model encounters the same visual patterns much more frequently.
As shown in the figure above, the CONTINUOUS strategy produces over 250,000 unique patches in a sample of 10,000 sentences. In contrast, the BIGRAMS strategy produces fewer than 50,000. This compression allows the model to learn more stable and semantically rich representations, as it is no longer "distracted" by minor visual shifts.
Performance and Efficiency
The efficiency gains from structured rendering are substantial. The authors found that a smaller model using BIGRAMS (22M parameters) could outperform a much larger baseline model (86M parameters) on the GLUE benchmark (75.4 vs 71.0).
Furthermore, these models demonstrate impressive multilingual robustness. Despite being pretrained primarily on English, the BIGRAMS structure generalized effectively to diverse languages. On the MasakhaNER task involving 10 African languages, the BIGRAMS-based model outperformed the original PIXEL baseline by an average of 3.6 points.
Conclusion
By moving from unstructured image strips to organized bigram patches, pixel-based language models can achieve better performance with significantly fewer parameters. This research suggests that the "redundancy" previously thought inherent to pixel models was actually a byproduct of poor input representation. Structured rendering paves the way for more efficient, compact, and capable open-vocabulary language models.
Summary updated