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 frontend design. 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 with citations.

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 short session to learn the communication style they prefer. In the app, the user provides a role and a scenario. For each of seven questions, they see four answers and pick a favorite and a least favorite. Each selection trains a LoRA adapter with an online DPO update. The tuned model does not require a style prompt, and against simulated users it was preferred over the base model in 95% of comparisons.

A training round: four answers to 'What is the best way to memorize formulas?' from a tutor, each in a different style, with A marked best and C 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 setting7 questions + fact sheets · LLM API
GPU service · one live session per user
↻ Repeats for each of the 7 questions
Draw 4 stylesstyle instructions, for variety only
Write 4 answers7B language model + LoRA adapter
Check factsredraw if a fact-sheet point is missing
Browsermark best + worst
DPO updateon the plain prompt · 5 preference pairs per pick
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

Training update. The adapter is updated online, once per feedback round. Each round has four candidate answers, each generated under a different style instruction drawn from a menu. The instructions exist only to make the candidates differ. Each candidate is scored as an answer to the plain question, with no style instruction, so the update changes how the model answers by default. One selection yields five preference pairs: the favorite over each of the other three, and the two middle candidates over the least favorite. The objective is DPO with the base model as the reference. Alternate steps replay a selection from an earlier round. In use, the tuned model receives no style instruction.

Content control. Each question has a two-point fact sheet that every candidate must cover. A candidate that misses a point is regenerated before it is shown, so a selection reflects style and not a difference in the advice given.

Results

95%win rate against the base model
99.2%of required facts kept
2.5%malformed outputs, against 8.3% for GRPO

Training runs while the user waits, so the method has to learn from a small number of selections without breaking the text. Two methods were evaluated: DPO, the standard objective for preference pairs, and GRPO, a policy-gradient method that treats each selection as a reward.

The benchmark uses four simulated users in place of people. Each is a judge model with fixed style preferences, which provides seven rounds of feedback. Both methods train on identical selections, with the same learning rate, steps per round, and seeds. Each tuned model then answers ten questions it was not trained on, with no style prompt, and the judge rates every answer for style and fact retention. Settings were chosen on one set of runs, and the results below are from 12 runs per method on a separate set.

After seven rounds DPO GRPO
Win rate against the base model 95% 95%
Head to head 52% 48%
Fact retention 99.2% 99.2%
Malformed outputs 2.5% 8.3%

Win rates are per answer, with ties counted as half.

The two methods reach the same style quality at seven rounds. The difference is in longer sessions: GRPO's text breaks down and DPO's does not. Attune therefore uses DPO.

Session length. DPO learns faster. It leads at three rounds (88% against 80%), and its win rate levels off at 95% from six. GRPO's malformed outputs rise from 0% at five rounds to 8.3% at seven and 23% at ten, while DPO's stay between 2% and 4% at every length. DPO's fact retention holds at 98% or above through eight rounds and falls to 92% at ten. Sessions are therefore seven rounds, which balances learning against output quality.

Experience replay. Both methods reuse earlier selections, and the effect differs by method. For DPO, replay leaves the win rate unchanged (95% with, 94% without) and preserves content: without it, fact retention falls from 99.2% to 96.7%. For GRPO, replay raises the five-round win rate from 85% to 93% and is also what breaks its text.

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 base model.

Stack

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

Trade-offs and limits

Every candidate is held to the same fact sheet so that feedback measures style alone. The trade-off is that the approach depends on answers keeping to the fact sheet, which was less reliable outside advice settings.

  • In a test with non-advisory scenarios, styles carried over but facts were covered less reliably. Both points appeared in 62% of answers written as a student and 84% written as a client, against 90% written as an advisor. The app therefore recasts each role as an advisor and declines scenarios it cannot recast.
  • The simulated users are played by an LLM and select consistently. Real preferences are noisier.
  • Seven rounds is where measured gains level off, not a limit on what could be learned. By ten rounds DPO starts to drop facts.
  • The judge has been spot-checked by hand but not validated against a labeled set. It is least reliable on depth.
  • The model learns from answers written under the menu's style instructions and can inherit their habits, such as empathetic answers that open the same way.
  • 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 a key-value store, and only the last eight exchanges are sent to the model.

How the corpus is built. An LLM 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 accuracy, against CLIP's 45.0%
97.3%top-5 accuracy, against CLIP's 66.0%

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 in 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.