← luma ai Interview Insights

luma ai·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Interviewed for an ML engineer role at Luma AI and got a fairly math-heavy coding question about image processing. Not the typical leetcode grind, which was a nice change, but it definitely required you to actually know the underlying math.

Questions Asked (1)

Q1

Implement a k x k 2D Gaussian blur kernel from scratch using the Gaussian formula and a given sigma value. Distances from the center should be used for x and y, and the final kernel must be normalized so all values sum to 1.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I knew the formula but fumbled the normalization part at first.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the 2D Gaussian formula and how to compute distances from the kernel center. Then, walk through the implementation steps: create a k x k grid, compute the Gaussian value for each cell, and normalize by dividing each value by the sum. Finally, discuss practical considerations like handling even k and computational efficiency.

Pro tip: Mention that for even k, the center is between pixels, so you should use (i - (k-1)/2) for coordinates to maintain symmetry. Also, note that normalization ensures the kernel sums to 1, preserving image brightness.

1. Define the Gaussian function

State the 2D Gaussian formula: G(x, y) = (1 / (2 * pi * sigma^2)) * exp(-(x^2 + y^2) / (2 * sigma^2)). Explain that x and y are distances from the center.

2. Create coordinate grid

Generate a k x k grid where each cell (i, j) has coordinates (x, y) = (i - center, j - center), with center = (k-1)/2. This ensures the kernel is centered.

3. Compute kernel values

For each cell, plug x and y into the Gaussian formula to get the unnormalized weight. Optionally, omit the constant factor since it cancels during normalization.

4. Normalize the kernel

Sum all computed values and divide each by the sum to ensure the kernel sums to 1. This preserves image intensity after convolution.

5. Discuss practical considerations

Mention handling even k (center offset), computational efficiency (separable convolution), and edge cases like sigma=0 or very small sigma.

Key Points to Mention

  • The 2D Gaussian formula and its parameters (sigma, normalization constant).
  • Coordinate system: distances from center, handling even/odd k.
  • Normalization step: dividing by the sum to ensure weights sum to 1.
  • Separability: the 2D Gaussian can be computed as outer product of two 1D Gaussians, reducing complexity.
  • Boundary effects and kernel truncation: larger k captures more of the Gaussian but increases cost.
  • Numerical stability: avoid underflow for large sigma by computing in log space or using exp with small exponents.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.