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 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 four-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. The finished model needs no style prompt, and against simulated users it was preferred over the base model in 93% of comparisons.

A training round: four answers to 'How should I study the night before the test?' 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 setting5 questions + fact sheets · LLM API
GPU service · one live session per user
↻ Repeats for each of the 5 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
GRPO updateon the plain prompt · 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. The four answers in a round are written under four different style instructions drawn from a menu. The instructions exist only to make the answers differ. Each answer is then scored as a reply to the plain question, with no style named, so GRPO makes the favorite more likely as a plain answer and the least favorite less likely. Every step is clipped at a ratio of 0.2, and half of each update's steps revisit selections from earlier rounds (experience replay). Because the answers are not sampled from the plain prompt itself, this is GRPO's objective used off-policy. The tuned model is never given a style instruction.

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

93%win rate against the untouched model
94%for a DPO baseline on the same users and seeds
100%of fact-sheet points covered

For benchmarking, 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 ten questions it was not trained on, asked with no style prompt. GRPO and DPO train on the same selections at the same learning rate, with four personas and matched seeds. Settings were chosen on one set of 12 runs per method, and the win rates below come from a second set with fresh seeds.

Comparison Result
GRPO against the untouched model 93% win rate (106 wins, 11 ties, 3 losses)
DPO against the untouched model 94% win rate
GRPO against DPO, same users and seeds 45% win rate (33 wins, 43 ties, 44 losses)
Fact-sheet points covered 100% for GRPO, 99.6% for DPO
Malformed answers 0.8% for GRPO, 1.7% for DPO

Ties count as half a win. The last two rows cover both sets of runs.

Head to head, DPO is slightly ahead, by a margin within chance. Its lead comes from one of the four personas, where GRPO did not pick up the empathy that persona wants. Over the other three, the two methods are level. They land close together because GRPO runs off-policy here, which makes its update similar to DPO's. Attune uses GRPO because a reward is a more general signal than a preference pair. The same update could take ratings, rankings, or automatic checks, and at five rounds it showed no measurable cost against DPO.

Session length. Experience replay raised the five-round win rate from 85% to 93% on the same seeds. It also damages the text in longer sessions: malformed answers rose from 0.8% at five rounds to 4.6% at seven and 24% at ten. Sessions therefore stop at five questions.

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.
  • Five rounds is a ceiling set by the method. The style comes through more strongly after eight rounds, but experience replay damages the text from seven rounds on.
  • 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.
  • Results depend on how each style instruction is worded. The model learns from answers written under those instructions, so it can inherit their habits, such as empathetic answers that open the same way.
  • 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.