Overview
MentorML is a teaching assistant for machine learning concepts,
built as a plan-and-execute agent. One planning call turns a
question into a short lesson and up to two searches over a
curated corpus of 620 diagrams. The answer leads with intuition
and is written around the diagrams that fit. Retrieval runs
SigLIP 2 behind an MCP tool and ranks the right diagram first for
82.6% of benchmark queries, against 45.0% for CLIP.
An explanation. The diagram comes from Dive into Deep Learning, which is credited below it.
Architecture
Offline · curation script
Source pages11 sites · papers, courses, blogs
Fetch figures+ captions and context
Score each figureteaching rubric · LLM API
Embed accepted imagesimage-text encoder
Diagram corpus620 images · descriptions · embeddings
Browserquestion
API server · agent
Plan the lessonsteps · terms · searches · LLM API
MCP tool server · subprocess
Embed the search phrasetext half of the same encoder
Rank images+ keyword matches · 12 candidates reads the diagram corpus
Write the answerpick up to two diagrams that fit, or none · LLM API
Conversation memorykey-value store · read and written each turn
Browserstreamed answer + diagram + follow-ups
Browser
Model I host
Call to an external LLM API
Plain code
Stored data
How a turn works. A single structured planning
call produces the teaching steps, the terms the answer must
define, and up to two diagram searches. Each search returns about
a dozen candidates, and the answer model picks from their
descriptions, which were written when the corpus was built.
Conversation state is checkpointed in Redis, and only the last 8
exchanges are sent to the model.
How the corpus is built. Gemini scores each
figure as a learner would see it, without the surrounding
article. A figure is kept only if it teaches something, stands on
its own, and scores at least 4 out of 5 for insight, visual
quality, and being understandable at a glance. 620 of 2,308
candidates passed.
Results
82.6% top-1 retrieval, against CLIP's 45.0%
97.3% of queries find their diagram in the top 5
Retrieval was measured on the curated corpus, with one query
written per image. A query counts as correct when its own image
is returned, and both models embed the same images.
Model
Accuracy@1
Accuracy@5
MRR
SigLIP 2
82.6%
97.3%
0.891
CLIP ViT-L/14
45.0%
66.0%
0.552
In a separate coverage audit, 133 of 138 topics a learner is
likely to ask about had a fitting diagram.
Stack
Agent
LangGraph MCP (stdio) Redis checkpoints
Models
SigLIP 2 So400m/14 Gemini 3.8 Flash Gemini 3.5 Flash-Lite
Evaluation
LangSmith CLIP ViT-L/14 baseline
Backend
FastAPI Python 3.11 PyTorch
Frontend
React 19 TypeScript Vite 7 Tailwind CSS v4
Trade-offs and limits
Each diagram is described once, offline, when the corpus is
built, so no vision model runs while the user waits. This saves
about 2 seconds per diagram on every answer. The trade-off is that the answer model picks from descriptions without seeing the image.
The retrieval benchmark uses one written query per image, so it
measures retrieval in isolation. In the app, the answer model
chooses among about 12 candidates, which makes accuracy@5 the
closer guide to what a user sees.
5 of the 138 audited topics have no fitting diagram, so those
answers are text only.
Latency depends on the answer model's thinking level. The first
words arrive in about 3 seconds at "low" and took 7 to 24
seconds at "medium".