← All companies

Company

Anthropic

15 problems tagged for Anthropic.

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

Implement Temperature Sampling

Divide logits by a temperature scalar before softmax to sharpen or flatten the token probability distribution.

Easy

Implement 2D Positional Embeddings

Build 2D sinusoidal position encodings for vision transformers, encoding both row and column positions in patch grids.

Medium

Implement Contrastive Loss (InfoNCE) + CLIP Training Loop

Build the InfoNCE contrastive loss and a CLIP-style training loop that aligns image and text embeddings.

Medium

Implement KV Cache for Autoregressive Generation

Cache key and value tensors from previous timesteps so each new token only computes attention over one new position.

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 Top-k Sampling

Select the k highest-probability tokens, zero out the rest, renormalize, and sample for controlled text generation.

Medium

Implement Top-p (Nucleus) Sampling

Sort logits, compute cumulative probabilities, mask tokens below the nucleus threshold, and sample from the filtered distribution.

Medium

Implement DPO Loss from Scratch

Compute the Direct Preference Optimization loss that trains a policy directly from preference pairs without a reward model.

Hard

Implement PPO for RLHF

Build Proximal Policy Optimization with clipped surrogate objective, value function baseline, and KL penalty for RLHF.

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 FSDP from Scratch

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

Expert

Implement GRPO (DeepSeek-R1 Algorithm)

Build Group Relative Policy Optimization that scores multiple completions per prompt and uses group-relative advantages.

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