Ariadne 1.0
a compact model for semantic code vector search
2 min readupdated
The Ariadne 1.0 model by Memtrace developers is designed to search for code fragments by their functionality rather than just exact names. It turns a piece of code or text query into a 768-dimensional vector, placing semantically similar tasks close to each other. The model weighs only 70 MB (17.5 million parameters), runs on ONNX, and was trained via distillation (copying the outputs) of the larger jina-embeddings-v2-base-code model on 5 million lines of code. It suits developers who need fast local codebase search without a powerful GPU.
Key features
- Micro-size: only 70 MB and 17.5M parameters, runs on any laptop without a GPU.
- High speed: up to 830 code snippets per second on 8 CPU threads and about 13,000 on a graphics card.
- Quality embedding: outputs a normalized 768-dimensional vector for each text or piece of code.
- Multilingual code: supports 32 programming languages (Python, TypeScript, Go, Rust, C++, etc.).
What you can do
- Local search: embed semantic search by functions and classes into your own editor or project.
- Smart queries: search for code sections in a repository using a plain text task description ("where do we convert a string to a date?").
- ONNX integration: use the model in third-party services and Python applications via ONNX Runtime without heavy frameworks.
Example
import numpy as np
import onnxruntime as ort
from huggingface_hub import snapshot_download
from tokenizers import Tokenizer
path = snapshot_download("memtrace/ariadne-1.0")
tokenizer = Tokenizer.from_file(f"{path}/tokenizer.json")
tokenizer.enable_truncation(max_length=384)
session = ort.InferenceSession(f"{path}/onnx/model.onnx")
texts = ["def parse_date(value): ...", "where do we turn a string into a date?"]
encoded = tokenizer.encode_batch(texts)
ids = np.array([e.ids for e in encoded], dtype=np.int64)
mask = np.array([e.attention_mask for e in encoded], dtype=np.int64)
vectors = session.run(None, {"input_ids": ids, "attention_mask": mask})[0]
print(vectors @ vectors.T)
Read more
DetailsMetrics: trails the Jina v2 base by 7–10% in docstring search benchmarks (for example, 80.1% versus 89.7% for Django), but shows equal results inside Memtrace.
Hardware: efficient even on 1 CPU thread (~145 texts/sec), processes 450 thousand lines in 4 minutes on a CUDA GPU.
Limitations: context limit is 384 tokens, long code must be split into parts beforehand; queries in human languages other than English perform weaker.
License: Apache 2.0.










Comments