MV
Back to projects

Feb – May 2026 · Complete

TextScope — NLP Pipeline & Model Optimization

Solo build

AI/ML

Why I built it

I wanted to understand how NLP models actually work — how text becomes something a model can use, how training happens, and why one approach beats another. So I built the pipeline by hand rather than calling a library that would have done it in three lines and taught me nothing. Every stage is one I wrote myself specifically so I would have to understand it. Partway through I started writing the process up on Substack, which turned out to be the part that exposed what I only thought I understood.

What I built

  • Built an end-to-end NLP pipeline processing raw text through tokenization, bigram extraction, and TF-IDF feature engineering — each stage written out rather than imported, so nothing was a black box.
  • Trained and evaluated logistic regression models across L1 and L2 regularization to analyse feature importance and model performance.
  • Designed the experimentation workflow that compares results across hyperparameter configurations, so runs are reproducible and comparable rather than one-off.
  • Structured the codebase around swappable wrappers — separate TF-IDF, embedding, and evaluation modules behind a common interface — which is what made the representation comparison a change of one component rather than a rewrite.
  • Built an interactive Streamlit app on top of the pipeline for exploring how models behave on new text.
  • Wrote two beginner-facing articles explaining what I learned, working from the pipeline itself rather than from other explanations of it.

What I had to learn

  • How the whole path from raw text to a prediction actually fits together, at the level of detail you only get from having written each stage yourself.
  • That representation dominated model choice on this dataset. Swapping TF-IDF for sentence embeddings moved cross-validated accuracy far more than any amount of tuning the classifier did.
  • Cross-validation as a discipline rather than a step — comparing configurations honestly means fixing everything else first, which is a harder engineering problem than it sounds.
  • That writing an explanation is a good test of whether you have one. Several things I thought I understood turned out to be gaps only when I tried to put them in a paragraph for someone who did not already know the answer.

Results

  • Switching from TF-IDF to sentence embeddings raised cross-validated accuracy from 0.50 to 0.96.
  • Two published write-ups explaining how NLP models work and how to improve them, aimed at people starting from zero.

Stack

Pythonscikit-learnsentence-transformersPyTorchpandasNumPyStreamlit