HashFormers: Towards Vocabulary-independent Pre-trained Transformers
Not on the map. Why?
Abstract (arXiv)
Transformer-based pre-trained language models are vocabulary-dependent, mapping by default each token to its corresponding embedding. This one-to-one mapping results into embedding matrices that occupy a lot of memory (i.e. millions of parameters) and grow linearly with the size of the vocabulary. Previous work on on-device transformers dynamically generate token embeddings on-the-fly without embedding matrices using locality-sensitive hashing over morphological information. These embeddings are subsequently fed into transformer layers for text classification. However, these methods are not pre-trained. Inspired by this line of work, we propose HashFormers, a new family of vocabulary-independent pre-trained transformers that support an unlimited vocabulary (i.e. all possible tokens in a corpus) given a substantially smaller fixed-sized embedding matrix. We achieve this by first introducing computationally cheap hashing functions that bucket together individual tokens to embeddings. We also propose three variants that do not require an embedding matrix at all, further reducing the memory requirements. We empirically demonstrate that HashFormers are more memory efficient compared to standard pre-trained transformers while achieving comparable predictive performance when fine-tuned on multiple text classification tasks. For example, our most efficient HashFormer variant has a negligible performance degradation (0.4% on GLUE) using only 99.1K parameters for representing the embeddings compared to 12.3-38M parameters of state-of-the-art models.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 28 of its 39 references that are in the map. First posted on arXiv 14 Oct 2022.
Builds on
28 of 39 references.
References · 28
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,899
- 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,918
- 2019XLNet: Generalized Autoregressive Pretraining for Language Understandingcited by 2,811
- 2018SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processingcited by 1,989
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
- 2020Reformer: The Efficient Transformercited by 1,668
- 2016Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translationcited by 1,475
- 2019Energy and Policy Considerations for Deep Learning in NLPcited by 1,254
- 2015Aligning Books and Movies: Towards Story-like Visual Explanations by Watching Movies and Reading Bookscited by 1,043
16 more
- 2019Green AIcited by 627
- 2021Datasets: A Community Library for Natural Language Processingcited by 530
- 2021ByT5: Towards a token-free future with pre-trained byte-to-byte modelscited by 509
- 2021CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language Representationcited by 232
- 2019Combating Adversarial Misspellings with Robust Word Recognitioncited by 163
- 2021Charformer: Fast Character Transformers via Gradient-based Subword Tokenizationcited by 160
- 2020Rethinking embedding coupling in pre-trained language modelscited by 103
- 2020Compressing Large-Scale Transformer-Based Models: A Case Study on BERTcited by 96
- 2020CharacterBERT: Reconciling ELMo and BERT for Word-Level Open-Vocabulary Representations From Characterscited by 87
- 2020Adv-BERT: BERT is not robust on misspellings! Generating nature adversarial samples on BERTcited by 69
- 2017Hash Embeddings for Efficient Word Representationscited by 55
- 2017Compressing Word Embeddings via Deep Compositional Code Learningcited by 35
- 2021Frustratingly Simple Pretraining Alternatives to Masked Language Modelingcited by 17
- 2022How does the pre-training objective affect what large language models learn about linguistic properties?cited by 16
- 2020ProFormer: Towards On-Device LSH Projection Based Transformerscited by 9
- 2020Compressing Transformer-Based Semantic Parsing Models using Compositional Code Embeddingscited by 4
Built on by
Citing papers per year: 2023: 3; 2024: 1; 2025: 1; 2026: 1.
6 papers.
- 2024T-FREE: Subword Tokenizer-Free Generative LLMs via Sparse Representations for Memory-Efficient Embeddingscited by 10
- 2023Vocabulary-level Memory Efficiency for Language Model Fine-tuningcited by 2
- 2023Understanding the Role of Input Token Characters in Language Models: How Does Information Loss Affect Performance?cited by 2
- 2025Deconstructing Attention: Investigating Design Principles for Effective Language Modelingcited by 2
- 2023Pit One Against Many: Leveraging Attention-head Embeddings for Parameter-efficient Multi-head Attentioncited by 1
- 2026MultiHashFormer: Hash-based Generative Language Modelscited by 1
- 2026MultiHashFormer: Hash-based Generative Language Models26 Jun 2026
- 2025Deconstructing Attention: Investigating Design Principles for Effective Language Modeling13 Oct 2025
- 2024T-FREE: Subword Tokenizer-Free Generative LLMs via Sparse Representations for Memory-Efficient Embeddings27 Jun 2024
- 2023Understanding the Role of Input Token Characters in Language Models: How Does Information Loss Affect Performance?26 Oct 2023
- 2023Pit One Against Many: Leveraging Attention-head Embeddings for Parameter-efficient Multi-head Attention11 Oct 2023
- 2023Vocabulary-level Memory Efficiency for Language Model Fine-tuning15 Sep 2023