-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add hierarchical episodic memory #9
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
feat: add hierarchical episodic memory #9
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds a hierarchical episodic memory index with bucketed retrieval, consolidation of duplicate episodes, and two-stage candidate program selection. Updates removal and storage to maintain the new index. Rebuilds the hierarchy on load. Documentation reflects Phase 3 completion and notes hierarchical episodic memory. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant DB as EpisodeDatabase
participant Hier as Hierarchy Index
participant Vec as Similarity Index
Caller->>DB: get_candidate_programs(train_pairs)
DB->>DB: query_hierarchy(train_pairs, τ=0.5, k=5)
alt bucket has results
DB->>Hier: Retrieve bucketed episodes
DB->>DB: Filter by cosine similarity on task features
note right of DB: Use hierarchical results
else no bucketed results
DB->>Vec: query_by_similarity(train_pairs)
note right of DB: Fallback to prior similarity search
end
DB->>Caller: Aggregated candidate programs
sequenceDiagram
autonumber
actor Trainer
participant DB as EpisodeDatabase
participant Hier as Hierarchy Index
participant Store as Persistent Storage
Trainer->>DB: store_episode(episode)
DB->>DB: _hierarchy_key(episode.features)
DB->>Hier: Insert episode.id into bucket
DB->>Store: Persist episode (existing flow)
Trainer->>DB: load()
DB->>DB: Clear hierarchy_index
DB->>Store: Load episodes
loop for each episode
DB->>DB: _hierarchy_key(...)
DB->>Hier: Insert episode.id into bucket
end
Trainer->>DB: remove_episode(id)
DB->>Hier: Remove id from bucket
DB->>Store: Remove episode (existing flow)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~55 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 (2)
✨ 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
https://github.com/tylerbessire/PUMA/blob/e2e21e4b160ae6753b4a6b8d3e2b2cf80d48d12d/arc_solver/neural/episodic.py#L286-L298
[P1] Fill candidate pool when hierarchy yields too few matches
The new get_candidate_programs now queries query_hierarchy and only falls back to query_by_similarity when the hierarchical bucket is completely empty. If the bucket contains even one unrelated episode, the method returns only the programs from that small bucket and never supplements them with other episodes, so callers can receive far fewer than max_programs candidates despite the database containing many more useful examples. This is a regression from the previous implementation, which always filled the result list up to the requested size. Consider topping up from query_by_similarity whenever the hierarchical results do not supply enough programs.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
Summary
Testing
pytesthttps://chatgpt.com/codex/tasks/task_e_68c3f49e0fe08322adb65dd63806b8f9
Summary by CodeRabbit
New Features
Performance
Bug Fixes
Documentation