Inspiration

Hi everyone, I'm Von, a self-funded international student in Taiwan. I teach English part-time to pay for my studies and living expenses.

Over the years, I noticed that many of my students made similar types of errors when forming English sentences. Learners often think in their first language when putting together sentences in English, which leads to recurring error patterns among speakers of the same mother tongue. In linguistic research, this is known as L1 transfer (or first-language transfer).

For example, a learner might write "I very like watching movies," which is grammatically incorrect in English. In Mandarin, 「很」 (meaning "very") can go before 「喜歡」 (meaning "like") to emphasize degree. However, we cannot use "very" to modify a verb in English. So it's okay to say 「很」 + 「喜歡」 in Mandarin, but we cannot say "very" + "like" (or any verb, really) in English.

I started building PatternLab for my undergraduate thesis to help learners understand patterns like this and hopefully address the problem at its root, instead of just handing them a corrected sentence without explaining why.

How I built it

PatternLab uses a two-model pipeline:

  1. Model 1 (Error Diagnosis): Checks whether a sentence contains one of seven common L1-transfer errors, identifies what type of error it is, and locates where it is in the sentence. It uses a frozen RoBERTa-base encoder paired with a bidirectional LSTM with attention trained from scratch in PyTorch.
  2. Model 2 (Tutoring): Takes the sentence along with Model 1's error type and location to suggest a correction and write a bilingual explanation in English and Traditional Chinese. It is a Qwen3.5-4B model fine-tuned with LoRA.

To be transparent about the timeline: before the hackathon, I spent a couple months collecting, cleaning, and preparing a dataset of real errors by Taiwanese learners, finished training Model 1, and started preparing the dataset for Model 2. During the hackathon, I finalized the Model 2 dataset, finished fine-tuning Model 2, built the web interface (FastAPI, Pydantic, Jinja2, Uvicorn), wired both models together end-to-end, and deployed the full app to Google Cloud Run with Docker and Cloud Storage.

Challenges I faced

  • Dataset preparation (this took forever): Collecting real learner errors, cleaning them, and structuring them for both error diagnosis and bilingual tutoring was by far the most time-consuming part of the project.
  • Getting two models to work together cleanly: Wiring Model 1's diagnosis into Model 2 and keeping the whole pipeline working smoothly inside a web app took careful debugging.
  • Deploying on a student budget: Hosting both models live on Google Cloud Run is expensive when paying out of pocket, so packaging the models and managing deployment costs was a real constraint.
  • Scope limits in v1: PatternLab v1 is designed for one target error per sentence across seven error categories. Handling sentences with multiple overlapping errors is still an open challenge.

What I learned

  • Breaking the problem into two focused models (one for diagnosis and localization, one for bilingual explanation) worked much better than asking a single model to do everything at once.
  • Fine-tuning a smaller model like Qwen3.5-4B with LoRA can produce clear, grounded tutoring explanations when you give it structured diagnostic context.
  • Training the models is only half the work. Turning a thesis prototype into something people can actually use meant learning how to build a web interface, containerize it with Docker, and deploy it end-to-end on Google Cloud.

Built With

Share this project:

Updates

Submission history