← All companies

Company

Google

17 problems tagged for Google.

Easy× 3Medium× 4Hard× 7Expert× 3How these tags are sourced

Implement K-Means Clustering in PyTorch

Code Lloyd's algorithm with PyTorch tensors: random init, distance computation, centroid updates, and convergence check.

Easy

Implement Logistic Regression with Gradient Descent

Build binary logistic regression from scratch with sigmoid, binary cross-entropy, and manual gradient descent updates.

Easy

Implement Softmax from Scratch

Build numerically stable softmax using the log-sum-exp trick, handling overflow and underflow in raw tensor math.

Easy

Implement Beam Search for LLM Decoding

Maintain and expand top-scoring partial sequences at each decoding step with length normalization and early stopping.

Medium

Implement Knowledge Distillation

Train a smaller student model to match a larger teacher's soft predictions using temperature-scaled KL divergence loss.

Medium

Implement LoRA on a Linear Layer

Inject trainable low-rank decomposition matrices (A, B) into a frozen linear layer for parameter-efficient fine-tuning.

Medium

Implement Sliding Window Attention

Restrict attention to a fixed local window around each token, reducing memory from O(n²) to O(n·w) for long sequences.

Medium

Implement a Swin Transformer Block (Shifted Window Attention)

Build a Swin Transformer block from scratch: window partition, shifted-window attention masks, and a learned relative position bias.

Hard

Implement DDPM from Scratch

Build the full denoising diffusion pipeline: forward noise schedule, U-Net denoiser, and reverse sampling to generate images.

Hard

Implement Gradient Checkpointing

Trade compute for memory by recomputing intermediate activations during backward instead of storing them all.

Hard

Implement Mixture of Experts Layer

Build a gated MoE with top-k routing, load balancing loss, and expert capacity constraints for sparse computation.

Hard

Implement Selective State Space Model (Mamba)

Build Mamba's selective scan mechanism with input-dependent parameters, achieving linear-time sequence modeling without attention.

Hard

Implement Speculative Decoding

Draft tokens with a fast model, verify in parallel with the target model, and accept/reject to guarantee identical output distribution.

Hard

Implement Vision Transformer + MAE Pretraining

Build ViT with masked autoencoder pretraining — randomly mask patches, encode visible ones, decode to reconstruct.

Hard

Implement FSDP from Scratch

Build Fully Sharded Data Parallel: shard parameters across GPUs, all-gather before forward, reduce-scatter gradients after backward.

Expert

Implement Ring Attention for Long Contexts

Distribute attention computation across GPUs in a ring topology, enabling context lengths that exceed single-GPU memory.

Expert

Write a Fused Softmax Kernel in Triton

Write a GPU kernel in Triton that fuses the softmax computation into a single pass, eliminating intermediate memory reads.

Expert