MediumRaphael MontaudProblem & solution
How we think about text classification in the LLM era
Summary
Medium revisited its aging NSFW text-classification model, which had outdated code, infrequent retraining, and poorly documented training and performance history. The replacement uses an LLM prompt containing NSFW guidelines and story content, requesting a 0-to-100 score, structured output, and a short reason rather than requiring a training set. To evaluate it, the team created a curator-labeled dataset with deliberate oversampling of NSFW stories, then compared several LLMs with the legacy model using false-positive and false-negative metrics. Some models matched or exceeded the legacy model; the team selected Mixtral 8×7b based on cost and performance and ran inference in Snowflake. The post presents this as a strong fit where training data is costly, trends are relatively stable, and only distribution-eligible stories need scoring, while topic and spam models still benefit from continuously updated datasets.
Context
Medium’s NSFW classifier was outdated, infrequently retrained, and difficult to understand because its training process, code, and historical performance measurements were no longer well tracked. The team also needed to balance false positives and false negatives, while considering the cost of scoring stories with an LLM.
Approach / What changed
The team created a curator-labeled evaluation dataset with deliberate oversampling of NSFW stories, refined NSFW guidelines into an LLM prompt, and requested a 0-to-100 score plus a short reason in structured output. They compared several LLMs with the legacy model, selected Mixtral 8×7b based on cost and performance, and used Snowflake for offline experimentation and production inference on distribution-eligible stories.
Takeaways
An LLM-based NSFW classifier matched or outperformed the legacy model on false positives and false negatives in the team’s evaluation.
Requesting a score instead of only yes/no enables ranking, ROC-AUC or PR-AUC evaluation, and later threshold changes to adjust the false-positive and false-negative balance.
The LLM approach fit NSFW classification because maintaining labeled data was costly and trends were judged relatively stable, but topic and spam models still benefit from continuously refreshed training data.
Source and freshness
- Source
- medium.engineering
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.