Downloads · 30 days
46
28% of all-time downloads
antalvdb/olifant-hf
olifant-hf is a text generation model from antalvdb. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
Olifant is a memory-based language model that uses TiMBL (Tilburg Memory-Based Learner) instead of neural networks. It stores training instances in an indexed instance base and uses k-nearest neighbors for prediction.
Downloads · 30 days
46
28% of all-time downloads
All-time downloads
162
Public
Repo size
152 MB
Likes
0
Public
Click a slice to open those files.
.ibase152 MB · 100%
From the Hugging Face model README
Olifant is a memory-based language model that uses TiMBL (Tilburg Memory-Based Learner) instead of neural networks. It stores training instances in an indexed instance base and uses k-nearest neighbors for prediction.
Note that this model is not a neural language model. Its instruction is a decision tree with nodes, not a neural network with layers of units and weighted connections between them. A memory-based models does not have parameters; it has nodes.
This model requires the Olifant package:
pip install olifant
Olifant also relies on the command-line version of TiMBL memory-based classification engine for training. Install TiMBL on Debian/Ubuntu systems with
apt install timbl
On Alpine Linux:
apk add timbl
On macOS with brew, invoke
brew install timbl
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load model (requires trust_remote_code for custom architecture)
model = AutoModelForCausalLM.from_pretrained(
"antalvdb/olifant-hf",
trust_remote_code=True
)
# Load tokenizer (uses GPT-2 tokenizer)
tokenizer = AutoTokenizer.from_pretrained("gpt2")
model.set_tokenizer(tokenizer)
# Generate text
input_ids = tokenizer.encode("The quick brown", return_tensors="pt")
output_ids = model.generate(
input_ids,
max_length=20,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
print(tokenizer.decode(output_ids[0]))
Unlike neural language models that learn distributed representations, Olifant:
This approach provides full transparency: you can inspect exactly which training examples influenced each prediction.
If you use this model, please cite:
@misc{bosch2025memorybasedlanguagemodelsefficient,
title={Memory-based Language Models: An Efficient, Explainable, and Eco-friendly Approach to Large Language Modeling},
author={Antal van den Bosch and Ainhoa Risco Patón and Teun Buijse and Peter Berck and Maarten van Gompel},
year={2025},
eprint={2510.22317},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2510.22317},
}
GPL3.0 License