Instructions to use Eureka-COM/MistralMosaic-24B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Eureka-COM/MistralMosaic-24B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Eureka-COM/MistralMosaic-24B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Eureka-COM/MistralMosaic-24B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Eureka-COM/MistralMosaic-24B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Eureka-COM/MistralMosaic-24B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Eureka-COM/MistralMosaic-24B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Eureka-COM/MistralMosaic-24B
- SGLang
How to use Eureka-COM/MistralMosaic-24B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Eureka-COM/MistralMosaic-24B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Eureka-COM/MistralMosaic-24B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Eureka-COM/MistralMosaic-24B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Eureka-COM/MistralMosaic-24B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Eureka-COM/MistralMosaic-24B with Docker Model Runner:
docker model run hf.co/Eureka-COM/MistralMosaic-24B
MistralMosaic-24B
A research base model: Mistral-Small-24B-Base-2501 with the attention of all 40 layers replaced by the memories of Meta's official Two-stage Memory Mosaics+. It was distilled from the original model (the teacher) on 99,991,552 tokens. It is not instruction-tuned.
What was replaced
Each attention block became the three memories of Two-stage Memory Mosaics+. The FFNs, embeddings and norms are Mistral's, unchanged.
| Memory | Reads | What it is |
|---|---|---|
| short | the last 256 tokens | windowed attention; Mistral's attention weights copied and kept frozen |
| long | the current document, except the last 64 tokens | Mosaics associative memory (trained) |
| cluster | earlier documents in the same input | Mosaics associative memory (trained) |
Two-stage Memory Mosaics+ is from Zhang & Bottou, "Open-world AI: a tale of three requirements" (arXiv:2610.20782); the official code is facebookresearch/MemoryMosaics. This repository ships that code unmodified (commit c2ca0e8) in MemoryMosaics/ and checks its SHA-256 before importing it.
Two differences from the official design: the short memory is a frozen copy of Mistral's 32 heads (the official model trains it; long and cluster memory use 40 heads with the official head size of 128), and its RoPE base is Mistral's (10⁸) instead of one scaled to the window, so that the copied weights and the positions match.
Results
Measured once, on data not used in training. Values are loss ratios to the teacher (1.00 = same loss as Mistral-Small-24B-Base-2501); brackets are 95% intervals from resampling documents.
| Data | Ratio |
|---|---|
| Held-out clusters of the training corpus (16,384-token rows, 64 rows) | 1.023 (1.019–1.028) |
| … documents after the first one in each row | 1.021 (1.017–1.025) |
| Japanese Wikipedia (2,048 tokens, 128 articles) | 1.083 (1.078–1.089) |
| English Wikipedia (2,048 tokens, 128 articles) | 1.134 (1.123–1.147) |
| English fineweb-edu (1,024 tokens, 128 documents) | 1.062 (1.057–1.069) |
| English Cosmopedia (1,024 tokens, 128 documents) | 1.028 (1.024–1.032) |
In long single documents (Wikipedia, 16,384 tokens, 24 each) the gap to the teacher grows with distance from the start:
| Position of the predicted token | English | Japanese |
|---|---|---|
| 1–256 (inside the short window) | 1.045 | 1.008 |
| 257–2,048 | 1.121 | 1.083 |
| 2,049–8,192 | 1.148 | 1.141 |
| 8,193–16,383 | 1.146 | 1.171 |
| Task (same items for both) | Mistral-Small-24B-Base | MistralMosaic-24B |
|---|---|---|
| Recall a name's 5-digit value 512–14,000 tokens later (192 items) | 100.0% | 97.9% |
| … with 2 distractor values (192 items) | 100.0% | 19.3% |
| JCommonsenseQA (1,119 items, 3-shot) | 94.7% | 94.1% |
| MMLU (1,000 items, 5-shot) | 80.7% | 76.1% |
| Teacher's loss per token on sampled continuations (temperature 0.7, 48 prompts) | 0.866 | 0.930 |
Multiple-choice items are scored by the likelihood of the answer letter, so the numbers are not comparable with public leaderboards. No generated continuation was broken (empty, or one token repeated 16+ times). The values measured during training (last evaluation of the main run) were 1.028 on held-out clusters, 1.154 on English Wikipedia and 1.055 on Japanese Wikipedia; they use fewer rows, so the tables above are the reference.
Observed properties (tests after release)
We checked whether the properties that the paper (arXiv:2610.20782) describes for Two-stage Memory Mosaics+ also appear in this distilled model, comparing it with the original model. On the 40 held-out clusters, we put documents from the same cluster in front of a target document (512 tokens) and measured the loss on the target document (per token, lower is better). No training was done.
| Related documents in front | MistralMosaic-24B | Mistral-Small-24B-Base |
|---|---|---|
| 16,384 tokens | 1.331 | 1.326 |
| 65,536 tokens | 1.326 | 1.441 |
131,072 tokens were measured on 20 other held-out clusters.
| Related documents in front | This model | Original model |
|---|---|---|
| 16,384 tokens | 1.476 | 1.462 |
| 65,536 tokens | 1.473 | 1.607 |
| 131,072 tokens | 1.472 | 1.985 |
Up to 131,072 tokens, this model behaved as the paper describes.
- It kept improving beyond its training length. It was trained on 16,384-token rows only, yet the loss kept falling as related documents were added, up to 131,072 tokens, eight times the training length (-0.0051 from 16,384 to 65,536; on the 20 clusters, -0.0044 from 16,384 to 131,072).
- The original model broke down; this model did not. Beyond its 32k context, the original model's loss rose by 0.116 at 65,536 tokens and by 0.523 at 131,072 tokens, compared with 16,384. At 131,072 tokens this model's loss is 0.741 times the original's.
- When the document boundaries are not passed and everything is read as one document, the loss at 65,536 tokens is 0.070 higher, and adding documents makes it slightly worse. This model relies on reading the current document and earlier documents separately.
- With 65,536 tokens of unrelated documents in front, the loss was 1.358, higher than with related documents (1.326).
- We compared only with the original model (32k context), not with a Transformer adapted to long contexts. Reading without boundaries is a use this model was not trained for.
- The properties to check were chosen from the paper. This does not reproduce the paper's numbers.
- The test plans and decision thresholds were fixed and recorded before measuring. In the 131,072-token test, this model and the original were measured on separate GPUs.
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
name = "Eureka-COM/MistralMosaic-24B"
tok = AutoTokenizer.from_pretrained(name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(name, trust_remote_code=True, dtype=torch.bfloat16, device_map="cuda")
ids = tok("The capital of Japan is", return_tensors="pt").input_ids.to(model.device)
out = model.generate(ids, max_new_tokens=32, do_sample=False)
print(tok.decode(out[0]))
To put several documents in one input, pass their lengths: model(input_ids=ids, doc_lengths=[[n1, n2, ...]]). The cluster memory only works when there are earlier documents. Requirements: PyTorch with FlexAttention, transformers 5.x (built with 5.22.2), accelerate (for device_map), a GPU; the bf16 weights are about 62.3 GB. The model was trained with Mistral's tokenizer at its default settings: transformers warns about the tokenizer's regex when loading, but do not pass fix_mistral_regex, or tokenization will differ from training.
Limitations
- No KV cache: every generated token re-reads the whole input, so generation is slow. The official code has a cache; it is not wired into this model yet.
- Right padding only (
tokenizer.padding_side = "right"). - Weaker than the teacher at using the part of a long document more than 256 tokens back (table above). The training rows were mostly short documents (median 658 tokens for Cosmopedia in the held-out clusters); this may be the cause, but it has not been tested.
- With distractors, recall of distant values mostly fails.
- MMLU is 4.6 points below the teacher.
- Trained on inputs up to 16,384 tokens; accepted up to 32,768 by default. Longer inputs were tested up to 131,072 tokens in the tests above, after setting
config.mosaics["max_seq_len"]above the input length before loading. - No instruction tuning or safety tuning; the base model's limitations apply.
Checks before release
- The written weights equal the training checkpoint, tensor by tensor (1,043 tensors).
- On CPU, the loading code reproduces the evaluated computation: max log-probability difference 0.0000, top-1 agreement 100.0%.
- On a GPU (NVIDIA H200 NVL), loaded from this repository with
from_pretrainedand compared with the evaluation records: recall outcomes identical for 192/192 questions, greedy continuations identical for 8/8 prompts. - The JCommonsenseQA check failed. The chosen answers matched for 200/200 questions, but the maximum difference in option log-probabilities was 0.1842, above the threshold fixed in advance (≤ 0.1). The threshold was not changed.
- To find the cause, the same 200 questions were run three ways on one other GPU (NVIDIA H200) and the option log-probabilities compared. Maximum differences:
- this repository's code and weights vs. the evaluation code: 0.0000
- the evaluation code, first run vs. second run: 0.0000
- the evaluation code vs. the values recorded during evaluation: 0.1848
- We read this as: the failed difference comes from running on a different GPU machine, not from the computation of this repository's code and weights. Log-probabilities can differ in the first decimal place across machines.
Training
- Teacher: Mistral-Small-24B-Base-2501, unchanged.
- Data: Cosmopedia (English, 70% of tokens) and fineweb-2-edu-japanese (Japanese, 30%), split into 400 clusters with nomic-embed-text-v2-moe (360 for training, 40 held out). Each row packs documents of one cluster up to 16,384 tokens.
- Stage 1: each layer matched to the teacher's layer output (61 steps, ~1M tokens, lr 1e-4).
- Stage 2: the whole student matched to the teacher (KL + 0.1 × cross-entropy, 6,042 steps, lr 1e-5, decayed over the last 15%).
- Trained parameters: long and cluster memories and the norm before them (6.3B). FFN, embeddings and short memory frozen.
- One 16,384-token row per step, 8-bit AdamW, one H200.
License and sources
- This repository: Apache-2.0 (
LICENSE,NOTICE). - Base weights: mistralai/Mistral-Small-24B-Base-2501 (Apache-2.0); attention replaced and weights added.
- Official code: facebookresearch/MemoryMosaics (Apache-2.0), unmodified in
MemoryMosaics/. - Training data: Cosmopedia (Apache-2.0), fineweb-2-edu-japanese (ODC-By 1.0, subject to the Common Crawl terms of use); clustering: nomic-embed-text-v2-moe (Apache-2.0).
- Evaluation data (not included): JCommonsenseQA (CC BY-SA 4.0), MMLU (MIT), Wikipedia (CC BY-SA 3.0), fineweb-edu (ODC-By).
- Papers:
- Zhang, Bottou. Open-world AI: a tale of three requirements. arXiv:2610.20782, 2026.
- Zhang, Bottou. Memory Mosaics at scale. NeurIPS 2025 (arXiv:2507.03285).
- Zhang, Nolte, Sadhukhan, Chen, Bottou. Memory Mosaics. ICLR 2025 (arXiv:2405.06394).
Where the numbers come from
Every number here was copied by a script from the measured result files, not by hand; evidence.json lists each value and its file. The commit of the official code is in MemoryMosaics.COMMIT.
- Downloads last month
- -
Model tree for Eureka-COM/MistralMosaic-24B
Base model
mistralai/Mistral-Small-24B-Base-2501