PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Machine Learning/OpenAI

Debug transformer and train classifier

Last updated: Apr 20, 2026

Quick Overview

This question evaluates debugging and practical implementation skills for transformer-based text classification, covering model correctness, training loop integrity, data preprocessing, and evaluation metrics within the Machine Learning / Natural Language Processing domain.

  • hard
  • OpenAI
  • Machine Learning
  • Machine Learning Engineer

Debug transformer and train classifier

Company: OpenAI

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: hard

Interview Round: Technical Screen

##### Question You are given a transformer-based ML model with four failing unit tests—two bugs are known, two are novel. Identify, debug, and fix each bug so the model trains and evaluates correctly. Given a labeled dataset, write code to train a classifier, analyze the dataset (class balance, feature distributions), and report key performance metrics.

Quick Answer: This question evaluates debugging and practical implementation skills for transformer-based text classification, covering model correctness, training loop integrity, data preprocessing, and evaluation metrics within the Machine Learning / Natural Language Processing domain.

Related Interview Questions

  • Implement Backprop for a Tiny Network - OpenAI (hard)
  • Filter Bad Human Annotations - OpenAI (medium)
  • Compute Matrix Prefix Products And Gradients - OpenAI (hard)
  • Improve Training With Noisy Annotators - OpenAI (hard)
  • Debug a Broken Transformer - OpenAI (medium)
OpenAI logo
OpenAI
Aug 4, 2025, 10:55 AM
Machine Learning Engineer
Technical Screen
Machine Learning
112
0

Debug and Fix a Transformer Text Classifier, Then Train and Evaluate It

Context

You inherit a small codebase for a transformer-based text classifier. There are four failing unit tests: two correspond to previously documented ("known") issues; two are unexpected ("novel"). Your task is to make the model train and evaluate correctly, and to demonstrate a robust training/evaluation pipeline on a labeled dataset.

Assumptions (to make the task self-contained):

  • Language: Python 3.10+
  • Libraries: PyTorch, Hugging Face Transformers, scikit-learn, pandas, numpy
  • Dataset: a CSV file with columns text (string) and label (int), single-label classification with K classes.

Tasks

  1. Identify the root cause of each failing test (2 known bugs, 2 novel bugs), and fix the model/training code so all tests pass.
  2. Provide a clean, minimal reference implementation of the model and training loop that avoids these bugs.
  3. Given a labeled dataset, analyze class balance and basic feature distributions (e.g., text length, token frequency), then train the classifier.
  4. Report key performance metrics (accuracy, precision, recall, F1; ROC-AUC when binary), and include guardrails for class imbalance and reproducibility.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Machine Learning•More OpenAI•More Machine Learning Engineer•OpenAI Machine Learning Engineer•OpenAI Machine Learning•Machine Learning Engineer Machine Learning
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.