Jesse Cui

Jesse Cui

Machine Learning Engineer

I lead engineering at Levra Labs, a technology consultancy building software for organizations that handle sensitive data in healthcare and education. Previously, I built production ML and data infrastructure at Amazon, Capital One, and Meta, including privacy and data systems in regulated environments.

I work across the whole stack, from data pipelines and models to the UI that people use. The projects below are ones I've built end to end to stay hands-on with current AI methods.

Projects

Attune showing four answers to one question, with one marked best and one marked worst

Attune

Fine-tunes a language model live on a person's feedback, so it learns how they like to be spoken to.

MentorML explaining how an LSTM cell works, with a diagram of the cell

MentorML

Explains machine learning concepts intuitively, with diagrams.

PhiloSearch answering a question with numbered citations to Epictetus, Seneca, Aristotle and Lao Tzu

PhiloSearch

Searches a library of classic philosophy by context and returns an answer that cites the passages it comes from.

Attune

A real-time human-in-the-loop fine-tuning system for personalizing LLM communication style

Overview

Attune fine-tunes a 7B language model on one person's feedback during a five-minute session, so it learns the communication style they prefer. The user gives a role and a scenario, then picks a favorite and least favorite from four answers to each of five questions. Each pick is the reward for an online GRPO update to a LoRA adapter. Against simulated users, the tuned model was preferred over the base model in 96% of comparisons.

A training round: four answers to 'What should I do when I get stuck on a difficult concept?' from a tutor, each in a different style, with one marked best and one marked worst

A training round. All four answers contain the same two facts. They differ only in empathy, directiveness, formality, and depth.

Architecture

Browseradvisor + topic
App server
Name gate and private relaysigned cookie · forwards to the GPU service
Serverless CPU function
Draft the setting5 questions + fact sheets · LLM API
GPU service · one live session per user
↻ Repeats for each of the 5 questions
Choose 4 stylesfrom the style menu
Write 4 answers7B language model + LoRA adapter
Check factsredraw if a fact-sheet point is missing
Browsermark best + worst
GRPO updateadapter weights · best and worst as the reward
Measure5 unseen questions · LLM API as judge
Package the adapterzip with a run script
Browserresults · try it · download
Browser Model I host Call to an external LLM API Plain code

How the update works. The adapter is updated online, once per question. Each answer is two sampled actions: a style drawn from the menu, then the text written in that style. GRPO scores the four answers to a question against each other, reinforcing the choices behind the favorite and penalizing those behind the least favorite. The style choice is treated as a single clipped action, and the wording is trained at 0.3 of that strength so the model doesn't collapse onto one stock phrase. 30% of styles are sampled at random to keep exploring.

Keeping the content fixed. Each question has a two-point fact sheet that every answer must cover. An answer that misses a point is regenerated before it is shown, so a selection reflects style and not which answer said more.

Results

96%win rate against the untouched model
59%head-to-head win rate against DPO
73%lower run-to-run variance than DPO

Simulated users stand in for people. The judge model is given a persona with fixed preferences, gives five rounds of feedback, and then rates each tuned model on unseen questions. GRPO and DPO train on the same selections, with matched personas and seeds.

Comparison Result
GRPO against the untouched model 96% win rate (113 wins, 4 ties, 3 losses)
GRPO against DPO, 28 matched runs 59% win rate (122 wins, 88 ties, 70 losses)
Style scales learned in the preferred direction 87% for GRPO, 72% for DPO
Run-to-run variance in scales learned 73% lower for GRPO
Answers adding advice not on the fact sheet 26% for GRPO, 22% for DPO

Ties count as half a win.

Attune's results page: what the model learned on each of the four style scales, with the standard model's rating shown as a hollow marker

The results page. It shows where the tuned model lands on each of the four style scales, compared with the standard model.

Stack

Model
Qwen2.5-7B-InstructLoRA (r = 16)PyTorchTransformersPEFT
Training
GRPODPO baseline
Judging
Gemini 3.8 Flash
Infrastructure
ModalL40S GPUFastAPI
Frontend
React 19TypeScriptVite 7Tailwind CSS v4

Trade-offs and limits

