QuantOsimo Curriculum Embeddings v1
A sentence-embedding model fine-tuned from
sentence-transformers/all-MiniLM-L6-v2.
It was trained on text from UK curriculum specifications (AQA, Pearson
Edexcel and OCR, KS2 to KS5, Maths and Science).
- Output: 384-dimensional, L2-normalised, mean pooled. Fits
pgvector(384). - Max sequence length: 256 tokens.
- Size: about 22.7M parameters.
Status in QuantOsimo
Deployed in production through the int8 ONNX export in onnx/, which
runs on onnxruntime without PyTorch. If the model fails to load, or a query
returns no chunks, QuantOsimo falls back to json-hash-384, a hashed
bag-of-words embedding.
The model is deployed because it costs little to serve. It does not retrieve better: see the retrieval comparison below.
Training
| Base model | sentence-transformers/all-MiniLM-L6-v2 |
| Data | 1,077 triplets (anchor, positive, negative) built from 1,714 specification chunks |
| Split | 970 train / 107 evaluation (shuffled, seed 42) |
| Loss | MultipleNegativesRankingLoss |
| Epochs / batch size / learning rate | 3 / 4 / 5e-5 |
Evaluation
Triplet accuracy (the training task)
Measured with Sentence Transformers TripletEvaluator on the 107 evaluation
triplets. A triplet is correct when the anchor is closer to its positive than
to its negative.
| Cosine accuracy | |
|---|---|
Base all-MiniLM-L6-v2 |
0.93 (0.9252) |
| Fine-tuned | 0.99 (0.9907) |
The evaluation triplets come from the same source documents and are built the same way as the training triplets. So this figure shows the model learned the training task. It is not a measure of retrieval quality on real queries.
Retrieval comparison (15 November 2026)
This test ran 24 maths queries through QuantOsimo's retrieval and took the top 3 chunks. Results were scored against curriculum knowledge-graph concept links.
| P@3 | hit@1 | MRR | Empty results | |
|---|---|---|---|---|
Production pipeline, json-hash-384 |
0.236 | 0.208 | 0.312 | 1/24 |
| Production pipeline, this model | 0.264 | 0.250 | 0.326 | 2/24 |
Raw cosine, json-hash-384 |
0.264 | 0.250 | 0.319 | 0/24 |
| Raw cosine, this model | 0.250 | 0.250 | 0.361 | 0/24 |
The fine-tuned model was not clearly better or worse than the hash embedding. The differences are within about one query out of 24. Do not read this model as giving better retrieval.
ONNX export (onnx/)
| File | Contents |
|---|---|
onnx/model_int8_a.onnx |
The fine-tuned encoder, int8 |
onnx/tokenizer.json |
Tokenizer (tokenizers library) |
onnx/embedding_config.json |
Pooling, normalisation, inputs, dimension |
- Quantisation:
onnxruntimedynamic quantisation, int8 (QInt8) weights, per-channel. Opset 17. - Graph output:
last_hidden_state. Apply mean pooling overattention_mask, then L2 normalisation, as set out inembedding_config.json. - Parity with the original PyTorch model: cosine similarity between ONNX and original embeddings of the same texts is 0.992 on average, 0.980 at minimum.
- Batch effects: int8 results can differ very slightly with batch composition. When you compare two systems, embed the shared texts once.
import numpy as np, onnxruntime as ort
from tokenizers import Tokenizer
tok = Tokenizer.from_file("onnx/tokenizer.json")
tok.enable_truncation(256); tok.enable_padding()
sess = ort.InferenceSession("onnx/model_int8_a.onnx")
enc = tok.encode_batch(["Solve quadratic equations by factorising"])
ids = np.array([e.ids for e in enc], dtype=np.int64)
mask = np.array([e.attention_mask for e in enc], dtype=np.int64)
out = sess.run(None, {"input_ids": ids, "attention_mask": mask,
"token_type_ids": np.zeros_like(ids)})[0]
vec = (out * mask[..., None]).sum(1) / mask.sum(1, keepdims=True)
vec /= np.linalg.norm(vec, axis=1, keepdims=True) # shape (1, 384)
Usage (Sentence Transformers)
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Osam-2025/quantosimo-curriculum-embeddings-v1")
emb = model.encode(["Use the laws of indices", "Differentiate x^n"])
print(emb.shape) # (2, 384)
Limitations
- Training text. The triplets come from specification documents. Many chunks are boilerplate (administration, copyright, front matter), and some of that text is in the training data.
- Triplet accuracy is in distribution and says little about retrieval on student or tutor queries.
- Small retrieval test. It used 24 maths queries. Science retrieval was not scored.
- UK specifications only, in English.
Citation
@misc{osagiede2026quantosimoembeddings,
author = {Osagiede, Samuel},
title = {QuantOsimo Curriculum Embeddings v1},
year = {2026},
url = {https://huggingface.co/Osam-2025/quantosimo-curriculum-embeddings-v1}
}