Skip to content

Add challenge 98: Beam Search Step (Medium)#259

Open
claude[bot] wants to merge 1 commit into
mainfrom
add-challenge-98-beam-search-step
Open

Add challenge 98: Beam Search Step (Medium)#259
claude[bot] wants to merge 1 commit into
mainfrom
add-challenge-98-beam-search-step

Conversation

@claude
Copy link
Copy Markdown
Contributor

@claude claude Bot commented May 1, 2026

Summary

  • Adds a new medium challenge: one decoding step of beam search for autoregressive LLMs.
  • Given current cumulative beam log-probs (B, K) and next-token log-probs (B, K, V), expand all K*V candidate continuations and select the top K per batch, sorted by score, returning new beam scores plus parent beam indices and chosen token IDs.
  • Exercises broadcast addition, top-K reduction, and structured index decomposition (flat → (parent_beam, token)) — distinct from the existing 1-D top_k_selection because of the per-batch 2-D index space and the dual integer outputs.
  • Validated end-to-end on Tesla T4 with a CUDA solution: example test, all functional tests, and the performance test (B=16, K=8, V=50000) pass.

Test plan

  • Reference implementation matches example math by hand
  • All 10 functional tests have a top-K boundary gap > 1e-3 (no fp32 ties)
  • Performance test fits comfortably within 16 GB on T4 (≈25 MB token_logprobs)
  • pre-commit run --all-files passes (black, isort, flake8, clang-format, mojo format)
  • CUDA solution submitted via scripts/run_challenge.py --action submit → all tests passed

🤖 Generated with Claude Code

A real autoregressive decoding kernel that expands K active beams across
a vocabulary of size V and selects the top K continuations per batch.
Exercises broadcast addition, top-K reduction over a 2D index space, and
structured index decomposition into (parent_beam, token).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants