Skip to content

Tier 3: LLM agent experience improvements#33

Merged
kavanaghpatrick merged 15 commits intomainfrom
feat/tier3-agent-experience
Mar 8, 2026
Merged

Tier 3: LLM agent experience improvements#33
kavanaghpatrick merged 15 commits intomainfrom
feat/tier3-agent-experience

Conversation

@kavanaghpatrick
Copy link
Copy Markdown
Owner

Summary

  • Numpy shim: AST rewriter translates import numpy as np + np.random.random(), np.sqrt(), np.pi, etc. into supported math/random equivalents
  • Auto-parallelization: Detects single-instance Monte Carlo patterns and auto-wraps for N GPU instances via execute_python(source, n=10000)
  • Unified stats module: New emojiasm/stats.py with compute_stats() — adds median and histogram, replaces duplicated code in inference.py and gpu.py
  • Better error messages: Actionable suggestions when transpiler rejects unsupported syntax (e.g., "Use arr = [0.0] * N for fixed-size arrays")
  • Source maps: Each EmojiASM instruction now carries the original Python source line for debugging
  • 859 tests passing (28+ new tests added)

Closes #29

Test plan

  • Numpy shim: np.random.random(), np.sqrt(), np.pi, np.abs(), np.sin/cos/exp/log()
  • Auto-parallelization: detection, result capture, execute_python with n>1
  • Stats: empty list, single value, median, histogram, NaN/inf handling
  • Error messages: list literal, non-range for, unsupported import suggestions
  • Source maps: populated for simple and multiline programs
  • Full regression: 859 tests, 0 failures

🤖 Generated with Claude Code

claude added 15 commits March 8, 2026 12:27
Spec artifacts:
- research.md: feasibility analysis and codebase exploration
- requirements.md: user stories and acceptance criteria
- design.md: architecture and technical decisions
- tasks.md: POC-first implementation plan

Ready for implementation.
All five features verified end-to-end:
1. Numpy shim transpiles np.* code
2. Auto-parallelization with n=100 returns 100 results
3. Stats include median and histogram
4. Error messages include actionable suggestions
5. Source maps populated on instructions

831 tests passing.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Filter NaN/inf values in compute_stats() before computation
- Add catch-all error for unsupported np.<func>() and np.<attr>
- Guard auto-parallelization against empty/whitespace source
- Source map bounds check already correct (no change needed)
- Histogram with single unique value already handled (no change needed)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@kavanaghpatrick kavanaghpatrick merged commit aef35c4 into main Mar 8, 2026
4 checks passed
@kavanaghpatrick kavanaghpatrick deleted the feat/tier3-agent-experience branch March 8, 2026 09:15
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.

Tier 3: LLM agent experience — auto-parallelization and numpy shim

2 participants