PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Machine Learning/OpenAI

Implement NumPy neural-network layers

Last updated: Apr 23, 2026

Quick Overview

This question evaluates competency in implementing neural-network layers and array algebra in NumPy, including matrix multiplication, broadcasting rules, activation functions, shape reasoning, numerical stability (e.g., softmax stability), and practical debugging of common ML implementation bugs.

  • medium
  • OpenAI
  • Machine Learning
  • Data Scientist

Implement NumPy neural-network layers

Company: OpenAI

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Onsite

You are given a neural-network coding task in NumPy. Let `X` be a batch input matrix of shape `(B, d_in)`, `W` a weight matrix of shape `(d_in, d_out)`, and `b` a bias vector of shape `(d_out,)`. 1. Implement a fully connected layer for batched input: `Y = X @ W + b`. 2. Implement or explain common follow-up layers such as ReLU and softmax. 3. Explain how vector and matrix addition and multiplication should behave in NumPy, including broadcasting and shape conventions. 4. Describe how you would debug common ML implementation bugs such as transposed matrices, incorrect broadcasting, unstable softmax, and mismatched batch dimensions. 5. If a model trains poorly, explain how you would analyze the dataset for issues such as leakage, class imbalance, duplicate rows, mislabeled examples, or train/validation distribution shift. Your answer should emphasize shape reasoning, numerical stability, and practical debugging strategy.

Quick Answer: This question evaluates competency in implementing neural-network layers and array algebra in NumPy, including matrix multiplication, broadcasting rules, activation functions, shape reasoning, numerical stability (e.g., softmax stability), and practical debugging of common ML implementation bugs.

Related Interview Questions

  • Implement 1NN with NumPy - OpenAI (medium)
  • Compute entropy and implement 1-NN - OpenAI (medium)
  • Defend a Research Direction and Experiment Design - OpenAI (medium)
  • Debug MiniGPT and Backpropagate Matmul - OpenAI (medium)
  • Implement Backprop for a Tiny Network - OpenAI (hard)
OpenAI logo
OpenAI
Feb 18, 2026, 12:00 AM
Data Scientist
Onsite
Machine Learning
32
0
Loading...

You are given a neural-network coding task in NumPy.

Let X be a batch input matrix of shape (B, d_in), W a weight matrix of shape (d_in, d_out), and b a bias vector of shape (d_out,).

  1. Implement a fully connected layer for batched input: Y = X @ W + b .
  2. Implement or explain common follow-up layers such as ReLU and softmax.
  3. Explain how vector and matrix addition and multiplication should behave in NumPy, including broadcasting and shape conventions.
  4. Describe how you would debug common ML implementation bugs such as transposed matrices, incorrect broadcasting, unstable softmax, and mismatched batch dimensions.
  5. If a model trains poorly, explain how you would analyze the dataset for issues such as leakage, class imbalance, duplicate rows, mislabeled examples, or train/validation distribution shift.

Your answer should emphasize shape reasoning, numerical stability, and practical debugging strategy.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Machine Learning•More OpenAI•More Data Scientist•OpenAI Data Scientist•OpenAI Machine Learning•Data Scientist Machine Learning
PracHub

Master your tech interviews with 8,000+ 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.