Every answer is held to the same fact sheet so that feedback measures style alone. The trade-off is that this only works if the model sticks to the fact sheet, and it did so less reliably outside advice.

  • In a test with speakers who aren't advising, the styles came through but the fact sheet was covered less reliably. Both points appeared in 62% of a student's answers and 84% of a client's, against 90% for an advisor. The app therefore keeps every session to advice: it recasts the role as someone advising the user and declines scenarios it can't recast.
  • GRPO does not reduce extra content. Models trained with GRPO add something beyond the fact sheet in 26% of answers, slightly more often than models trained with DPO (22%).
  • The judge model has been spot-checked by hand but not validated against a full set of human labels. It is least reliable on depth.
  • Empathetic answers often share an opening phrase. The untouched model does the same when given that style, so this comes from the style instruction and not from training.
  • The answers demonstrate a style. They can be wrong and are not medical, legal, or financial advice.

MentorML

A multimodal agentic teaching assistant for machine learning concepts

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.

MentorML answering 'How does an LSTM cell decide what to remember and what to forget?': the cell state explained as a whiteboard and the gates as guards controlling a valve, above a diagram of an LSTM cell

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 candidatesreads 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
LangGraphMCP (stdio)Redis checkpoints
Models
SigLIP 2 So400m/14Gemini 3.8 FlashGemini 3.5 Flash-Lite
Evaluation
LangSmithCLIP ViT-L/14 baseline
Backend
FastAPIPython 3.11PyTorch
Frontend
React 19TypeScriptVite 7Tailwind 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".

PhiloSearch

Semantic vector search and RAG on philosophical texts

Overview

PhiloSearch is a retrieval-augmented search engine over eight classic works of philosophy. The user selects books and asks a question, and the answer cites short excerpts labeled by book and section. Retrieval has two stages: sentence-level vector search over a FAISS index, then cross-encoder reranking of excerpts built from each sentence's passage. On a graded benchmark, this raised top-1 accuracy from 50% for flat search to 88%.

PhiloSearch answering 'How should I respond to things outside my control?' with numbered citations to Epictetus, Seneca, Aristotle and Lao Tzu

A search result. The answer cites ten sources from four books, and each number links to its excerpt.

Architecture

Offline · indexing script
Source textsTXT · PDF · MD · DOCX
Parse passages+ section labels
Split sentences
Embed sentencessentence encoder · parallel workers
Vector storeindex + metadata on disk
Browserquestion + books
API server
Embed the questionsame sentence encoder
Top 50 sentencesin the selected booksreads the vector store
Build excerptssentence + neighborsreads the vector store
Rerank excerptscross-encoder
Generate the answerexcerpts + passages · LLM API
Browserstreamed answer + cited sources
Browser Model I host Call to an external LLM API Plain code Stored data

Two-stage retrieval. The index stores single sentences, each linked to its source passage. A query retrieves the 50 nearest sentences, and each is expanded into an excerpt with its neighboring sentences. A cross-encoder then scores each excerpt against the question and reranks them. Each passage is cited once, by its best excerpt.

Generation. The answer model receives the full passages as context but may cite only the excerpts, so every citation points to text the reader can check.

Results

88%top-1 accuracy, against 50% for flat search
+27.7%nDCG@10 over flat search
34%less indexing time with Ray than PyTorch's multithreading

Retrieval was tested on 50 queries with graded relevance labels over a synthetic 100-paragraph document. Half of the paragraphs are closely related variants that the queries target, and the rest cover neighboring topics as distractors.

Method Accuracy@1 nDCG@10 MRR
Flat search 50% 0.704 0.659
Parent-child FAISS 62% 0.760 0.740
Parent-child + reranking 88% 0.899 0.929

Embedding 300,000 sentences took 223.5 seconds with PyTorch's default multithreading. With 8 Ray workers on the same 8 cores, it took 147.8 seconds including Ray's startup, which is 34% less time.

Stack

Retrieval
FAISSall-MiniLM-L6-v2ms-marco-MiniLM-L-6-v2
Generation
Gemini 3.8 Flash
Processing
RayNLTK
Backend
FastAPIPython
Frontend
React 19TypeScriptViteTailwind CSS v4

Trade-offs and limits

The index stores sentences for precise matching and uses their passages for context. The trade-off is a reranking step on every query.

  • The retrieval benchmark uses a synthetic 100-paragraph document, not the actual library.
  • Reranking adds time to each query. It added about 90 ms in the benchmark and can add up to half a second on the full library.
  • Ray only pays off for large CPU batches. At 20,000 sentences its startup time cancels the gain, and a single GPU process is faster than either.