Writing

Labelling restaurant reviews for BERTBERT

The Problem

TikTok TechJam 2025 handed us a challenge: classify 100,000+ restaurant reviews into four categories—relevant, spam, rant, and advertisement. The catch? The data was unlabeled.

The obvious solution: throw GPT-4 at it. Let it label everything in a few hours, train on those labels, ship it.

We didn't do that. Here's why.

Why label quality mattered

Pseudo-labels are predictions rather than independent ground truth. If a labelling model makes systematic mistakes on ambiguous reviews, a downstream model can learn those mistakes too. That made manually reviewed labels useful for our domain.

An earlier version of this article claimed that a student model could never exceed its labeller's accuracy. That was too strong: student models can outperform their teachers under suitable training procedures, as demonstrated by Noisy Student. The practical issue here is evaluating against independent labels rather than treating pseudo-label agreement as correctness.

The Pipeline We Built Instead

Step 1: Manual Labels on a Small, Clean Dataset

We manually labeled ~1,500 reviews with strict classification policies. Every edge case was documented. Every ambiguous review was discussed. This gave us a small but verified ground truth.

The problem: our initial dataset had severe class imbalance. Out of 1,500 reviews, we had fewer than 50 combined instances of spam, advertisement, and rant. The model couldn't learn these minority classes.

Step 2: Handling the 40:1 Imbalance

We tried several approaches:

Techniques tried:

  • SMOTE (Synthetic Minority Oversampling): ❌ Introduced noise, killed F1 scores
  • Class weights: ⚠️ Helped, but required extensive tuning
  • Supplementing with Yelp data: ✅ Real minority examples from a different source

SMOTE generates synthetic examples by interpolating between existing minority samples. In theory, this balances your dataset. When applied to numerical text representations, these interpolations need not correspond to realistic examples. In our experiments, this approach did not help.

What worked: we pulled additional spam, rant, and advertisement examples from the Yelp Open Dataset. That helped us explore minority-class coverage, although data from another source can introduce a domain shift.

Step 3: The Labeling Model

We fine-tuned DeBERTaV2ForSequenceClassification on our clean, balanced dataset. Not GPT-4. Not even the largest BERT variant. A focused model trained on verified labels.

This labeling model then pseudo-labeled our full dataset of 100K+ reviews.

Step 4: The Final Model (Multi-Tower Architecture)

With pseudo-labeled data in hand, we built BERTBERT—a multi-tower architecture that processes:

  1. Text Tower: BERT embeddings (768-dim → 128-dim via PCA, retaining 85% variance)
  2. User Tower: Learned embeddings for reviewer behavior patterns
  3. Business Tower: Sequential network for business context (category, price tier, location)
  4. Cross-Attention: Text queries user and business towers to weight contextual relevance

The multi-tower design lets the model understand that a 5-star review saying "Best pizza! Visit pizzapromo.com" is suspicious not just from the text, but because it matches advertisement patterns in user behavior and business context.

Why Cohen's Kappa, Not Just Accuracy

With 40:1 class imbalance, accuracy is meaningless. A model that predicts "relevant" for everything achieves 97.5% accuracy while being completely useless.

Cohen's Kappa measures agreement beyond chance. A Kappa of 0 means your model is no better than random guessing. A Kappa of 1 means perfect agreement.

The original project write-up reported 93.9% validation accuracy and 0.781 Cohen's Kappa. Those figures need their evaluation split, class distribution and label provenance to be interpretable; they are not an independently verified benchmark or evidence of superiority to GPT-4o.

The Compute Reality

We planned to train on 1.5 million reviews. Reality: Google Colab's free tier. We scaled down to 50K training instances and used PCA to reduce computational load.

Constraints force creativity. With limited compute, every architectural decision mattered more. We couldn't brute-force our way to performance—we had to be smart about data quality and feature engineering.

What I took from the project

The useful engineering work was in making the labelling process explicit and combining text with reviewer and business context. A large corpus, a labelled corpus and the final training subset are different quantities: our original write-up described pseudo-labelling 100K+ reviews and using 50K training instances under compute constraints.

For a reliable comparison, I would keep a human-reviewed holdout separate from label generation, report per-class performance and compare models on exactly the same examples. I would also preserve the split and experiment configuration alongside the scores.

Built at TikTok TechJam 2025. View the code on GitHub. Technical wording reviewed October 2026.