Abstract
Pixel-based language models offer a promising alternative to traditional sub-word tokenization by processing text as images via Vision Transformers (ViT). However, standard continuous rendering methods introduce significant redundancy, as arbitrary slicing of text strings leads to a "representation explosion" of unique but semantically identical image patches. This paper investigates structured rendering strategies, demonstrating that a simple character-bigram approach allows for a 4x reduction in model parameters (from 86M to 22M) without sacrificing performance on semantic benchmarks. Our findings suggest that imposing visual structure on input patches enhances data efficiency and multilingual robustness.
Introduction
Modern Large Language Models (LLMs) typically rely on tokenization to convert text into discrete numerical units. While effective, tokenization is often brittle, struggling with rare vocabulary, typos, and the vast diversity of global scripts. Pixel-based models, such as PIXEL, circumvent these issues by rendering text into a sequence of images. Despite their flexibility, these models face a major efficiency hurdle: the "continuous" rendering baseline slices text at fixed pixel intervals, meaning a single word can appear in millions of different visual configurations depending on its horizontal alignment. This redundancy forces the model to learn the same linguistic features repeatedly across different visual contexts.
Methodology: Structuring the Visual Input
To address the inefficiency of continuous rendering, we evaluated four distinct strategies for mapping text into $16 \times 16$ pixel patches:
- Continuous (Baseline): Text is rendered as a single long string and sliced every 16 pixels, regardless of character boundaries.
- Words: Each new word is forced to start at the beginning of a new patch.
- Mono: Text is rendered using a monospaced font to ensure predictable character alignment.
- Bigrams: Exactly two characters are rendered per patch, padded with whitespace where necessary.
Among these, the BIGRAMS strategy emerged as a primary focus. By creating a consistent "visual vocabulary," it provides enough structure to be efficient while remaining general enough to handle diverse languages without the need for complex, language-specific word segmenters.
To test the limits of these strategies, we introduced two compact architectures: SMALL (22M parameters) and TINY (5.5M parameters), comparing them against the standard BASE (86M parameters) model.
Experimental Setup
Models were pretrained on a combined corpus of English Wikipedia and BookCorpus (~16.8M examples). Evaluation spanned several critical dimensions of language understanding:
- Semantics: The GLUE benchmark for general English language understanding.
- Syntax: Universal Dependencies Parsing (UDP) across nine diverse languages to assess grammatical grasp.
- Multilingualism: TyDiQA-GoldP (question answering) and MasakhaNER (named entity recognition for 10 African languages).
Key Insights and Discussion
Compression and Parameter Efficiency
One of the most striking findings is that visual structure can compensate for model size. A 22M parameter SMALL-BIGRAMS model achieved performance parity with the original 86M parameter PIXEL model on GLUE tasks. For the SMALL architecture specifically, switching from continuous to bigram rendering yielded a +4.4 point jump in average GLUE performance. This suggests that by reducing the number of unique inputs the model must process, we allow the parameters to learn more effective, generalized representations.
The Geometry of Pixel Embeddings
Structured pixel models exhibit an "anisotropic" embedding space, a phenomenon also observed in BERT. High-frequency patches (common bigrams) tend to move further from their random initialization during training, becoming more contextualized and semantically rich compared to rare patches. This frequency bias indicates that the model is successfully organizing its visual input into a hierarchy of meaning.
Syntax vs. Semantics
Our results highlight a trade-off between different rendering styles. While the "Words" strategy proved slightly superior for syntax-heavy tasks like grammatical parsing (UDP), the "Bigrams" strategy was more effective for capturing the broader meaning of sentences (GLUE). This suggests that the optimal rendering strategy may depend on the specific downstream application.
Multilingual Robustness
Contrary to the concern that structured rendering might limit a model's flexibility, the BIGRAMS strategy improved performance on non-English tasks. The BASE-BIGRAMS model outperformed the original PIXEL by 3.6 points on the MasakhaNER benchmark. This confirms that a structured visual approach can handle diverse scripts—including those from African languages—more effectively than unstructured slicing.
Conclusion
By rethinking how text is rendered for pixel-based models, we can significantly reduce model size and training redundancy. The BIGRAMS strategy offers a powerful balance between the flexibility of pixel-based learning and the efficiency of structured inputs. Future research will explore morphological rendering—aligning patches with units of meaning—and the potential for these models to serve as a bridge in unified architectures that process speech, images, and text through a single visual lens.
Summary updated