Skip to content

beam_search: parallel auto_agent workers in a beam_search orchestrator loop#59

Open
ligh-svg wants to merge 2 commits into
pr2-mock-backend-serverfrom
ligh-pr3-beam-search-feature
Open

beam_search: parallel auto_agent workers in a beam_search orchestrator loop#59
ligh-svg wants to merge 2 commits into
pr2-mock-backend-serverfrom
ligh-pr3-beam-search-feature

Conversation

@ligh-svg

Copy link
Copy Markdown
Collaborator

Part 3/3 of the Beam Search prototype. It introduces BeamWorkerPipeline which exits on compilation success, and the AgenticSearchOrchestrator that runs parallel workers (support both full-cycle AutonomousPipelineAgent and the new BeamWorkerPipeline), groups candidate and runs batch evaluation (if using BeamWorkerPipeline), sorts and prunes the beams and iterates on optimization.

The prototype was tested in 2 modes, summarized in:

  • beam_search/docs/summary_12p_RMSNorm_aa_r3_b4_0625_0645.md: using AutonoumsPipelineAgent to run 3 rounds and 4 beams in each round
  • beam_search/docs/summary_12p_RMSNorm_bw_r3_b4_0625_0216.md: using BeamWorkerPipeline to run 3 rounds and 4 beams in each round

The test runs were merely for verification of the orchestration flow. All the performance numbers are either simulated or fake. Don't rely on them to assess the pipeline's efficiency.

with open(self.baseline_code_path, "r") as f:
self.baseline_code = f.read()

def _prepare_grouped_harness(self, candidate_paths: List[str]) -> str:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This _prepare_grouped_harness code is actually broken. It simply concatenates all candidate codes, which results in repeated main functions in the output python file. In the simulation evaluator it's fine because we just ask LLM to predict the performance by showing all codes. It won't work if we run this on real TPU backend.

I'll added a comment to clarify this.


# Step 1: Plan
logging.info(f"[{self.name}] Running PlanKernelAgent...")
async for event in self.plan_agent.run_async(ctx):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the planning agent, there are a few different strategies in AutoComp. Select from the optimization menu and the current version of the kernel code, or combine from best candidates from previous iteration. Are we capturing those combinations here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It implements the random selection from the optimization menu, but doesn't support combination of best candidates yet.


#### **Pros & Cons:**
* **Pros**:
* Clean separation: The execution loop logic for "tuning search" and "correctness validation" remain separate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! +1 to this initial design

We modify the base `AutonomousPipelineAgent` to accept `None` for `autotune_agent` and `profile_agent`, and adjust the control flow logic internally.

#### **Changes to `AutonomousPipelineAgent`:**
1. Make subagents optional in constructor:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In AutoComp, the initial search strategies are less rigorous than latter ones (even allowing sub-optimal candidates to survive). Should we mimic this in the new design where perhaps in the initial iterations we can set a shallower iteration in the autoagent compared to latter.

I might also oppose the above due to increased stochasticity of auto-agent with smaller N

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option A & B here is a detail about how to implement the worker agent that modifies the current auto-agent to do coding-only-but-no-evaluation.

It sounds to me the idea of start-shallower-then-go-deeper assumes we run the full auto-agent cycle in every beam search branch. So far I set the iteration to 1 for simplicity (the auto agent will stop as soon as it gets a successful profiling results). We need more tweaks in the orchestrator to adjust the max_iterations per auto-agent as the orchestrator enters later rounds.

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.

2 participants