Autoresearch FTP#12
Open
sadrasabouri wants to merge 18 commits into
Open
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
|
Thanks for the submission @sadrasabouri! Can you please remove the files other than |
Author
|
@mpage requested changed applied. |
Owner
|
@sadrasabouri - Thanks! It looks like there are a couple of new files that got added. Can you remove those as well? |
Author
|
@mpage ops, sorry. I rushed through committing. It should be fixed now. |
Contributor
✅ Results
Per-graph results
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Submission Checklist
submissions/<github_username>.py.Approach Description
I started by exploring a smarter build ordering mechanism, but saw no meaningful gains. After some investigation I realised I had been benchmarking against Python's standard (GIL-enabled) build, which masks the benefit of parallelism entirely. Switching to Python 3.14t (the free-threading build, GIL disabled) changed the results and I started to actual improving: 3.61× total speedup over the single-threaded reference across five graph shapes.
From the baseline implementation, which uses the first-to-finish flag (this commit), I applied the autoresearch loop described by Andrej Karpathy, committed it, ran the benchmark, and either kept the improvement or reverted and tried again. Using Claude Code as the agent, the loop explored event-driven callbacks (replacing a polling executor), inline chain execution to avoid thread-handoff overhead on serial graphs, critical-path prioritisation for task selection, a custom persistent thread pool with a queue.
SimpleQueue to eliminate per-call thread creation cost, and various thread-count tunings. Each winning idea was layered onto the last; failed experiments (process pools, puts inside the lock, integer-indexed arrays, cross-trial caching) were automatically discarded. The log of the process is also documented below:
The final solution has four interlocking ideas.
I) Persistent thread pool with a lock-free queue: rather than spawning and joining threads on every build_all() call, a pool of min(128, cpu_count × 3) daemon threads is created once at module load and reused indefinitely. Workers sit in a loop on a
queue.SimpleQueueand dispatch to whatever run closure is currently active.II) Event-driven, callback-style scheduling. There is no polling loop. Each worker, after completing a task, inspects a dependents map to find which successors just had their last dependency satisfied (tracked via an in_degree counter under a single shared lock).
III) Inline chain execution. When a task completes and exactly one successor becomes ready, the worker does not put that successor into the queue and return. it loops directly and executes it in the same thread.