AntonDergunov's picture
Interim F1@all-large-all3k encoder (fp16 ONNX) and bundle
26d99dc verified
|
Raw History Blame Contribute Delete
4.17 kB
---
license: mit
base_model: intfloat/multilingual-e5-large
language: [en, es, ru, de, fr, pt, it, zh, ja, pl]
library_name: onnx
pipeline_tag: sentence-similarity
tags: [onnx, sentence-embeddings, retrieval, material-symbols, icons, todo]
---
# Task icon encoder, e5-large (interim)
> **Interim checkpoint (2026-11-22), not final.** Research is ongoing, and this file may be replaced by a better model. Pin a revision if you depend on it.
This encoder picks a [Material Symbols](https://fonts.google.com/icons) icon for a to-do task by meaning. For example, "Health: Book a dentist appointment" gets `dentistry`. It is `intfloat/multilingual-e5-large`, fine-tuned as a dual encoder and exported to ONNX (fp16 weights, fp32 inputs and output). It runs the agenda icons of [agentic-org-planner](https://github.com/anton-dergunov/agentic-org-planner).
## Files
| file | what |
|---|---|
| `model_fp16.onnx` | the transformer: `input_ids`, `attention_mask` (int64, `[batch, seq]`) → `last_hidden_state` (float32, `[batch, seq, 1024]`) |
| `tokenizer.json` | XLM-R SentencePiece tokenizer (Hugging Face `tokenizers`), padding and truncation off |
| `bundle/names.txt` | 2,862 icon names; row *i* of the matrix is icon *i* |
| `bundle/dense.npy` | icon vectors, fp16 `[2862, 1024]`, L2-normalized, precomputed from text descriptions of each icon |
| `bundle/manifest.json` | how to build the query and the confidence threshold |
## Use
```python
import numpy as np, onnxruntime as ort
from tokenizers import Tokenizer
tok = Tokenizer.from_file("tokenizer.json"); tok.enable_truncation(64)
opts = ort.SessionOptions()
opts.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_BASIC
sess = ort.InferenceSession("model_fp16.onnx", opts, providers=["CPUExecutionProvider"])
names = open("bundle/names.txt").read().split()
icons = np.load("bundle/dense.npy").astype(np.float32)
def encode(text): # one text per call, no padding
ids = np.array([tok.encode("query: " + text).ids])
h = sess.run(None, {"input_ids": ids, "attention_mask": np.ones_like(ids)})[0][0].mean(0)
return h / np.linalg.norm(h)
scores = icons @ encode("Health: Book a dentist appointment")
print(names[int(scores.argmax())]) # dentistry
```
- **Query:** `query: ` + the task title as plain text, optionally prefixed with its nearest parent heading (`"<parent>: <title>"`).
- **Pooling:** mean over tokens, then L2 normalization.
- **Confidence:** `z = (max − mean) / std` of the scores over all icons. The manifest's `fusion.threshold` is a deliberately low cut, which hides an icon only when almost nothing fits.
- **Basic graph optimizations:** onnxruntime 1.27's layer-norm fusion cannot load this fp16 graph.
## Training
- **Task pool:** about 11.9k to-do tasks:
- synthetic tasks in the style of a personal task list, written by an LLM;
- tasks from [MS-LaTTE](https://github.com/microsoft/MS-LaTTE) (MIT);
- Spanish and Russian translations of both.
- **Grades:** an LLM judge (Gemini) graded which icons fit each task (3 / 2 / 1).
- **Loss:** a graded multi-positive InfoNCE.
- **More training data:** graded register rewrites of the tasks, and the example tasks written into each icon's description.
- **Icon side:** a text description of each glyph, written by an LLM from the rendered glyph, without using the icon's name.
## Evaluation
The evaluation is on held-out dev tasks graded by the same LLM judge ("silver" labels, not human labels), with the title plus parent heading as the query:
- nDCG@5 0.567, hit@1 0.714;
- the untuned e5-small baseline with BM25 fusion scores 0.336 / 0.437.
On the same tasks machine-translated into German, French, Portuguese, Italian, Chinese, Japanese and Polish, nDCG@5 is 0.568–0.594, against 0.597 on the original text.
## Limitations
- The labels come from an LLM judge, and human labels are still being collected.
- The icon set is the Material Symbols names in `bundle/names.txt`, minus glyphs rejected in a manual review.
- It is an interim research checkpoint.
The icons are Material Symbols by Google (Apache 2.0). The base model is multilingual-e5-large by intfloat (MIT).