Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started

Classify Prompts with Transformer Features

MediumMachine Learning00:00
Practice interviewer
In session
5 left
00:00

Whenever you're ready, walk me through how you'd approach this.

You need to log in / sign up to chat or submit.

Problem

Business Context

OpenAI wants a lightweight classifier that routes incoming prompts on the Chat Completions API into product-relevant categories such as coding, summarization, safety-sensitive, and factual Q&A. You are given embeddings and metadata derived from a GPT-style transformer, and your task is to build a supervised model that performs accurate multi-class classification under tight latency constraints.

Dataset

The dataset was generated from 1.2M historical prompts scored offline using a frozen GPT-style transformer encoder head. Each row represents one prompt and includes dense embedding features, prompt statistics, and limited metadata.

Feature GroupCountExamples
Transformer embeddings768pooled_hidden_0 ... pooled_hidden_767
Prompt statistics9token_count, avg_token_idf, punctuation_ratio, code_block_count
Categorical metadata5surface, customer_tier, locale, model_family, hour_bucket
Quality flags4language_detect_confidence, pii_flag, truncation_flag, moderation_score
  • Size: 1.2M prompts, 786 features
  • Target: 6-class label, coding, summarization, extraction, factual_qa, creative_writing, safety_sensitive
  • Class balance: Moderately imbalanced; safety_sensitive is 4.6% and extraction is 8.9%
  • Missing data: 7% missing in locale, 3% missing in language confidence, sparse missingness in metadata due to logging gaps

Success Criteria

A good solution should achieve macro-F1 of at least 0.78 and safety_sensitive recall above 0.90 on a held-out test set, while keeping p95 online inference below 20 ms per request.

Constraints

  • The final model must run in a low-latency online service
  • Explainability should be sufficient for error analysis and policy review
  • Retraining should be feasible weekly on newly labeled traffic
  • You may not fine-tune the full GPT-style backbone; use the provided features only

Deliverables

  1. Train a multi-class classifier using transformer-derived features and metadata.
  2. Justify your model choice relative to simpler baselines such as multinomial logistic regression.
  3. Show how you handle class imbalance, missing values, and mixed feature types.
  4. Evaluate the model with class-aware metrics and provide per-class performance.
  5. Describe how you would deploy, monitor, and retrain the model in production at OpenAI scale.