NeuML / bert-hash-nano

huggingface.co
Total runs: 107
24-hour runs: 0
7-day runs: 28
30-day runs: 28
Model's Last Updated: June 16 2026

Introduction of bert-hash-nano

Model Details of bert-hash-nano

BERT Hash Nano Models

This is a set of 3 Nano BERT models with a modified embeddings layer. The embeddings layer is the same BERT vocabulary (30,522 tokens) projected to a smaller dimensional space then re-encoded to the hidden size. This method is inspired by MUVERA: Multi-Vector Retrieval via Fixed Dimensional Encodings .

The number of projections is like a hash. Setting the projections parameter to 5 is like generating a 160-bit hash (5 x float32) for each token. That hash is then projected to the hidden size.

This significantly reduces the number of parameters necessary for token embeddings.

For example:

Standard token embeddings:

  • 30,522 (vocab size) x 768 (hidden size) = 23,440,896 parameters
  • 23,440,896 x 4 (float32) = 93,763,584 bytes

Hash token embeddings:

  • 30,522 (vocab size) x 5 (hash buckets) + 5 x 768 (projection matrix)= 156,450 parameters
  • 156,450 x 4 (float32) = 625,800 bytes

These models are pre-trained on the same training corpus as BERT (with a copy of Wikipedia from 2025) as recommended in the paper Well-Read Students Learn Better: On the Importance of Pre-training Compact Models .

Here is a subset of GLUE scores on the dev set using the script provided by Hugging Face Transformers with the following parameters.

python run_glue.py --model_name_or_path <model path> --task_name <task name> --do_train --do_eval --max_seq_length 128 --per_device_train_batch_size 32 --learning_rate 1e-4 --num_train_epochs 4 --output_dir outputs --trust-remote-code True
Model Parameters MNLI (acc m/mm) MRPC (f1/acc) SST-2 (acc)
baseline (bert-tiny) 4.4M 0.7114 / 0.7161 0.8318 / 0.7353 0.8222
bert-hash-femto 0.243M 0.5697 / 0.5750 0.8122 / 0.6838 0.7821
bert-hash-pico 0.448M 0.6228 / 0.6363 0.8205 / 0.7083 0.7878
bert-hash-nano 0.969M 0.6565 / 0.6670 0.8172 / 0.7083 0.8131
Usage

These models can be loaded using Hugging Face Transformers as follows. Note that given that this is a custom architecture, trust_remote_code needs to be set.

from transformers import AutoModel

model = AutoModel.from_pretrained("neuml/bert-hash-nano", trust_remote_code=True)
Training

Training your own Nano model is simple. All you need is a Hugging Face dataset and the code below using txtai .

from datasets import concatenate_datasets, load_dataset
from transformers import AutoTokenizer

from txtai.pipeline import HFTrainer

from configuration_bert_hash import *
from modeling_bert_hash import *

dataset = load_dataset("path to target HF dataset")

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")

config = BertHashConfig(
       hidden_size=128,
       num_hidden_layers=2,
       num_attention_heads=2,
       intermediate_size=512,
       projections=16
)
model = BertHashForMaskedLM(config)

print(config)
print("Total parameters:", sum(p.numel() for p in model.bert.parameters()))

train = HFTrainer()

# Train using MLM
train((model, tokenizer), dataset, task="language-modeling", output_dir="model",
       fp16=True, learning_rate=1e-3, per_device_train_batch_size=64, num_train_epochs=3,
       warmup_steps=2500, weight_decay=0.01, adam_epsilon=1e-6,
       tokenizers=True, dataloader_num_workers=20,
       save_strategy="steps", save_steps=5000, logging_steps=500,
)
Future Work

This model demonstrates that smaller models can still be productive models.

The hope is that this work opens the door to many in building small encoder models that pack a punch. Models can be trained in a matter of hours using consumer GPUs.

Imagine more specialized models like this for medical, legal, science and more.

Runs of NeuML bert-hash-nano on huggingface.co

107
Total runs
0
24-hour runs
3
3-day runs
28
7-day runs
28
30-day runs

More Information About bert-hash-nano huggingface.co Model

More bert-hash-nano license Visit here:

https://choosealicense.com/licenses/apache-2.0

bert-hash-nano huggingface.co

bert-hash-nano huggingface.co is an AI model on huggingface.co that provides bert-hash-nano's model effect (), which can be used instantly with this NeuML bert-hash-nano model. huggingface.co supports a free trial of the bert-hash-nano model, and also provides paid use of the bert-hash-nano. Support call bert-hash-nano model through api, including Node.js, Python, http.

bert-hash-nano huggingface.co Url

https://huggingface.co/NeuML/bert-hash-nano

NeuML bert-hash-nano online free

bert-hash-nano huggingface.co is an online trial and call api platform, which integrates bert-hash-nano's modeling effects, including api services, and provides a free online trial of bert-hash-nano, you can try bert-hash-nano online for free by clicking the link below.

NeuML bert-hash-nano online free url in huggingface.co:

https://huggingface.co/NeuML/bert-hash-nano

bert-hash-nano install

bert-hash-nano is an open source model from GitHub that offers a free installation service, and any user can find bert-hash-nano on GitHub to install. At the same time, huggingface.co provides the effect of bert-hash-nano install, users can directly use bert-hash-nano installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

bert-hash-nano install url in huggingface.co:

https://huggingface.co/NeuML/bert-hash-nano

Url of bert-hash-nano

bert-hash-nano huggingface.co Url

Provider of bert-hash-nano huggingface.co

NeuML
ORGANIZATIONS

Other API from NeuML

huggingface.co

Total runs: 1.9K
Run Growth: 1.6K
Growth Rate: 84.98%
Updated:January 27 2025
huggingface.co

Total runs: 1.1K
Run Growth: -170
Growth Rate: -16.18%
Updated:January 27 2025
huggingface.co

Total runs: 1.0K
Run Growth: 199
Growth Rate: 19.19%
Updated:February 21 2023
huggingface.co

Total runs: 853
Run Growth: 250
Growth Rate: 29.31%
Updated:February 21 2023
huggingface.co

Total runs: 521
Run Growth: -99.9K
Growth Rate: -19182.34%
Updated:January 27 2025
huggingface.co

Total runs: 285
Run Growth: 98
Growth Rate: 34.39%
Updated:January 27 2025
huggingface.co

Total runs: 186
Run Growth: 113
Growth Rate: 62.78%
Updated:April 21 2026
huggingface.co

Total runs: 31
Run Growth: 14
Growth Rate: 45.16%
Updated:October 10 2025
huggingface.co

Total runs: 15
Run Growth: -2
Growth Rate: -13.33%
Updated:November 23 2024
huggingface.co

Total runs: 8
Run Growth: -75
Growth Rate: -937.50%
Updated:April 13 2026
huggingface.co

Total runs: 8
Run Growth: 2
Growth Rate: 25.00%
Updated:July 21 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:November 11 2025