-
Notifications
You must be signed in to change notification settings - Fork 0
Add beam and MCTS search strategies with tests #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add beam and MCTS search strategies with tests #10
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds beam search and MCTS modules, integrates them into EnhancedSearch with a reordered, gated synthesis pipeline, updates docs to mention beam search progress and capability, introduces tests for beam and MCTS rotation cases (including Hypothesis-based), and adds Hypothesis to requirements. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller
participant EnhancedSearch
participant Beam as BeamSearch
participant MCTS as MCTS
participant Neural as NeuralGuided
participant Sketch as SketchSearch
participant Adapt as TestTimeAdapt
Caller->>EnhancedSearch: synthesize_enhanced(train_pairs, max_programs,...)
Note over EnhancedSearch: Initialize candidates, search_stats
alt enable_beam_search && candidates < max_programs
EnhancedSearch->>Beam: beam_search(train_pairs, beam_width, depth)
Beam-->>EnhancedSearch: beam_programs, {nodes_expanded}
Note over EnhancedSearch: Update beam_candidates, beam_nodes_expanded
end
alt enable_beam_search && candidates < max_programs//2
EnhancedSearch->>MCTS: mcts_search(train_pairs, iterations, max_depth)
MCTS-->>EnhancedSearch: mcts_programs
Note over EnhancedSearch: Update mcts_candidates
end
alt candidates < max_programs//4
EnhancedSearch->>Neural: run()
Neural-->>EnhancedSearch: neural_programs
end
alt candidates < max_programs//2
EnhancedSearch->>Sketch: run()
Sketch-->>EnhancedSearch: sketch_programs
end
opt candidates > 0
EnhancedSearch->>Adapt: adapt(candidates)
Adapt-->>EnhancedSearch: adapted_candidates
end
EnhancedSearch-->>Caller: final_candidates, search_stats
sequenceDiagram
autonumber
participant Caller
participant Beam as beam_search
participant DSL as DSL Ops
Caller->>Beam: beam_search(train_pairs, beam_width, depth, max_expansions)
loop depth levels
Beam->>DSL: enumerate ops × parameter grid
DSL-->>Beam: candidate programs
loop candidates
Beam->>Beam: score_candidate(program)
alt score >= 0.999
Note over Beam: store as complete
else
Note over Beam: keep for next beam
end
end
Note over Beam: sort by score, truncate to beam_width
alt no expansions or max_expansions hit
Note over Beam: break
end
end
Beam-->>Caller: complete_programs[:beam_width], {nodes_expanded}
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (7)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Testing
pytest -qpython - <<'PY' import numpy as np, time, logging from arc_solver.grid import to_array from arc_solver.beam_search import beam_search logging.getLogger().setLevel(logging.ERROR) inp = to_array([[1,2],[3,4]]) out = np.rot90(inp, -1) start = time.time() beam_search([(inp, out)], beam_width=5, depth=2) print('elapsed_ms', round((time.time()-start)*1000,2)) PYhttps://chatgpt.com/codex/tasks/task_e_68c3f8a67f748322b130f269263b894c
Summary by CodeRabbit
New Features
Documentation
Tests
Chores