Views
No views yet

You are currently viewing thelille-130m-basemodel card.View the instruction-tuned model here: Nikity/lille-130m-instruct
Lille-130M-Base: The foundational model pretrained on 4.27 billion of tokens from the FineWeb-Edu dataset. A post-processing step to only include the highest quality of content was added. It has strong general knowledge and text completion abilities.Lille-130M-Instruct: The instruction-tuned version, fine-tuned on the Kyoto-Corpus. It excels at following user commands, engaging in chat, and performing a variety of instruction-based tasks.130M for simplicity, the actual parameter count is 127.17 million.Lille-130M-Instruct
Evaluations for other LLMs are sourced from the Open LLM Leaderboard or their respective model cards when benchmark data is unavailable. For Lille 140M Instruct, evaluations are performed using simple-eval. ARC-C and ARC-E for Smollm2 are also evaluated using simple-eval.
simpleai-sdk, which handles all the boilerplate for you and provides a simple, high-level API for both Hugging Face and ONNX backends.pip install simpleai-sdk1from simple_ai import lille
2
3# This will download and cache the model on first run.
4# Specify the model version: "130m-instruct" (default) or "130m-base"
5# Specify the backend: "huggingface" (default) or "onnx"
6model = lille("huggingface", "130m-instruct")
7
8# --- For Chat (with instruct model) ---
9print("--- Chat Example ---")
10response1 = model.chat("What is the capital of France?", max_new_tokens=50)
11print(f"Bot: {response1}")
12
13response2 = model.chat("And what is its population?", max_new_tokens=50, top_p=0.90)
14print(f"Bot: {response2}")
15
16# This resets the chat history
17model.reset_chat()
18
19# --- For Text Completion (with base or instruct model) ---
20prompt = "Artificial Intelligence is"
21response = model.generate(prompt, max_new_tokens=50, temperature=0.9)
22print(f"\n--- Completion Example ---\n{prompt}{response}")simpleai-sdk currently)transformers library for more advanced use cases.pip install transformers torch simpleai-sdk1import torch
2from transformers import AutoTokenizer, AutoConfig, AutoModelForCausalLM
3from simple_ai.model_hf import LilleConfig, LilleForCausalLM
4
5# 1. Register the custom model architecture with Hugging Face
6AutoConfig.register("lille-130m", LilleConfig)
7AutoModelForCausalLM.register(LilleConfig, LilleForCausalLM)
8
9# 2. Define constants and setup device
10MODEL = "Nikity/lille-130m-instruct"
11DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
12
13# 3. Load tokenizer and model
14tokenizer = AutoTokenizer.from_pretrained(MODEL)
15model = AutoModelForCausalLM.from_pretrained(
16 MODEL,
17 torch_dtype="auto",
18 device_map=DEVICE,
19)
20
21# 4. Prepare chat prompt and tokenize it
22chat = [{"role": "user", "content": "What is the capital of France?"}]
23inputs = tokenizer.apply_chat_template(
24 chat,
25 add_generation_prompt=True,
26 return_tensors="pt"
27).to(DEVICE)
28
29# 5. Generate a response
30with torch.inference_mode():
31 outputs = model.generate(
32 input_ids=inputs,
33 max_new_tokens=512,
34 eos_token_id=tokenizer.eos_token_id,
35 pad_token_id=tokenizer.pad_token_id,
36 do_sample=True,
37 temperature=0.5,
38 top_p=0.95,
39 )
40
41# 6. Decode and print the response
42response = tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True)
43print(response)Lille-130M-Base or fine-tune it on your own dataset using the provided scripts.1git clone https://github.com/Nikityyy/lille
2cd lille
3pip install -r requirements.txtSophia-Triton optimizer requires the Triton library. Triton is officially supported on Linux with NVIDIA GPUs. While experimental installation on Windows is possible, it can be a complex and difficult process. For a much simpler setup on Windows and macOS, or if you prefer not to install Triton, it is highly recommended to use a pure PyTorch implementation of Sophia instead:sophia_triton.py file with the code from this link.train.py script should work without any import changes, as the class name SophiaG is the same..npz format containing tokenized documents and their offsets.prepare_dataset_fineweb.py script. It will stream the dataset from Hugging Face, apply filters, tokenize the text, and save it in the required format.python prepare_dataset_fineweb.pydata/fineweb_edu_sample_10BT/train.npz and val.npz.prepare_dataset.py script. Your input data should be a single .txt file where each example is separated by the <|endoftext|> token.data/my_dataset/train.txt.input_file_path and output_dir variables in prepare_dataset.py.python prepare_dataset.pytrain.npz and val.npz in your specified output directory.train.py. You can configure hyperparameters directly at the top of this file.train.py, set finetune = False.data_dir, batch_size, etc.python train.pytrain.py, set finetune = True.resume_checkpoint to the path of the pretrained model checkpoint (e.g., checkpoints/best_model.pt).finetune_data_dir and finetune_learning_rate.python train.pyout_dir (for pretraining) or finetune_out_dir (for fine-tuning). The best model based on validation loss will be saved as best_model.pt.Lille-130M-Base)sample-10BT configuration of the HuggingFaceFW/fineweb-edu dataset.Lille-130M-Instruct)1@misc{lille-130m,
2 author = {Nikita Berger},
3 title = {Lille: A Truly Open-Source 130M Language Model},
4 year = {2025},
5 publisher = {GitHub},
6 journal = {GitHub repository},
7 howpublished = {\url{https://github.com/Nikityyy/lille}}
8}