MacroAgent: Regularity-Aware Macro Legalization with LLM-Agent-Designed Contour Algorithms
Summary
MacroAgent introduces a novel framework using LLMs to design contour algorithms for macro legalization in VLSI circuits, achieving significant improvements in layout regularity and performance.
View Cached Full Text
Cached at: 08/27/26, 09:28 AM
# Regularity-Aware Macro Legalization with LLM-Agent-Designed Contour Algorithms
Source: [https://arxiv.org/html/2608.24946](https://arxiv.org/html/2608.24946)
## MacroAgent: Regularity\-Aware Macro Legalization with LLM\-Agent\-Designed Contour AlgorithmsJournal:TODAESCCS:Hardware Software tools for EDACCS:Hardware Methodologies for EDA
,Xufeng YaoAffiliation:The Chinese University of Hong Kong,Yuxuan ZhaoAffiliation:The Chinese University of Hong Kong,Yuntao LuAffiliation:The Chinese University of Hong Kong,Peiyu LiaoAffiliation:The Chinese University of Hong Kong,Zuodong ZhangAffiliation:Peking University,Yibo LinAffiliation:Peking UniversityandBei YuAffiliation:The Chinese University of Hong Kong
© none
###### Abstract\.
Macros constitute a large part of the core area in modern very large\-scale integration \(VLSI\) designs\. Moreover, macro positions have a significant impact on the final quality of result \(QoR\), and macro legalization is typically the final step in determining the macro positions\. However, existing approaches related to macro legalization either lack robustness or incur substantial computational costs or neglect the regularity between macros\. To address these limitations, we introduce MacroAgent\. The novel framework is a four\-stage approach: clustering, contour generation, template matching, and inter\-cluster refinement\. We propose leveraging Large Language Models \(LLMs\) to discover multiple, effective heuristic regularity\-aware contour algorithms\. This framework successfully generates robust and effective algorithmic solutions for macro legalization\. Compared with state\-of\-the\-art macro legalization works, experimental results on TILOS and Chipyard benchmarks demonstrate a 2 to 8 fold improvement in layout regularity, a 3% to 5% reduction in routed wirelength with comparable congestion after global routing, and significantly better robustness with an acceptable runtime\. Furthermore, end\-to\-end evaluation through Cadence Innovus place\-and\-route confirms that the regularity improvements translate into tangible PPA gains, including 2\.9% lower routed wirelength and 68\.3% TNS improvement over the DREAMPlace macro legalization baseline; it also achieves 1\.8% lower routed wirelength when integrated into the Innovus macro placement flow\.
###### Keywords:
Design Automation, Physical Design, Macro Legalization
## 1\.Introduction
Macros in very large\-scale integration \(VLSI\) circuits, such as memory and spatial arrays, are pre\-designed giant functional blocks\. They have fixed dimensions \(e\.g\., height and width\) and optimized structures\. Macro placement heavily constrains subsequent standard\-cell optimization, which in turn indirectly impacts power, performance, and area by affecting the routed wirelength\([30](https://arxiv.org/html/2608.24946#bib.bib43)\)\. Macro legalization represents the final phase that determines legal macro positions at the end of macro placement process\.
Traditionally, the physical design procedure for VLSI circuits is composed of multiple stages, including floorplan, macro placement, standard\-cell placement, and routing\. Macro placement occupies an early position in the design process and has a significant influence on subsequent phases\([15](https://arxiv.org/html/2608.24946#bib.bib40)\)\. Moreover, due to the large size of macros, minor position adjustments can significantly impact downstream optimizations\([34](https://arxiv.org/html/2608.24946#bib.bib28)\)\.
The research literature categorizes macro placement into two main categories\. The first is mixed\-size global placement \(placing macros and standard\-cells together, rough locations\), then macro legalization \(overlap removal\)\([23](https://arxiv.org/html/2608.24946#bib.bib29);[2](https://arxiv.org/html/2608.24946#bib.bib8);[33](https://arxiv.org/html/2608.24946#bib.bib31);[11](https://arxiv.org/html/2608.24946#bib.bib32);[39](https://arxiv.org/html/2608.24946#bib.bib26);[20](https://arxiv.org/html/2608.24946#bib.bib34);[34](https://arxiv.org/html/2608.24946#bib.bib28)\)\. During the first step, overlap constraints are relaxed, multiple objectives are considered\. Then macro legalization removes remaining overlaps\. The second category utilizes layout data structures to directly place macros, optimize customized objectives via simulated annealing\([10](https://arxiv.org/html/2608.24946#bib.bib36);[8](https://arxiv.org/html/2608.24946#bib.bib27);[37](https://arxiv.org/html/2608.24946#bib.bib9);[21](https://arxiv.org/html/2608.24946#bib.bib25);[22](https://arxiv.org/html/2608.24946#bib.bib24)\)\. The first category is faster than simulated annealing in the second, which is less scalable\([18](https://arxiv.org/html/2608.24946#bib.bib42);[2](https://arxiv.org/html/2608.24946#bib.bib8)\)\. In industry practice, macro placement relies on both senior engineers’ expertise \(e\.g\., manual placement\) and algorithmic efforts\([2](https://arxiv.org/html/2608.24946#bib.bib8)\)\. Complex projects may take hours to days\([2](https://arxiv.org/html/2608.24946#bib.bib8)\)\. The industrial tool, Innovus, offers a flow similar to the first macro placement method in the research literature, with two commands:place\_design \-concurrent\_macro\(mixed\-size global placement\) and thenrefine\_macro\_place\(macro legalization\)\([18](https://arxiv.org/html/2608.24946#bib.bib42)\)\.
Figure 1\.The MacroAgent framework consisting of four\-stage legalization steps\. MacroAgent achieves engineer\-level regularity macro legalization results by regularity\-aware contour algorithms designed by the LLM agent\.Current Approaches to Macro Legalization\. Most prior works in macro legalization only attempt to minimize the displacement \(i\.e\., the movements of macros\)\.\([13](https://arxiv.org/html/2608.24946#bib.bib30)\)proposes a legalization scheme that computes macro coordinates through the iterative adjustment of two constraint graphs, minimizing displacement by solving the linear programming problem\.\([23](https://arxiv.org/html/2608.24946#bib.bib29)\)extracts search points and feasible regions using the Puzzle algorithm, and iteratively places macros\. DREAMPlace 2\.0\([24](https://arxiv.org/html/2608.24946#bib.bib35)\)combines the two techniques mentioned above and has been applied in\([2](https://arxiv.org/html/2608.24946#bib.bib8);[20](https://arxiv.org/html/2608.24946#bib.bib34);[34](https://arxiv.org/html/2608.24946#bib.bib28)\)\. The work in\([33](https://arxiv.org/html/2608.24946#bib.bib31)\)designed an occupancy\-aware macro legalization algorithm that iteratively eliminates overlaps via heuristic approaches\. The study in\([11](https://arxiv.org/html/2608.24946#bib.bib32)\)employs integer linear programming or simulated annealing to adjust macro positional relationships when initial sequence pairs prove infeasible\. Although these techniques can improve the robustness of macro legalization, they still fall short in two aspects:first, they overlook the regularity between macros; second, they lack robustness since only one or two heuristics cannot fit all different testcases in macro legalization\.
Figure 2\.Consequences of ignoring regularity in macro legalization \(red giant rectangles are macros, blue tiny points are cells\)\. Both situations worsen the wirelength\.Regularity\-Aware Macro Placement\. Among prior works on macro placement, there is a common focus on macro regularity\.Studies have confirmed that such regularity reduces wirelength and minimizes deadspace\([23](https://arxiv.org/html/2608.24946#bib.bib29)\), although the definition of regularity in these studies is quite different\.\([8](https://arxiv.org/html/2608.24946#bib.bib27)\)uses cost models for macro grouping and regularity penalties, demonstrating a significant reduction in wirelength\.\([21](https://arxiv.org/html/2608.24946#bib.bib25);[22](https://arxiv.org/html/2608.24946#bib.bib24)\)exploit RTL hierarchy information to cluster macros and arrange them in regular patterns\.\([34](https://arxiv.org/html/2608.24946#bib.bib28)\)defined macro regularity as the necessity for macros to be surrounded by other macros or die boundaries, identify irregular placements and adjust\. The MaskRegulate\([39](https://arxiv.org/html/2608.24946#bib.bib26)\)method implements a reinforcement learning policy as a regulator to adjust existing layouts\.\([23](https://arxiv.org/html/2608.24946#bib.bib29)\)extract macros of the same type and similar levels, arrange them in array form\. They consider regularity during refinement or directly place macros\.However, no academic work directly considers regularity in the final legalization stage in macro placement\.Only industrial tool Innovus provides an optionplace\_global\_align\_macroto achieve regular macro legalization\([18](https://arxiv.org/html/2608.24946#bib.bib42)\)\. It is important to differentiate our legalization\-focused approach from constructive regular placement methods\([8](https://arxiv.org/html/2608.24946#bib.bib27);[23](https://arxiv.org/html/2608.24946#bib.bib29);[21](https://arxiv.org/html/2608.24946#bib.bib25);[22](https://arxiv.org/html/2608.24946#bib.bib24);[39](https://arxiv.org/html/2608.24946#bib.bib26)\)\. While constructive methods enforce patterns early, modern mixed\-size global placement tends to disrupt these pre\-defined patterns during optimization, so they need to keep the macros fixed\. Therefore, we do not aim to compete with placement algorithms in generating the initial structure; rather, we propose an essential complementary capability: recovering and enforcing regularity during the final legalization stage, similar to theplace\_global\_align\_macroflow in Innovus\([18](https://arxiv.org/html/2608.24946#bib.bib42)\)\.
Figure 3\.Channel\-based macro regularity examples\.Regularity Metrics\.Although regularity is essential for macro placement, there is no universally accepted definition\.Earlier studies by\([23](https://arxiv.org/html/2608.24946#bib.bib29);[21](https://arxiv.org/html/2608.24946#bib.bib25);[22](https://arxiv.org/html/2608.24946#bib.bib24)\)mainly characterize regularity via array\-based placement configurations\.\([8](https://arxiv.org/html/2608.24946#bib.bib27);[34](https://arxiv.org/html/2608.24946#bib.bib28);[39](https://arxiv.org/html/2608.24946#bib.bib26)\)define regularity by the proximity of macros to chip boundaries or the presence of other macros in specific vicinities\.
We generally adhere to the perspective in\([22](https://arxiv.org/html/2608.24946#bib.bib24)\)thatmandating macro placement at the layout periphery is no longer feasible, as this increases the required stack depth of macros\.However, in\([23](https://arxiv.org/html/2608.24946#bib.bib29);[21](https://arxiv.org/html/2608.24946#bib.bib25);[22](https://arxiv.org/html/2608.24946#bib.bib24)\), they constrain macros to a strictly array\-based form, with no metric to evaluate their regularity\.
We introduce a quantitative macro regularity metric by counting channels between macros, aligned with previous studies\([23](https://arxiv.org/html/2608.24946#bib.bib29);[21](https://arxiv.org/html/2608.24946#bib.bib25);[22](https://arxiv.org/html/2608.24946#bib.bib24)\)\. This metric reflects these physical design principles: excessive channels increase deadspace and restrict standard\-cell placement optimization\. As shown in[Figure2](https://arxiv.org/html/2608.24946#S1.F2), the cells trapped in the channels between macros are less likely to jump out of the channels, due to the density constraint\([34](https://arxiv.org/html/2608.24946#bib.bib28)\)\. It is also evident that the deadspaces between macros increase the wirelength\. Our approach assigns peak regularity scores to squares and high scores to rectangles, supporting established array\-based placement methods\([23](https://arxiv.org/html/2608.24946#bib.bib29);[21](https://arxiv.org/html/2608.24946#bib.bib25);[22](https://arxiv.org/html/2608.24946#bib.bib24)\)\.[Figure3](https://arxiv.org/html/2608.24946#S1.F3)indicates the number of channels under irregular and regular placement, which reveals that the number of channels is the smallest in the case of array\-based placement\. For normalization, after counting the channels, we divide the theoretical smallest possible number of channels by the acquired number\. The number is less than 1, where the closer the index value is to 1, the higher the regularity achieved\. We achieve a theoretical minimum number of channels when arranging macros in a square array\. The following formula can obtain a rough estimation:
\(1\)a=⌊Nmacro⌋,Cmin=2a−2,a=\\lfloor\\sqrt\{N\_\{\\text\{macro\}\}\}\\rfloor,\\quad C\_\{\\min\}=2a\-2,whereNmacroN\_\{\\text\{macro\}\}is the number of macros,aais the side length lower bound of the square array, andCminC\_\{\\min\}is the theoretical minimum number of channels\. Intuitively, we need at leasta−1a\-1channels to separate the macros intoaarows and anothera−1a\-1channels to separate the macros intoaacolumns\. Any irregular placement introduces extra channels\. Finally, the regularity index is defined as:
\(2\)R=CminCactual,R=\\frac\{C\_\{\\min\}\}\{C\_\{\\text\{actual\}\}\},whereCactualC\_\{\\text\{actual\}\}is the actual number of channels\. To computeCactualC\_\{\\text\{actual\}\}, we construct a Hanan grid from all macro vertex coordinates, mark occupied cells, and iteratively merge adjacent empty cells into maximal rectangular strips\. An empty cell at a crossing point may participate in merges in both directions simultaneously\. The number of resulting strips yieldsCactualC\_\{\\text\{actual\}\}; details are provided in[Section2](https://arxiv.org/html/2608.24946#S2)\.[Figure3](https://arxiv.org/html/2608.24946#S1.F3)also exhibits that the theoretical minimum number of channels is 2\. The regularity indices are 0\.5 and 1 for the left and right cases, respectively\.
Large Language Models for Algorithm Design\. Large Language Models \(LLMs\) have drawn much research attention for their great performance in various cognitive tasks\([1](https://arxiv.org/html/2608.24946#bib.bib10);[16](https://arxiv.org/html/2608.24946#bib.bib11);[38](https://arxiv.org/html/2608.24946#bib.bib12);[3](https://arxiv.org/html/2608.24946#bib.bib13);[17](https://arxiv.org/html/2608.24946#bib.bib14);[35](https://arxiv.org/html/2608.24946#bib.bib21)\)\. In Electronic Design Automation \(EDA\), more researchers are using LLMs as research tools\([27](https://arxiv.org/html/2608.24946#bib.bib15);[9](https://arxiv.org/html/2608.24946#bib.bib16);[14](https://arxiv.org/html/2608.24946#bib.bib17)\), in script/RTL generation, circuit design, and QA systems\.
Traditional automated algorithm design methods, such as genetic programming \(GP\)\([6](https://arxiv.org/html/2608.24946#bib.bib4)\), require defining a set of allowed mutation operations \(or primitives\)\. Designing such a suitable set of primitives is non\-trivial and remains an open challenge in practice\([32](https://arxiv.org/html/2608.24946#bib.bib7)\)\. Reinforcement learning \(RL\) has also been applied to algorithm design, including program superoptimization\([36](https://arxiv.org/html/2608.24946#bib.bib6)\)and discovering faster assembly\-level sorting algorithms\([29](https://arxiv.org/html/2608.24946#bib.bib5)\)\. However, RL\-based approaches require human experts to carefully design the action spaces, and this design becomes difficult for higher\-level programming languages\([35](https://arxiv.org/html/2608.24946#bib.bib21)\)\. Moreover, RL models are trained on specific tasks and do not readily generalize to other problems\. In contrast, LLMs have been trained on vast amounts of code and have learned common patterns and routines from human\-designed programs\. By leveraging this knowledge together with prompt\-provided context, LLMs can generate more effective suggestions than the random mutations typically used in GP\([35](https://arxiv.org/html/2608.24946#bib.bib21)\)\. Furthermore, LLMs do not require a predefined action space or mutation operations, offering greater flexibility to explore a larger search space\.
Recently, there is growing interest in LLM\-based algorithm design\([26](https://arxiv.org/html/2608.24946#bib.bib19);[25](https://arxiv.org/html/2608.24946#bib.bib20);[40](https://arxiv.org/html/2608.24946#bib.bib22);[19](https://arxiv.org/html/2608.24946#bib.bib23)\)\. LLMs play various roles, such as evaluators and optimization engines\. The most promising is using LLMs to directly design algorithm components \(heuristic methods\) for NP\-hard problems\([26](https://arxiv.org/html/2608.24946#bib.bib19)\)\. In EDA, the direct use of LLMs for algorithm design is underexplored; only\([41](https://arxiv.org/html/2608.24946#bib.bib18)\)has attempted to enhance global placement algorithms via iterative LLM implementation, using crafted prompts and an LLM\-based genetic process, but lacking meaningful feedback \(only wirelength\)\. AlphaEvolve\([31](https://arxiv.org/html/2608.24946#bib.bib1)\)combines LLMs with evolutionary search and achieves impressive results in mathematics and algorithm optimization, where LLMs already possess sufficient knowledge from pretraining\. However, applying LLMs to specialized fields like EDA, where they lack domain expertise, presents a distinct challenge\. SATLUTION\([42](https://arxiv.org/html/2608.24946#bib.bib2)\)targets NP\-complete SAT problems and demonstrates that LLMs can handle substantial code generation at scale\. Nevertheless, as the authors discuss in the appendix, human guidance is still incorporated to manually direct higher\-level algorithmic strategies while leaving the lower\-level implementation to the LLM agent\. GPU Kernel Scientist\([5](https://arxiv.org/html/2608.24946#bib.bib3)\)tunes existing GPU optimization techniques \(e\.g\., increasing thread block occupancy and resolving shared memory conflicts\) to find the best kernel for specific hardware, rather than discovering new algorithms\. Our work differs from these approaches in three key aspects: \(1\) we introduce adomain\-agnostic abstractionthat reformulates the EDA\-specific problem into a geometric problem\. Domain\-specific decisions such as clustering strategy and optimization objective selection are encoded in the framework by human engineers, while the LLM operates solely on the abstracted geometric subproblem using a general\-purpose, off\-the\-shelf model without any domain\-specific fine\-tuning\. \(2\) Our LLM autonomously discovers both algorithm ideas and implementationswithout human strategy guidancein the intermediate process\. \(3\) The manageable scale of macro legalization instances enables us to provide human\-crafted solution samples and per\-iteration visual feedback to the LLM, allowing it to understandwhya solution is good or bad rather than relying solely on scalar metrics\.
Despite their promising potential, significant limitations persist in employing LLMs for advanced algorithm design: they struggle with complex algorithm implementations and lack domain\-specific expertise for specialized optimization tasks\([25](https://arxiv.org/html/2608.24946#bib.bib20)\)\.
Motivation\. In the EDA domain, the majority of problems are NP\-hard\. Researchers have historically developed numerous heuristic algorithms to address these challenges\. Specifically within macro legalization, previous researchers have designed sophisticated heuristics for macro clustering, placement selection, and perturbation techniques to optimize solution quality\. It naturally raises a fundamental question: Can LLMs effectively replace human experts in designing heuristic algorithms for such problems?
Our Contribution\. To address these challenges, we propose a robust regularity\-aware macro legalization framework with four stages\. Our framework decomposes the macro legalization process into four sequential components of clustering, regularity\-aware contour generation, template\-based macro matching, and inter\-cluster refinement as shown in[Figure1](https://arxiv.org/html/2608.24946#S1.F1)\.Compared with the traditional legalization methods, our methods are more robust through the combination of multiple heuristic LLM\-designed contour algorithms\. It achieves simultaneous regular macro legalization while minimizing the displacement through template matching\.To mitigate the limitations of LLMs in EDA domains, we extract a domain\-agnostic geometry problem and present LLMs with the engineers’ manual macro legalization solutions, which address gaps in domain knowledge and simplify the original problem\. This enables fast, automatic, and diverse heuristics findings in an offline manner to fit different input testcases \(no human intervention in the intermediate process\)\. Notably, the hard testcases used for final validation are distinct from those utilized to guide LLMs in heuristic discovery, effectively demonstrating the strong generalization capability of LLM generated heuristics\. We validate MacroAgent under two experimental flows\. In the academic flow \(DREAMPlace \+ HeLEM\-GR\), MacroAgent reduces routed wirelength by 3%–5% with comparable congestion on both TILOS and Chipyard benchmarks\. In the industrial flow \(Cadence Innovus place\-and\-route\), MacroAgent achieves 2\.9% lower routed wirelength, 68\.3% TNS improvement, and comparable power over the DREAMPlace macro legalization baseline; it also achieves 1\.8% lower routed wirelength when integrated into the Innovus macro placement flow\.
We organize the rest of the paper as follows:[Section2](https://arxiv.org/html/2608.24946#S2)introduces the rise of LLM agents in algorithm design and the problem definition of macro legalization\.[Section3](https://arxiv.org/html/2608.24946#S3)introduces the proposed macro legalization framework\.[Section4](https://arxiv.org/html/2608.24946#S4)introduces the implementation details of the proposed macro legalization framework\.[Section5](https://arxiv.org/html/2608.24946#S5)presents the experimental results\.[Section6](https://arxiv.org/html/2608.24946#S6)concludes the paper\.
## 2\.Preliminaries
### 2\.1\.LLM Agents for Algorithm Design
An LLM agent is an AI that uses LLMs to autonomously perform tasks by reasoning, taking step\-by\-step actions, and leveraging tools\. Currently, LLM agents are revolutionizing algorithm design through automated code generation and optimization\. Recent studies\([25](https://arxiv.org/html/2608.24946#bib.bib20)\)identify several distinct roles that LLMs play in algorithm design: \(1\)LLM as optimizer: OPRO\([40](https://arxiv.org/html/2608.24946#bib.bib22)\)uses LLMs to directly generate and refine solutions through prompt\-based optimization, treating the LLM itself as the search operator; \(2\)LLM as evaluator: Jawahar et al\.\([19](https://arxiv.org/html/2608.24946#bib.bib23)\)leverage LLM performance predictors as initializers for neural architecture search, where the LLM assesses candidate quality rather than generating algorithms; \(3\)LLM as heuristic generator: this is the most promising paradigm for NP\-hard problems, where LLMs generate complete algorithm code within an evolutionary framework\. Google’s FunSearch\([35](https://arxiv.org/html/2608.24946#bib.bib21)\)and AlphaEvolve\([31](https://arxiv.org/html/2608.24946#bib.bib1)\)exemplify this third paradigm, demonstrating AI’s capacity to discover and refine algorithms across scientific and engineering domains\. EoH\([26](https://arxiv.org/html/2608.24946#bib.bib19)\)further advances this direction by evolving both algorithmic ideas and their implementations simultaneously\. The core idea is evolutionary code generation and evaluation\. LLM agents autonomously generate, modify, and evolve complete algorithm code over multiple iterations\. And evaluation systems guide the algorithmic evolution process toward better solutions\. This methodology essentially creates a self\-improving cycle to continuously refine results\. Traditional automated algorithm design methods rely on genetic programming or reinforcement learning, both of which require experts to design the mutation operations or action spaces\. In contrast, LLM agents directly generate algorithms within the algorithm space using high\-level programming languages\. In EDA, EvoPlace\([41](https://arxiv.org/html/2608.24946#bib.bib18)\)applies this paradigm to global placement by iteratively evolving placement heuristics via LLM\-based code generation\.
### 2\.2\.Macro Legalization Problem Formulation
###### Problem1\.
Given macro positions after mixed\-size placementM=\{m1,m2,⋯,mn\}M=\\\{m\_\{1\},m\_\{2\},\\cdots,m\_\{n\}\\\}, where each macromim\_\{i\}has \(1\) initial coordinates\(xi′,yi′\)\(x\_\{i\}^\{\\prime\},y\_\{i\}^\{\\prime\}\)\(representing bottom\-left corner\), \(2\) fixed dimensions: widthwiw\_\{i\}and heighthih\_\{i\}\. Find legal macro positions\{\(x1,y1\),\(x2,y2\),⋯,\(xn,yn\)\}\\\{\(x\_\{1\},y\_\{1\}\),\(x\_\{2\},y\_\{2\}\),\\cdots,\(x\_\{n\},y\_\{n\}\)\\\}that:
1. \(1\)No Overlap: For any two distinct macrosmi,mj∈Mm\_\{i\},m\_\{j\}\\in M, there is no overlap between them, as depicted in[Equation3](https://arxiv.org/html/2608.24946#S2.E3)\. \(3\)\[xi,xi\+wi\]×\[yi,yi\+hi\]∩\[xj,xj\+wj\]×\[yj,yj\+hj\]=∅,\\left\[x\_\{i\},x\_\{i\}\+w\_\{i\}\\right\]\\times\\left\[y\_\{i\},y\_\{i\}\+h\_\{i\}\\right\]\\cap\\left\[x\_\{j\},x\_\{j\}\+w\_\{j\}\\right\]\\times\\left\[y\_\{j\},y\_\{j\}\+h\_\{j\}\\right\]=\\varnothing,
2. \(2\)Minimum Displacement: Minimize the total Manhattan displacement of all macros\. The displacement ofmim\_\{i\}is\|xi′−xi\|\+\|yi′−yi\|\|x\_\{i\}^\{\\prime\}\-x\_\{i\}\|\+\|y\_\{i\}^\{\\prime\}\-y\_\{i\}\|, so the displacement objective is \(4\)min∑i=1n\(\|xi′−xi\|\+\|yi′−yi\|\),\\min\\sum\_\{i=1\}^\{n\}\\left\(\|x\_\{i\}^\{\\prime\}\-x\_\{i\}\|\+\|y\_\{i\}^\{\\prime\}\-y\_\{i\}\|\\right\),
3. \(3\)Maximum Regularity: Regularity indexRRis quantified by the channel ratio metric\. For a macro placement,RRis defined as: \(5\)R=CminCactual,R=\\frac\{C\_\{\\text\{min\}\}\}\{C\_\{\\text\{actual\}\}\},whereCminC\_\{\\text\{min\}\}refers to the theoretical minimum number of channels andCactualC\_\{\\text\{actual\}\}is the actual number of channels\. Channel Counting Method:To computeCactualC\_\{\\text\{actual\}\}in practice, we employ a Hanan\-grid\-based procedure\. First, we collect allxx\- andyy\-coordinates of every macro vertex and construct a Hanan grid, i\.e\., a rectilinear grid whose lines pass through every macro boundary\. Each grid cell occupied by a macro is marked asoccupied; the remaining cells areempty\. We then iteratively merge adjacent empty cells into maximal rectangular strips: vertically adjacent empty cells sharing the same width are merged, and horizontally adjacent empty cells sharing the same height are merged\. An empty cell at a channel crossing point may participate in merges in both directions simultaneously \(i\.e\., it is shared by multiple strips rather than consumed by one\)\. The merging repeats until no further merges are possible, and the number of resulting merged strips equalsCactualC\_\{\\text\{actual\}\}\. This method naturally handles general layouts: more irregular placements produce more fragmented strips, yielding higherCactualC\_\{\\text\{actual\}\}and thus lower regularity indexRR\.
## 3\.Algorithm Design
### 3\.1\.Overview of MacroAgent
Our proposed macro legalization consists of four principal components: size\-aware distance\-based clustering, regularity\-aware contour generation, template\-based macro matching, and inter\-cluster refinement\. We identify regularity\-aware contour generation as the most influential component, as it directly enables macros within a cluster to be arranged in a highly regular configuration\. We employ an LLM agent to optimize this critical component\. This choice follows the LLM\-based algorithm discovery paradigm\([35](https://arxiv.org/html/2608.24946#bib.bib21);[31](https://arxiv.org/html/2608.24946#bib.bib1)\), which requires an automated evaluator for the iterative generate\-evaluate loop\. Matching already admits an optimal solution via the Hungarian algorithm, leaving no room for improvement\. Clustering lacks a direct quality metric: its output can only be assessed after running the downstream pipeline, whose key component \(contour generation\) is itself heuristic\. This makes the end\-to\-end result quality unreliable and creates a credit assignment problem that hinders LLM optimization\. In contrast, contour generation’s immediate downstream is matching, which is optimally solved by the Hungarian algorithm; therefore, the result quality of a contour algorithm can be evaluated directly and reliably via regularity and displacement metrics\.
Overview\.The cluster step determines which macros are suitable for regular placement\. The use of regularity\-aware contour generation helps achieve regularity and diverse regular patterns for robustness; template\-based macro matching can minimize displacements; and inter\-cluster refinement further ensures no overlap — all of these techniques working together to generate high\-quality macro legalization results\.
### 3\.2\.Size\-Aware Distance\-Based Clustering
Consistent with prior research, we first cluster macros\. Previous approaches usually determine clustering by macro dimensions, interconnection relationships, positions in the placement prototype, or hierarchical associations\([8](https://arxiv.org/html/2608.24946#bib.bib27);[23](https://arxiv.org/html/2608.24946#bib.bib29);[21](https://arxiv.org/html/2608.24946#bib.bib25);[22](https://arxiv.org/html/2608.24946#bib.bib24)\)\. Our clustering method simplifies this by considering only macro dimensions and positions in the placement prototype, as interconnection relationships were partly accounted for in the mixed\-size global placement stage\. Since many similar heuristic algorithms have been proposed before, we utilize established methods instead of LLM\-based approaches for this algorithm design\.
Algorithm 1Size\-Aware Distance\-Based Macro Clustering\.1:Macro set
ℳ\\mathcal\{M\}, size grouping factor
α\\alpha, proximity factor
β\\beta
2:Assignment of macros to clusters
3:
clusterID←0clusterID\\leftarrow 0;
4:Size grouping:
groups←groups\\leftarrowgroup macros by size using
α\\alpha;
5:foreach size group
g∈groupsg\\in groupsdo
6:construct KD\-tree from macro center points;
7:foreach unvisited macro
m∈gm\\in gdo
8:
current←clusterIDcurrent\\leftarrow clusterIDthen increment
clusterIDclusterID;
9:BFS traversal of neighboring macros;
10:For current macro
mcm\_\{c\}, calculate
Tx=w\(mc\)⋅βT\_\{x\}=w\(m\_\{c\}\)\\cdot\\beta,
Ty=h\(mc\)⋅βT\_\{y\}=h\(m\_\{c\}\)\\cdot\\beta;
11:Find all macros within horizontal distance
TxT\_\{x\}and vertical distance
TyT\_\{y\};
12:Assign them to
currentcurrentand continue traversal;
13:endfor
14:endfor
[Algorithm1](https://arxiv.org/html/2608.24946#alg1)comprises two procedures: dimensional classification and spatial clustering\. The algorithm first utilizes parameterα\\alphato partition macros based on dimensional similarity\. Dividing the macro width and height byα\\alpha, yields dimension identifiers, which are then used to group macros with close dimensions\. Subsequently, within each dimensional group, the algorithm employs parameterβ\\betain conjunction with a KD\-tree to perform proximity\-based clustering\. In our experiments, we fixα=10\\alpha=10andβ=1\.5\\beta=1\.5\. Specifically,α=10\\alpha=10means that we treat macros’ size difference less than 10 site width as the same size \(as DREAMPlace scales site width to 1\)\.β=1\.5\\beta=1\.5means that we consider macros with a distance less than 1\.5 times their respective sizes as neighboring macros\. In pilot trials on the easy cases, we observed that modest variations around these values only lead to slight changes in cluster granularity\. Notably, we implement adaptive proximity thresholds \(TxT\_\{x\}andTyT\_\{y\}\) that are proportional to macro’s dimension sizes, enabling larger macros to have expanded search domains\. In comparison, smaller macros maintain narrower search scopes\. This clustering efficiently aggregates macros with similar dimensions and spatial proximity into clusters\. Note thatα\\alphaserves solely as a grouping granularity for this clustering stage; once clusters are formed, all subsequent stages—contour generation \([Section3\.3](https://arxiv.org/html/2608.24946#S3.SS3)\), template generation, and macro matching—operate on the original, unscaled macro dimensions\. Likewise, the regularity metricRRin[Equation5](https://arxiv.org/html/2608.24946#S2.E5)and channel counting are evaluated using the actual macro sizes and legalized positions\.
### 3\.3\.Regularity\-Aware Contour Generation
Regularity\-aware contour generation is the key step to achieve high regularity while minimizing displacement\. Previous research tends to place the clustered macros in a rectangular formation\([23](https://arxiv.org/html/2608.24946#bib.bib29);[21](https://arxiv.org/html/2608.24946#bib.bib25);[22](https://arxiv.org/html/2608.24946#bib.bib24)\)\. In other words, the contour of the macro cluster is a rectangle, as it is the simplest regular shape\. However, our empirical observations reveal that many macro clusters after mixed\-size placement exhibit contours that deviate significantly from rectangular shapes as shown in top\-left figure in[Figure4](https://arxiv.org/html/2608.24946#S3.F4)\. Enforcing rectangular arrangements of macro clusters often results in displacement\-induced degradation of design quality\. Consequently, we propose generating diverse regularity\-aware contours based on the outline morphology of macro clusters after mixed\-size placement\. The regularity part of contour algorithms lies in the removal of some burrs on the contour, as shown in[Figure4](https://arxiv.org/html/2608.24946#S3.F4)\. The fewer burrs, the better the regularity, but the worse the displacement\.We compare the manual designed rectangle contour heuristic with LLM\-designed contour generation heuristics in the experiments[Figure13](https://arxiv.org/html/2608.24946#S5.F13)to prove that LLM\-designed methods can achieve better design quality\.
\(\(a\)\)Initial
\(\(b\)\)Grid
\(\(c\)\)Alpha shape
\(\(d\)\)MST
\(\(e\)\)Initial
\(\(f\)\)Grid
\(\(g\)\)Alpha shape
\(\(h\)\)MST
Figure 4\.Visualizations of different contour algorithms inAriane133: \(top row\) contour visualization and \(bottom row\) layout after standard\-cell placement \(red for macros; blue for standard cells\)\. From left to right, regularity decreases, but displacement improves\. Initial is for original global placement outputs, and Grid, Alpha shape, and MST are for different legalization results\.Necessity of Multiple Contours\.\. The reason for diverse contours is that regularity and displacement are conflicting, so we need to trade them off; furthermore, there are no direct analytical solutions to guide this trade\-off \(only evident after standard\-cell placement\)\. We here present the results ofAriane133under different contours\.[Figure4](https://arxiv.org/html/2608.24946#S3.F4)shows the three macro legalization results generated forAriane133\. The picture on the far left is the result of an initial mixed\-size placement\. The three pictures on the right are the results generated by three different contour algorithms, respectively\. Smoothing contour burrs improves the channel metric \(higher regularity\) but typically increases macro displacement; different contours \(Grid, Alpha\-shape, MST\) realize different points on this trade\-off frontier\.
Figure 5\.LLM agent\-based contour algorithm generation flow\. Key components: \(1\)Input Prompt:Contains task description, metrics \(regularity, displacement\), previous ideas/code, evolution directive \(E1/E2/M1/M2/M3\), and reference solutions; \(2\)LLM Agent:Processes the prompt and generates new algorithm ideas and executable Python code; \(3\)Code Execution:Runs the generated contour algorithm on test cases; \(4\)Evaluation:Computes regularity and displacement metrics, generates visualizations; \(5\)Algorithm Database:Stores successful algorithms that outperform existing ones on any test case; \(6\)Feedback Loop:Results feed back into the next iteration’s prompt to guide further evolution\.Figure 6\.Simplified version of the “initial input prompt” for LLM agent\-based contour algorithm generation\. Main sections: \(1\)Task Description:Defines the contour generation problem and its role in macro legalization; \(2\)Metrics:Specifies regularity \(channel count\) and displacement objectives; \(3\)Previous Ideas:Provides natural\-language descriptions of prior algorithms \(e\.g\., rectangle, convex hull\); \(4\)Previous Code:Shows executable Python implementations of prior algorithms; \(5\)Evolution Strategy:Instructs the LLM on how to modify/improve \(E1: explore diversity, E2: synthesize and innovate, M1: fix weaknesses, M2: tune parameters, M3: simplify\); \(6\)Reference Solutions:Includes manual legalization examples to guide the LLM toward practical solutions\.Figure 7\.Template\-based macro matching\. The process consists of three stages: \(1\) a regularity\-aware contour is generated around the macro cluster; \(2\) a uniform grid template is tiled inside the contour and feasible grid cells are selected; \(3\) macros are assigned to grid positions via the Hungarian algorithm to minimize total displacement\.LLM Agent\-Based Contour Algorithm Generation Flow\.[Figure5](https://arxiv.org/html/2608.24946#S3.F5)demonstrates the end\-to\-end workflow for discovering contour\-generation algorithms with the proposed LLM agent\. Prompts and code are simplified due to page size limits\. Initially, we craft a comprehensive prompt that specifies \(1\) task, \(2\) usage scenario, \(3\) quality metrics \(regularity, displacement\), \(4\) prior ideas/code, \(5\) evolution directive \(one of E1/E2/M1/M2/M3\), \(6\) outcomes, and \(7\) reference manual legalization solutions\. The content of the simplified version of the “initial input prompt” is shown in[Figure6](https://arxiv.org/html/2608.24946#S3.F6)\. At the first initialize round, the “previous idea” is the simplerectangle contourgeneration algorithm: it computes the bounding box of the macro cluster, scales the rectangle to match the cluster’s area, and recenters it on the cluster\.
Specifically, the workflow in[Figure5](https://arxiv.org/html/2608.24946#S3.F5)comprises six key components: \(1\)Input Promptencapsulates the complete problem specification fed to the LLM, including the task description, evaluation metrics, prior algorithm ideas and code, an evolution directive, and reference solutions \(detailed below with[Figure6](https://arxiv.org/html/2608.24946#S3.F6)\); \(2\)LLM Agentreceives the assembled prompt and generates a new algorithm: a natural\-languageideadescribing the heuristic logic, together with an executable Pythoncodeimplementation of the contour generation function; \(3\)Code Executionruns the generated contour algorithm on the macro cluster testcases, producing contour polygons that are subsequently used for template generation and macro matching; \(4\)Evaluationcomputes the regularity metricRRand displacement for each testcase and generates layout visualizations, enabling quantitative comparison against existing algorithms; \(5\)Algorithm Databasearchives every algorithm whose regularity or displacement outperforms all existing entries on at least one testcase, forming a growing Pareto\-front repository; \(6\)Feedback Loopfeeds the evaluation results and the current algorithm database back into the next iteration’s prompt, allowing the LLM to learn from prior successes and failures and progressively refine its designs\.
[Figure6](https://arxiv.org/html/2608.24946#S3.F6)shows a simplified version of the input prompt, which is organized into six sections: \(1\)Task Descriptiondefines the contour generation problem: given a set of macro positions and dimensions within a cluster, produce a closed rectilinear polygon that encloses the macros with appropriate regularity\. \(2\)Metricsspecifies the two optimization objectives: regularity \(measured by the channel count ratioRR\) and displacement \(Manhattan distance from original positions\), establishing the evaluation criteria the LLM must optimize\. \(3\)Previous Ideasprovides natural\-language descriptions of prior contour algorithms \(e\.g\., rectangle bounding box, convex hull, alpha shape\), giving the LLM conceptual building blocks to draw upon or diverge from\. \(4\)Previous Codeincludes the executable Python implementations corresponding to the previous ideas, enabling the LLM to understand concrete implementation patterns and reuse effective code structures\. \(5\)Evolution Strategyinstructs the LLM onhowto modify or improve the previous algorithms using one of five directives adopted from\([26](https://arxiv.org/html/2608.24946#bib.bib19)\)\. Two are exploration strategies: E1 selectsppparent heuristics and asks the LLM to generate a maximally different new heuristic; E2 first summarizes the common ideas behindppparents and then creates a new heuristic that builds on those shared insights yet diverges substantially\. Three are modification strategies: M1 selects a single parent and asks the LLM to diagnose its weaknesses and revise both idea and code; M2 adjusts only the parameters of a single parent while preserving its algorithmic structure; M3 identifies and removes redundant components to simplify the implementation\. \(6\)Reference Solutionsincludes manually crafted macro legalization examples for the testcases, providing the LLM with concrete targets that demonstrate what high\-quality placements look like and guiding it toward practically effective contour shapes\.
Then, we design a generation flow that evolves bothideasandcodevia the agent flow adopted from\([26](https://arxiv.org/html/2608.24946#bib.bib19)\)\. The process jointly optimizesideas\(natural\-language heuristic logic\) andcode\(executable Python functions\) under aninitialize → generate → evaluate → iterateframework: \(1\)Initialize: CreateNNinitial heuristics via the initial input prompt; \(2\)Generate: Until theG\-generationstopping criterion, we apply5 prompt strategiesto produce new candidates per generation\. Previous ideas are sampled probabilistically \(sample number p=5 for E1/E2; p=1 for M1–M3\)\. Prompts combine previousideasandcodeto produce varied outputs across conceptual and implementation domains; \(3\)Evaluate: Evaluate on problem testcases; admit only feasible solutions to the algorithm database; \(4\)Iterate: Sample thepcandidates from the algorithm database to form the next generation; repeat until completion, then output the best heuristics\. We propose five prompt strategies to improve the performance: \(1\)E1 \(exploration\): Generate heuristics maximally different from the five samples to expand diversity; \(2\)E2 \(exploration with synthesis\): First summarize common ideas across the five samples, then propose substantially different heuristics to ensure effective innovation; \(3\)M1 \(structural modification\): Diagnose a single sample’s shortcomings and revise both idea and code to improve performance; \(4\)M2 \(parametric tuning\): Adjust parameters only, preserving the algorithmic structure; \(5\)M3 \(simplification\): Remove redundant code components to improve efficiency\.
To control cost and ensure reproducibility, we adopt a fixed budget:N=10N=10initial heuristics andG=20G=20generations\. These hyperparameters are aligned with the prior work\([26](https://arxiv.org/html/2608.24946#bib.bib19)\)\. The only difference is that here, to control the cost, we only use each prompt strategy once instead ofNNtimes in\([26](https://arxiv.org/html/2608.24946#bib.bib19)\)\. In total, we generateN\+G×5=110N\+G\\times 5=110heuristics\.
We modify the population management strategy in the prior work\([26](https://arxiv.org/html/2608.24946#bib.bib19)\)\. Instead of using a fixed size population, we decide to keep the heuristics if they have better regularity or displacement than existing ones on any testcases\.
We add extra prompts before algorithm idea/code generation\. These prompts make the LLM output structured contents we need\. Usually, the LLM follows the structures \(function signature\) mentioned in the prompts\. If the LLM contradicts the structure we need, we directly discard its output and start next iteration\. Since this rarely happens, this method does not hinder the process\.
### 3\.4\.Template\-Based Macro Matching
After generating regularity\-aware contours, we create templates based on them\. Here, a template refers to a grid structure where each cell in the grid can accommodate a macro\. Utilizing the template naturally leads to regular macro legalization, and our objective is to minimize the displacement\. Matching is a common technique; we adopt a similar template\-based approach as in\([28](https://arxiv.org/html/2608.24946#bib.bib39)\)\. Each cluster is matched separately, and the influence between different clusters is not considered in this step\.
Contour\-based Template Generation\. The template grids are generated based on the bounding box of the contour as follows:
1. \(1\)Grid Cell Generation:We tile the bounding box of the contour with a uniform grid\. Each grid cell has dimensions equal to the maximum macro widthwmaxw\_\{\\max\}and maximum macro heighthmaxh\_\{\\max\}within the cluster, plus half of the minimum channel spacingccon each side, i\.e\., cell size is\(wmax\+c,hmax\+c\)\(w\_\{\\max\}\+c,h\_\{\\max\}\+c\)\. This ensures that when macros are placed at grid positions, they maintain proper spacing\.
2. \(2\)Distance Calculation:For each grid cell center, we compute its signed Euclidean distance to the nearest point on the contour boundary \(using shapely library\)\. A negative distance indicates the cell center is inside the contour; a positive distance indicates it is outside\.
3. \(3\)Grid Selection:We rank all grid cells by their signed distance \(from most negative to most positive\) and select the top\-kkcells, wherekkequalsnn, the number of macros in the cluster\. This preferentially selects cells inside or near the contour boundary, allowing some flexibility to accommodate macros slightly outside the contour if needed\.
4. \(4\)Feasibility Filtering:We discard any grid position that would cause a macro to violate die\-area boundaries or overlap fixed obstacles\.
Note thatkkandnnin the assignment problem formulation refer to the same quantity: the number of macros in the cluster to be legalized\.
Macro\-to\-Grid Assignment\. We see legalizing macros to the template grids while minimizing the displacement as an assignment problem on a bipartite graph, where nodes on one side represent all macros in the cluster, and nodes on the other side represent available grid positions in the template\. For each macro\-grid position pair, we define the edge weight as the Manhattan distance from the macro’s initial position to the grid position\. We formulate this as a linear assignment problem:
\(6\)min∑m,gcm,g⋅xm,gs\.t\.∑j=1nxij=1,∀i∈\{1,2,…,n\}∑i=1nxij=1,∀j∈\{1,2,…,n\}xij∈\{0,1\},∀i,j∈\{1,2,…,n\}\\begin\{array\}\[\]\{rll\}\\min&\\lx@intercol\\displaystyle\\sum\_\{m,g\}c\_\{m,g\}\\cdot x\_\{m,g\}\\hfil\\lx@intercol\\\\\[12\.0pt\] \\text\{s\.t\.\}&\\displaystyle\\sum\_\{j=1\}^\{n\}x\_\{ij\}=1,&\\forall i\\in\\\{1,2,\\dots,n\\\}\\\\\[12\.0pt\] &\\displaystyle\\sum\_\{i=1\}^\{n\}x\_\{ij\}=1,&\\forall j\\in\\\{1,2,\\dots,n\\\}\\\\\[12\.0pt\] &x\_\{ij\}\\in\\\{0,1\\\},&\\forall i,j\\in\\\{1,2,\\dots,n\\\}\\end\{array\}wherecm,gc\_\{m,g\}is the Manhattan distance from the macro’smminitial position to the grid positiongg,xm,gx\_\{m,g\}is the assignment variable\. By solving this linear assignment problem, we obtain an optimal macro\-to\-grid assignment that minimizes total displacement\. We employ the Hungarian algorithm to solve it\.
The whole flow for template\-based macro matching is shown in[Figure7](https://arxiv.org/html/2608.24946#S3.F7)\. Consider the initial macro placement solution generated by mixed\-size placement\. First, we use the LLM Agent\-generated contour algorithm to generate various contours\. Subsequently, our designed template generation algorithm produces a template grid based on these contours\. Then, the linear assignment problem is solved to assign macros to grids\. Finally, multiple macro placement results are generated for each cluster\. Here, if only one solution is needed, we can choose the solution with the smallest displacement or the one with the greatest regularity\. In our experiments, we chose the solution with the smallest displacement, since it is hard to characterize the trade\-off between regularity and displacement\. However, the results generated by MacroAgent already improve the regularity of the initial mixed\-size placement a lot\. Since LLM can efficiently find a lot of heuristics to fit the real macro legalization testcases, we can obtain an exponential number of solutions for the overall legalization through combination\. In the experiment, by sorting the displacements of candidates in each cluster, we quickly identified the global macro legalization candidates \(after intra\-cluster legalization\) with the top K smallest displacements\. Thismultiple solution capability can increase the robustness of legalization\(find a legal macro legalization\)\.
### 3\.5\.Inter\-Cluster Refinement
Since each cluster is optimized independently by the LLM to maximize local regularity, the resulting contours may overlap with neighboring clusters\. The Inter\-Cluster Refinement stage[Equation7](https://arxiv.org/html/2608.24946#S3.E7)is specifically designed to resolve these global conflicts while strictly preserving the internal relative positions \(regularity\) achieved by the LLM in each cluster\.
Our approach adapts the traditional constraint graph formulation\([11](https://arxiv.org/html/2608.24946#bib.bib32)\)to handle clusters with irregular shapes\.
\(7\)min‖𝒙−𝒙′‖1\+‖𝒚−𝒚′‖1s\.t\.xi\+wi≤xj,∀eij∈Gxyi\+hi≤yj,∀eij∈GyWl≤xi≤Wh−wiHl≤yi≤Hh−hixaik−xajk=xaik′−xajk′,∀aik,ajk∈Ck\\begin\{array\}\[\]\{rll\}\\min&\\lx@intercol\\displaystyle\\left\\\|\\bm\{x\}\-\\bm\{x\}^\{\\prime\}\\right\\\|\_\{1\}\+\\left\\\|\\bm\{y\}\-\\bm\{y\}^\{\\prime\}\\right\\\|\_\{1\}\\hfil\\lx@intercol\\\\\[3\.0pt\] \\text\{s\.t\.\}&\\displaystyle x\_\{i\}\+w\_\{i\}\\leq x\_\{j\},&\\forall e\_\{ij\}\\in G\_\{x\}\\\\\[3\.0pt\] &\\displaystyle y\_\{i\}\+h\_\{i\}\\leq y\_\{j\},&\\forall e\_\{ij\}\\in G\_\{y\}\\\\\[3\.0pt\] &\\lx@intercol\\displaystyle W\_\{l\}\\leq x\_\{i\}\\leq W\_\{h\}\-w\_\{i\}\\hfil\\lx@intercol\\\\\[3\.0pt\] &\\lx@intercol\\displaystyle H\_\{l\}\\leq y\_\{i\}\\leq H\_\{h\}\-h\_\{i\}\\hfil\\lx@intercol\\\\\[3\.0pt\] &\\displaystyle x\_\{a\_\{i\}^\{k\}\}\-x\_\{a\_\{j\}^\{k\}\}=x\_\{a\_\{i\}^\{k\}\}^\{\\prime\}\-x\_\{a\_\{j\}^\{k\}\}^\{\\prime\},&\\forall a\_\{i\}^\{k\},a\_\{j\}^\{k\}\\in\{C\}^\{k\}\\end\{array\}
As shown in[Equation7](https://arxiv.org/html/2608.24946#S3.E7), we formulate a linear programming \(LP\) problem that minimizes the total displacement‖𝒙−𝒙′‖1\+‖𝒚−𝒚′‖1\\\|\\bm\{x\}\-\\bm\{x\}^\{\\prime\}\\\|\_\{1\}\+\\\|\\bm\{y\}\-\\bm\{y\}^\{\\prime\}\\\|\_\{1\}between the original positions\(𝒙′,𝒚′\)\(\\bm\{x\}^\{\\prime\},\\bm\{y\}^\{\\prime\}\)and the legalized positions\(𝒙,𝒚\)\(\\bm\{x\},\\bm\{y\}\)\. The first and second constraints enforce non\-overlapping conditions through horizontal and vertical constraint graphsGxG\_\{x\}andGyG\_\{y\}, while the third and fourth constraints ensure that all macros remain within the placement boundaries \(WlW\_\{l\}for x coordinate of lower left point,WhW\_\{h\}for x coordinate of upper right point,HlH\_\{l\}for y coordinate of lower left point,HhH\_\{h\}for y coordinate of upper right point\)\. The only difference with\([11](https://arxiv.org/html/2608.24946#bib.bib32)\)is the last constraintxaik−xajk=xaik′−xajk′x\_\{a\_\{i\}^\{k\}\}\-x\_\{a\_\{j\}^\{k\}\}=x\_\{a\_\{i\}^\{k\}\}^\{\\prime\}\-x\_\{a\_\{j\}^\{k\}\}^\{\\prime\}preserves the relative positioning of macros within the same clusterCk\{C^\{k\}\}, thus maintaining the regularity\.
For scenarios where the linear programming approach fails to solve \(due to extra constraints\), we employ DREAMPlace’s default heuristic algorithms\([24](https://arxiv.org/html/2608.24946#bib.bib35)\)as a fallback mechanism\. Although this approach may compromise the achieved regularity, it provides an efficient solution for resolving overlaps in practice\.
## 4\.Implementation Details
The macro legalization algorithm was implemented in Python\. This was due to LLMs’ generally better performance with interpreted languages like Python\.
We leverage cursor, Cua\([7](https://arxiv.org/html/2608.24946#bib.bib41)\)and pyautogui for constructing the Agent workflow\. Cursor is a general AI agent editor, and Cua and pyautogui are used to simulate the mouse and keyboard to control the cursor editor to automate the flow\. We use Cua and pyautogui to program the fixed flow\. We install thesequential thinking,memory, andcontext7mcp in the cursor, endowing the agent with capabilities of thinking, searching and memory\. After seeding the template prompt, the agent runs fully automatically: Cursor orchestrates file edits and execution; Cua and pyautogui drive the UI; failure handling \(signature mismatch, runtime error, invalid shape\) is automated via the corresponding validators\. No human edits are applied to candidate code during the search\.
We prioritized models that reliably follow structured code\-generation instructions and produce long, compositional functions with few syntax errors—key requirements for agentic code generation \(see[Section2\.1](https://arxiv.org/html/2608.24946#S2.SS1)\)\. In our budgeted setting, Claude 4\.0 Sonnet \(Thinking, Max\) best satisfied these criteria\. We also spot\-checked Gemini 2\.5 Pro and GPT 5 and observed comparable adherence to the prompt scaffolding; a smaller 30\-40B\-class model struggled with syntax/structure\. A formal cross\-model benchmark is valuable but outside our scope; we therefore document the budgeted agent setting\. The macro legalization source code is publicly available at[https://github\.com/gilgamsh/MacroAgent](https://github.com/gilgamsh/MacroAgent); the LLM prompts and agent scripts will be released in the same repository upon acceptance to facilitate reproduction and cross\-model comparisons\.
## 5\.Experiment
### 5\.1\.Experiment Setup
Baseline Selection\. DREAMPlace default macro legalization\([24](https://arxiv.org/html/2608.24946#bib.bib35)\)served as the primary baseline method, utilizing heuristic algorithms and constraint graph techniques for macro legalization\. Additionally, the sequence pair method presented in\([11](https://arxiv.org/html/2608.24946#bib.bib32)\)is also included; it uses the sequence pair method and simulated annealing to enhance the robustness of macro legalization\. Neither of these baseline algorithms explicitly incorporates macro regularity and typically relies on only one or two heuristics\.
We distinguish the scope of macro legalization from macro placement\. While most prior macro placement works focus on optimizing rough locations that allow minor overlaps\([23](https://arxiv.org/html/2608.24946#bib.bib29);[2](https://arxiv.org/html/2608.24946#bib.bib8);[33](https://arxiv.org/html/2608.24946#bib.bib31);[11](https://arxiv.org/html/2608.24946#bib.bib32);[39](https://arxiv.org/html/2608.24946#bib.bib26);[20](https://arxiv.org/html/2608.24946#bib.bib34);[34](https://arxiv.org/html/2608.24946#bib.bib28)\), and rely on a macro legalizer to resolve overlaps, MacroAgent operates as a downstream refinement framework designed to resolve overlaps and improve regularity of existing placements\. Therefore, comparing MacroAgent directly with mixed\-size global placement\-based macro placement tools \(which generate the inputs for our system\) is methodologically inconsistent\. Our work is orthogonal to prior macro placement works and can be integrated with them\. Instead, we anchor all methods to the same mixed\-size global placement prototype to isolate legalization effects\. We validate its performance against state\-of\-the\-art legalization and refinement algorithms \(e\.g\., DREAMPlace’s legalization module and sequence pair method in\([11](https://arxiv.org/html/2608.24946#bib.bib32)\)\), ensuring a fair comparison within the same physical design stage\. We also compare with the macro legalization capability of Cadence Innovus, a leading industrial physical design tool\.
Experiment flow\. The experiment workflow starts mixed\-size placement using DREAMPlace 4\.1\([11](https://arxiv.org/html/2608.24946#bib.bib32)\)\. Subsequently, the macro legalization is applied\. Next, we utilize DREAMPlace 4\.1\([11](https://arxiv.org/html/2608.24946#bib.bib32)\)to implement standard cell placement and legalization\. Finally, we operate the HeLEM\-GR\([43](https://arxiv.org/html/2608.24946#bib.bib33)\)for global routing and evaluate the performance of the resulting layout\. We refer to this as the*academic flow*\. We additionally evaluate under an*industrial flow*, where standard cell placement and routing are performed entirely within Cadence Innovus \(detailed in[Section5\.5](https://arxiv.org/html/2608.24946#S5.SS5)\)\.
The experiment was configured on a Linux machine running CentOS 7, equipped with an Intel Xeon Platinum 8358 CPU @ 2\.60GHz, 1TB of RAM, and an NVIDIA A800\-SXM4\-80GB GPU \(CUDA 12\.1\)\. The software environment includes GCC 9\.5\.0 and Python 3\.9\.18\. The proposed macro legalization algorithm exclusively utilizes CPU resources, while GPU resources are leveraged by DREAMPlace and HeLEM\-GR\. Cadence Innovus v22\.10 is used for the industrial baseline comparison and PPA evaluations\. Due to the inherent randomness in sequence pair legalization, we execute the legalization algorithm 20 times with different random seeds\. To ensure fairness, MacroAgent generates at most 20 legalization candidate results that minimize displacements\. \(note that MacroAgent can generate diverse legalization results as needed,multiple solution capability\) For each result, we perform standard cell placement and global routing\. Finally, the result table lists the best wirelength\-based outcomes, along with their corresponding legalization runtime, total runtime, and other relevant metrics \(total 20 times runtime for sequence pair and MacroAgent\)\. To demonstrate the stability of MacroAgent,[Figure8](https://arxiv.org/html/2608.24946#S5.F8)shows the distribution of routed wirelength across all candidate results for each testcase, normalized by the per\-testcase mean\. MacroAgent enumerates candidate solutions in order of increasing displacement, so the resulting variations primarily stem from permutations within small macro clusters, while the placement of large clusters remains stable\. Consequently, testcases with diverse macro types \(e\.g\., Chipyard, 7–12 types\) exhibit particularly tight distributions \(CV<0\.5%<0\.5\\%\), as the dominant clusters are effectively fixed and only minor clusters are permuted\. TILOS testcases with a single macro type show slightly higher yet still modest variation \(CV≈1%\\approx 1\\%–1\.5%1\.5\\%\), because the single\-cluster structure exposes more of the layout to reordering\. Overall, the best\-of\-NNselection introduces negligible cherry\-picking bias\.
Figure 8\.Normalized wirelength distribution of MacroAgent across all candidate results per testcase\.Benchmark\. For benchmarking, the TILOS\([12](https://arxiv.org/html/2608.24946#bib.bib37)\)benchmark was chosen, following the same testcase configuration as\([11](https://arxiv.org/html/2608.24946#bib.bib32)\): Ariane133, Ariane136, and MemPool use the ASAP7 PDK, while BlackParrot and NVDLA use the NanGate45 PDK\. Furthermore, we found that TILOS is an easy benchmark for macro legalization and that all baseline methods can legalize all testcases\. To model more challenging macro legalization scenarios, several macro circuit designs generated via Chipyard\([4](https://arxiv.org/html/2608.24946#bib.bib38)\)\(v1\.9\.1\) with the ASAP7 PDK were also incorporated into the benchmarks\. The statistics of the TILOS and Chipyard testcases are shown in[Table1](https://arxiv.org/html/2608.24946#S5.T1)and[Table2](https://arxiv.org/html/2608.24946#S5.T2)\.\#macro\\\#\\text\{macro\}is the number of macros,\#types\\\#\\text\{types\},\#inst\\\#\\text\{inst\}, and\#net\\\#\\text\{net\}denote the number of macro types, the number of instances, and the number of nets\.We can see that the Chipyard testcases are more challenging, having more macros and a wider range of macro types\.
Table 1\.Benchmark statistics of TILOS testcases \(easy\)\.Table 2\.Benchmark statistics of Chipyard testcases \(hard\)\.Table 3\.Results on TILOS \(academic flow: DREAMPlace \+ HeLEM\-GR\): regularity, routed wirelength, congestion \(%\) and runtime \(s, sum of 20 runs\)\. S \(Status\) shows if failed to legalize\.TestcaseDREAMPlace\([24](https://arxiv.org/html/2608.24946#bib.bib35)\)Sequence Pair\([11](https://arxiv.org/html/2608.24946#bib.bib32)\)MacroAgentSRegLTWLConTTSRegLTWLConTTSRegLTWLConTTAriane133✓\\checkmark0\.130\.0048\.69E080\.0359\.2✓\\checkmark0\.1638\.6258\.51E080\.23376\.7✓\\checkmark0\.671\.5707\.62E080\.07130\.9Ariane136✓\\checkmark0\.130\.0058\.37E080\.0290\.1✓\\checkmark0\.1893\.6528\.44E080\.00576\.9✓\\checkmark0\.591\.5608\.35E080\.00188\.4MemPool✓\\checkmark0\.130\.0017\.46E080\.7785\.0✓\\checkmark0\.131\.0777\.44E080\.48557\.4✓\\checkmark0\.351\.0506\.80E080\.39501\.6BlackParrot✓\\checkmark0\.060\.0089\.10E103\.90503\.7✓\\checkmark0\.06254\.2129\.05E103\.413930\.7✓\\checkmark0\.135\.5509\.19E104\.283850\.2NVDLA✓\\checkmark0\.080\.0042\.46E104\.58105\.5✓\\checkmark0\.0887\.2722\.42E104\.12791\.2✓\\checkmark0\.643\.4702\.36E104\.23329\.2Ratio1\.001\.001\.001\.001\.001\.1216611\.630\.992\.016\.934\.51663\.150\.950\.974\.19
Table 4\.Results on Chipyard \(academic flow: DREAMPlace \+ HeLEM\-GR\): regularity, routed wirelength, congestion \(%\) and runtime \(s, sum of 20 runs\)\. S \(Status\) shows if failed to legalize\.TestcaseDREAMPlace\([24](https://arxiv.org/html/2608.24946#bib.bib35)\)Sequence Pair\([11](https://arxiv.org/html/2608.24946#bib.bib32)\)MacroAgentSRegLTWLConTTSRegLTWLConTTSRegLTWLConTTfft×\\times0\.090\.0043\.16E100\.33111\.3×\\times0\.092\.5763\.16E100\.34623\.7✓\\checkmark0\.342\.7403\.50E100\.56656\.7hwaka×\\times0\.060\.0158\.40E100\.29357\.5✓\\checkmark0\.06535\.6778\.38E100\.322442\.0✓\\checkmark0\.146\.4408\.50E100\.292199\.8gemmini✓\\checkmark0\.050\.0291\.10E110\.14354\.5✓\\checkmark0\.05413\.4451\.10E110\.142202\.9✓\\checkmark0\.2014\.6301\.07E110\.132236\.5dsboom✓\\checkmark0\.050\.0197\.89E100\.11533\.8✓\\checkmark0\.05409\.5777\.89E100\.122404\.7✓\\checkmark0\.159\.1107\.62E100\.182472\.8rocket×\\times0\.100\.0063\.07E100\.16862\.1✓\\checkmark0\.101\.9223\.36E100\.16862\.1✓\\checkmark0\.262\.8202\.87E100\.11928\.3
### 5\.2\.Prompt Design
To enhance reproducibility,[Figure9](https://arxiv.org/html/2608.24946#S5.F9)presents a complete E2 \(exploration with synthesis\) prompt example used in the contour algorithm discovery\. The prompt is organized into the six sections described in[Section3](https://arxiv.org/html/2608.24946#S3): task description, context with previous results, evolution directive, usage scenario, quality metrics, and input references\. Slot variables \(shown in braces\) are automatically populated from the algorithm database at each generation\. We choose E2 as the representative example because it is the most comprehensive strategy, requiring the LLM to first summarize common ideas across five parent algorithms and then synthesize a substantially different new heuristic\. Thehighlightedevolution directive is the only section that differs across the five strategies \(E1/E2/M1–M3\); all other sections remain identical across strategies\.
E2 Prompt Example for Contour Algorithm Generation\#\# Task Design and implement a contour generation algorithm that, given a cluster of macros, produces a closed polygon enclosing them\. The algorithm must be implemented as a Python function with the following signature: def generate\_contour\(corners: list\[tuple\], centers: list\[tuple\], polygons: List\[Polygon\]\) \-\> Polygon wherecornersis a list of \(x,y\) coordinates of all macro corners in the cluster,centersis a list of \(x,y\) coordinates of macro centers,polygonsis a list of ShapelyPolygonobjects representing each macro’s bounding box, and the return value is a ShapelyPolygon\. \#\# Context Previous method ideas:\{ideas\} Previous results:\{displacement\},\{regularity\_index\},\{solutions\}and\{visualization\} Evolution Directive \[E2\]:I have 5 existing contour generation algorithms with their ideas and codes as follows: No\.1 Idea: Compute alpha shape using Delaunay triangulation with adaptive circumradius filtering… Code:def generate\_contour\(corners, centers, \.\.\.\): \.\.\. … No\.5 Idea: Grid\-based rectilinear boundary tracing with density\-aware cell merging… Code:def generate\_contour\(corners, centers, \.\.\.\): \.\.\. Please help me create a new contour algorithm that is different from the given ones but can be motivated by them\. Firstly,identify the common idea in the provided algorithms\. Secondly,based on the backbone idea, describe your new algorithm in one sentence\. Thirdly,implement it as a Python function namedgenerate\_contourfollowing the signature defined above\. \#\# Usage Scenario In the MacroAgent framework, the generated contour serves as the boundary for template generation: the contour polygon is converted into a rectilinear template that defines legal macro slots, and the Hungarian algorithm then assigns macros to these slots to minimize displacement\. A contour that closely follows the original macro arrangement preserves macro positions and reduces displacement, while a contour with fewer concavities produces a more regular template with fewer channels\. These two objectives often conflict, and the contour algorithm must balance them\. The contour algorithm is therefore the key heuristic component whose quality directly determines the downstream legalization result\. \#\# Quality Metrics Regularity: measured by the channel count ratioR=Cmin/CactualR=C\_\{\\min\}/C\_\{\\text\{actual\}\}, whereCminC\_\{\\min\}is the theoretical minimum number of channels for a perfect grid arrangement andCactualC\_\{\\text\{actual\}\}is the actual channel count computed from the Hanan grid\.R∈\(0,1\]R\\in\(0,1\]; higher is better \(R=1R=1means a perfect regular array\)\. Displacement: total Manhattan distance∑i\(\|xi−xi′\|\+\|yi−yi′\|\)\\sum\_\{i\}\(\|x\_\{i\}\-x\_\{i\}^\{\\prime\}\|\+\|y\_\{i\}\-y\_\{i\}^\{\\prime\}\|\)between each macro’s legalized position\(xi,yi\)\(x\_\{i\},y\_\{i\}\)and its original placement position\(xi′,yi′\)\(x\_\{i\}^\{\\prime\},y\_\{i\}^\{\\prime\}\); lower is better\. \#\# Input and Reference \{test case files and reference legalization visualizations\}
Figure 9\.Complete E2 \(exploration with synthesis\) prompt example for contour algorithm generation\. Thehighlightedevolution directive section is the only part that differs across the five strategies \(E1/E2/M1–M3\); all other sections remain identical\. Slot variables \(in braces\) are populated from the algorithm database at each generation\.
### 5\.3\.Agent Discovered Contour Algorithms
We use the easy TILOS testcases to generate the contour algorithms, and the hard Chipyard testcases to test thegeneralization abilityof the contour algorithm we discovered\. Meanwhile, we extract the single\-cluster testcases decomposed from TILOS testcases to simplify the problem instance input to the LLM\. The LLM\-driven algorithm optimization finishes in one day, showing significant efficiency gains versus researchers’ development time\. The discovery run is an offline, one\-time search\. Among the 110 generated candidates, only 8 algorithms remain in the final database because they improve either displacement or regularity on at least one testcase; the rest are discarded during screening\. Notably, nearly all candidates are executable and produce valid results\. This confirms that our domain\-agnostic abstraction effectively reduces the problem to pure geometry reasoning, which is well within the LLM’s capability\.
In the initialization stage, the LLM generatesN=10N=10diverse contour heuristics from scratch based solely on the input prompt, without any hand\-crafted algorithm design\. These heuristics span four broad geometric strategy families: triangulation\-based \(Items 1, 2, 5\), graph\-based \(Items 4, 10\), density/field\-based \(Items 6, 7, 8\), and grid/scanline\-based \(Items 3, 9\):
1. \(1\)Alpha Shape— adaptive Delaunay triangulation with circumradius filtering\.
2. \(2\)kNN Concave Hull— locally adaptive concave boundary via kNN density estimation\.
3. \(3\)Grid\-Based— occupancy grid dilation with convex hull extraction\.
4. \(4\)MST— buffered minimum spanning tree of macro centers\.
5. \(5\)Corner\-Preserving Alpha— alpha shape augmented with macro corner points\.
6. \(6\)KDE Contour— Gaussian kernel density iso\-contour extraction\.
7. \(7\)Voronoi Clip— Voronoi cells clipped by local neighborhood radius\.
8. \(8\)Relative Position— kNN\-biased alpha shape preserving local structure\.
9. \(9\)Rectilinear Boundary Tracing— scanline\-based orthogonal interval merging\.
10. \(10\)Manhattan Distance Hull—L1L\_\{1\}\-weighted MST with axis\-aligned buffering\.
Detailed implementation is available at[https://github\.com/gilgamsh/MacroAgent](https://github.com/gilgamsh/MacroAgent)\. This diversity of geometric primitives ensures that the initial population covers a wide region of the algorithm design space, providing a broad foundation for the subsequent evolutionary search\.
At test time, each cluster generates 8 candidate legalization results; we can directly find the potential minimum displacement legalization result by combining all clusters’ minimum displacement results\. By exploiting the multiple\-solution capability, we can find the global macro legalization candidates with the top K smallest displacements\. Note that here the displacement is just an estimation, and we still need to perform inter\-cluster refinement to get the final legalization result\.
As shown in[Table3](https://arxiv.org/html/2608.24946#S5.T3)and[Table4](https://arxiv.org/html/2608.24946#S5.T4), MacroAgent outperforms the baselines on both benchmarks \(especially on test benchmark Chipyard\), showing the generalization ability of the contour algorithms we discovered\.
Figure 10\.Selected LLM\-designed Contour Algorithms \(simplified\)\. Simplified pseudocode of three representative contour generation algorithms discovered by the LLM agent: Alpha Shape \(concave boundary via Delaunay triangulation\), Grid\-Based \(occupancy grid with dilation and convex hull\), and MST\-Based \(minimum spanning tree with buffer expansion\)\.Here, we analyze some of the contour algorithms LLM discovered as shown in[Figure10](https://arxiv.org/html/2608.24946#S5.F10)\.
Alpha Shape:generates the contour as follows: \(1\) collect corner and center points of all macros; \(2\) perform Delaunay triangulation on these points; \(3\) for each triangle, compute its circumradius; \(4\) discard triangles whose circumradius exceeds an adaptive threshold—a large circumradius indicates an elongated, non\-compact triangle that likely spans empty space between macros; \(5\) merge the remaining compact triangles to form the contour\. This yields a tighter, concave boundary as shown in the third figure in[Figure4](https://arxiv.org/html/2608.24946#S3.F4)\.
Grid Based:generates the contour as follows: \(1\) compute the bounding box of all macros and partition it into anN×NN\\times Nuniform grid; \(2\) for each grid cell, test whether its center point lies inside any macro polygon and mark it as occupied if so; \(3\) dilate the occupied cells by marking the eight immediate neighbors of every occupied cell; \(4\) extract the four corner vertices of every marked cell and compute the convex hull; \(5\) apply light post\-processing to obtain the final contour\. Since it is based on a grid structure, it produces more regular contours than the other algorithms, as shown in the second figure in[Figure4](https://arxiv.org/html/2608.24946#S3.F4)\.
MST \(minimum\-spanning tree\):generates the contour as follows: \(1\) construct a complete graph on macro centers with Euclidean edge weights; \(2\) compute the minimum spanning tree \(MST\); \(3\) convert MST edges into line segments and apply a buffer to the segment set; \(4\) union the buffered region with all macro polygons to obtain the final contour\. This method naturally fits the outline of the original macros, with only a simple effect of smoothing the boundaries, as shown in the last figure in[Figure4](https://arxiv.org/html/2608.24946#S3.F4)\.
From the above analysis, we can see that the LLM designed contour algorithms can achieve different trade\-offs between regularity and displacement in algorithm level, not only in parameter level\.These algorithms are meaningful and readable\.We also find that with the help of reference manual legalization solutions, LLMs can generate more focused thoughts and modifications\.
Quantitative Diversity Analysis\. To quantitatively evaluate the diversity of the eight LLM\-discovered contour algorithms, we compute the pairwise Intersection\-over\-Union \(IoU\) of the contour polygons generated by each algorithm on a representative testcase \(Ariane133\)\. A lower IoU between two algorithms indicates that they produce geometrically distinct contours, confirming genuine algorithmic diversity rather than minor parametric variations\.[Figure11](https://arxiv.org/html/2608.24946#S5.F11)reports the full8×88\\times 8pairwise IoU matrix\. The average off\-diagonal IoU is0\.710\.71\. Because all contours enclose the same set of macros, a baseline overlap is inherent; the meaningful variation lies in boundary strategies, where the algorithms differ significantly\. Notably,kdeexhibits the lowest average pairwise IoU with all other methods \(0\.480\.48–0\.770\.77\), confirming that it explores a fundamentally different geometric strategy\. While some method pairs share higher similarity \(e\.g\.,mstanddensity\_weightedat0\.940\.94;alpha\_shapeandmstat0\.890\.89\), the eight algorithms span a wide range of contour shapes, which directly enables the multiple\-solution capability described above\.
Figure 11\.Pairwise IoU matrix of eight contour algorithms onAriane133\. Lower off\-diagonal values indicate higher geometric diversity\.
### 5\.4\.Overall Comparisons
Regularity reduces channel count and deadspace, which in turn reduces detours and router effort\. We therefore report routed wirelength and congestion as PPA\-relevant surrogates in our legalization only study\. We list the results of the TILOS and Chipyard testcases in[Table3](https://arxiv.org/html/2608.24946#S5.T3)and[Table4](https://arxiv.org/html/2608.24946#S5.T4)\.SSshows whether the macro legalization is successful\. Reg shows the regularity score of the macro legalization\. LT shows the time of macro legalization\. WL shows the routed wirelength reported by HeLEM\-GR\([43](https://arxiv.org/html/2608.24946#bib.bib33)\)in DREAMPlace internal units\. Con shows the congestion\(%\)\. Regularity \(Reg\) is calculated using the channel\-based metric defined in[Equation2](https://arxiv.org/html/2608.24946#S1.E2), where a score of 1\.0 represents a theoretically perfect square array\. TT shows the total workflow time\(s\) \(sum of 20 runs\), including mixed\-size placement, macro legalization, standard cell placement and legalization, and global routing\.
For the TILOS benchmark, MacroAgent achieves an average 4% improvement in wirelength and reduces congestion in some testcases compared with sequence pair\. Compared with DREAMPlace default macro legalization, MacroAgent delivers a 5% improvement in wirelength and similar congestion\. Beyond standard metrics, the robustness of MacroAgent significantly surpasses other methods, particularly in complex design scenarios\. As evidenced in[Table4](https://arxiv.org/html/2608.24946#S5.T4), the DREAMPlace baseline fails to legalize three out of five Chipyard testcases \(‘fft’, ‘hwaka’, ‘rocket’\), and the Sequence Pair method fails on ‘fft’ despite 20 restart attempts\. These failures typically stem from the limitation of utilizing a single heuristic, which often leads to getting trapped in local optima or failing to resolve dense overlaps in highly constrained regions\. In contrast, MacroAgent leverages a portfolio of diverse LLM\-designed heuristics\. By generating multiple candidate contours and templates for each cluster, our framework effectively avoids the rigidity of single\-algorithm approaches\. This capability ensures design closure even in high\-density cases\.
Furthermore, as shown in[Table5](https://arxiv.org/html/2608.24946#S5.T5), MacroAgent achieves a wirelength improvement of 3% to 5% with similar congestion compared to both DREAMPlace and sequence pair on the common success testcases\. Note that for failed cases \(marked with×\\timesin[Table4](https://arxiv.org/html/2608.24946#S5.T4)\), the reported wirelength and congestion values are obtained by proceeding with the downstream flow despite remaining macro overlaps; these results are not physically valid and are included only for reference—they should not be used for quantitative comparison\.
The legalization efficiency of MacroAgent is higher than sequence pair \(since sequence pair use simulated annealing\), with a runtime on the order of seconds and its time consumption in the full workflow being negligible\.Overall our MacroAgent framework is more robust, effective with better solution quality\.
Table 5\.Metric ratio comparison of MacroAgent and baselines on Chipyard\.
### 5\.5\.PPA Evaluation
To validate the downstream impact of macro legalization on physical design quality, we perform complete place\-and\-route using Cadence Innovus on the TILOS benchmark, where all baseline methods successfully legalize every testcase, enabling a fair PPA comparison\. On Chipyard, baseline failures preclude meaningful PPA comparison\.
Experiment Flow\. After macro legalization, we import the post\-legalization DEF and LEF files into Innovus and runplace\_opt\_designfor standard cell placement and optimization, followed by routing\. We report routed wirelength, WNS \(worst negative slack\), TNS \(total negative slack\), and total power\. For each testcase, we set a target frequency \(i\.e\., the reciprocal of the clock period\) so that WNS falls within 10–20% of the clock period\. A negative WNS means the critical path violates the timing constraint; a more negative value indicates a more severe violation\. A positive WNS indicates that all paths meet timing, with a larger value reflecting more slack margin\. In both cases, a higher WNS is preferable\. TNS aggregates all negative slacks across timing endpoints \(0 if no negative slack\), reflecting the overall timing condition of the design\.
Table 6\.Comparison of post\-route PPA results on TILOS benchmark \(industrial flow: Innovus place\-and\-route\): frequency \(MHz\), routed wirelength \(µm\), WNS \(ns\), TNS \(ns\), and power \(mW\)\.Results Analysis\. As shown in[Table6](https://arxiv.org/html/2608.24946#S5.T6), MacroAgent provides the strongest overall PPA trade\-off among the three methods\. Compared with DREAMPlace, MacroAgent reduces routed wirelength by 2\.9% on average, with the largest improvement onAriane136\(−5\.4%\-5\.4\\%\)\. The improved regularity reduces deadspace between macros, which shortens routing detours and lowers wirelength; the wirelength reduction in turn improves downstream PPA\. This wirelength reduction directly translates into timing improvements: MacroAgent achieves 42\.6% WNS improvement and 68\.3% TNS improvement on average compared with DREAMPlace\. The gains are particularly notable onAriane136andNVDLA, where TNS is reduced by over 90%\. Power consumption remains comparable across all methods, as macro legalization primarily affects interconnect topology rather than cell\-level switching activity\. MacroAgent achieves lower routed wirelength on all five testcases and better overall timing than Sequence Pair \(best WNS on four of five testcases and equal\-best TNS on all five\), with comparable power\.
Comparison with Innovus Macro Placement\. To further evaluate MacroAgent against industrial tools, we construct two controlled flows on the five TILOS testcases\.Flow A \(Innovus baseline\):DREAMPlace initial placement→\\rightarrowInnovus macro refinement viaplace\_design \-concurrent\_macros \-incrementalfollowed byrefine\_macro\_place\(which includes flip optimization\)→\\rightarrowplace\_designfor standard cell placement→\\rightarrowrouting\.Flow B \(MacroAgent \+ Innovus\):DREAMPlace initial placement→\\rightarrowMacroAgent macro legalization→\\rightarrowthe samerefine\_macro\_placeand downstream stages as Flow A\. Both flows share identical Innovus settings and the same downstream pipeline after macro refinement\. Because flip optimization cannot be disabled inrefine\_macro\_placeand significantly affects wirelength, both flows include it\. Therefore, the only controlled variable is the legalized macro placement entering the shared Innovus pipeline, isolating the impact of macro legalization quality on final PPA\.
Table 7\.Comparison with Innovus macro placement on TILOS \(industrial flow: Innovus place\-and\-route\): routed wirelength \(µm\), congestion \(%\), and runtime \(s\)\.As shown in[Table7](https://arxiv.org/html/2608.24946#S5.T7), MacroAgent achieves lower routed wirelength than Innovus on all five testcases, with an average improvement of 1\.8%\. The improvement is most pronounced onAriane133andNVDLA\(both−3\.5%\-3\.5\\%\)\. Since Innovus’s macro placement refinement includes flip optimization, it may further adjust macro positions based on orientation changes—an optimization that can benefit certain testcases\. This explains the congestion advantage of Innovus onBlackParrot\(0\.16%0\.16\\%vs\.0\.29%0\.29\\%\): Innovus’s integrated orientation\-flip refinement effectively reduces routing hotspots\. However, flip optimization does not always help: compared to the results without Innovus refinement in[Table6](https://arxiv.org/html/2608.24946#S5.T6), the wirelength ofAriane136andMemPoolincreases in both flows, suggesting that the orientation changes can degrade placement quality on certain designs\. Despite this, MacroAgent still achieves consistently lower wirelength across all testcases, indicating that its legalization provides a superior starting point that Innovus’s downstream optimization preserves and benefits from\.
### 5\.6\.Analysis and Visualization
To intuitively understand the impact of our MacroAgent legalization, we chooserocketto visualize the results of each legalization method\. The visualization results ofrocketare shown in[Figure12](https://arxiv.org/html/2608.24946#S5.F12)\. Initial shows the layout after mixed\-size placement, which is the input of macro legalization\. We can see that the layout after DREAMPlace macro legalization still has overlaps, which shows that one or two heuristics cannot cover all testcases\. Although sequence pair can resolve the overlaps, the regularity is not satisfactory, resulting in irregular channels, which is harmful to wirelength\. On the last figure, MacroAgent shows that the layout resolves the overlaps, and the regularity is significantly improved\.
\(\(a\)\)Initial
\(\(b\)\)DREAMPlace
\(\(c\)\)Sequence Pair
\(\(d\)\)MacroAgent
Figure 12\.Comparison of different macro legalization methods onrocket: \(a\) initial global placement, \(b\) DREAMPlace legalization with remaining overlaps, \(c\) Sequence Pair legalization with irregular channels, and \(d\) MacroAgent legalization with overlap\-free and regular layout\.135790\.960\.970\.980\.99110\.9740\.970\.9670\.962Number of TemplatesWirelength RatioFigure 13\.The impact of the used contour algorithm number on the average routed wirelength ratio in the TILOS benchmark \(starts with only a rectangle contour\)\.To further demonstrate the effectiveness of LLM\-generated multiple contour algorithms, we present the wirelength ratio \(same configuration with the main experiment\) on the TILOS Benchmark under two scenarios: simply using the rectangle contour algorithm and continuously adding LLM\-generated algorithms\. The x\-axis counts the number of distinct LLM\-designed contour algorithms included in the candidate set \(starting from the rectangle baseline = 1\)\. Each contour induces one template; we then pick the best legalization per cluster via assignment\. We can see that wirelength is improved when multiple LLM\-generated algorithms are used, as shown in[Figure13](https://arxiv.org/html/2608.24946#S5.F13), which shows that LLM\-generated algorithms are better and multiple heuristics can help improve the overall performance\.
### 5\.7\.Discussions
Previous work\([25](https://arxiv.org/html/2608.24946#bib.bib20)\)indicate that LLMs exhibit limitations in both domain\-specific EDA knowledge and large\-scale project handling capabilities, resulting in suboptimal direct code generation\. To address these challenges, we developed a framework that abstracts macro legalization into a geometric problem\. Notably, when generating algorithms for this abstracted problem, LLMs successfully leveraged universal geometric concepts such as alpha shapes, k\-nearest neighbors, and minimum spanning trees, rather than relying on EDA\-specific domain knowledge\. Importantly, our framework employs a general\-purpose, off\-the\-shelf LLM without any domain\-specific fine\-tuning\. Domain\-specific decisions—such as the clustering strategy and the choice of optimization objectives \(regularity and displacement minimization\)—are encoded by human engineers in the framework design, while the LLM operates solely on the abstracted geometric subproblem using its pretrained reasoning capabilities\. This domain\-agnostic approach yielded promising results\.
A traditional automation loop optimizes parameters within a fixed algorithm\. In contrast, the LLM Agent demonstrated the ability to traverse the algorithmic search space, proposing distinct geometric heuristics \(e\.g\., switching from convex hulls to MST\-based contours\) that a parameter\-sweep baseline could not discover\.
Our algorithm enforces regularity solely within intra\-cluster legalization, while the fallback heuristic algorithms for inter\-cluster legalization compromise layout regularity\. Meanwhile, the current LLM Agent\-based algorithm design approach remains limited to generating contour algorithms\. Future research should prioritize advanced regularity\-aware heuristic methodologies for clustering and inter\-cluster optimization\.
## 6\.Conclusion
We introduce MacroAgent, a robust regularity\-aware macro legalization framework utilizing LLM\-agent\-designed contour algorithms\. The framework proceeds through four stages: clustering, regularity\-aware contour generation, template\-based matching, and inter\-cluster refinement\. We abstract the EDA problem of macro legalization into a domain\-agnostic geometric problem, enabling LLMs to design diverse efficient heuristic contour algorithms for macro legalization\. On TILOS benchmarks, MacroAgent reduces wirelength by 5% compared to DREAMPlace 2\.0\([24](https://arxiv.org/html/2608.24946#bib.bib35)\)and 4% compared to the sequence pair\([11](https://arxiv.org/html/2608.24946#bib.bib32)\), while matching their congestion qualities\. On Chipyard designs, it successfully legalizes every case and achieves wirelength improvements of 3% to 5%\. End\-to\-end evaluation through Cadence Innovus further confirms that the regularity improvements yield tangible PPA gains, including 2\.9% lower routed wirelength and 68\.3% TNS improvement over the DREAMPlace macro legalization baseline, and 1\.8% lower routed wirelength when integrated into the Innovus macro placement flow\. Our approach shortens development cycles and highlights the potential of LLMs to assist in designing EDA algorithms\. We believe this paradigm can be extended to other NP\-hard EDA algorithm design problems, bringing new vitality to the community\.
## References
- Achiamet al\.\(2023\)J\. Achiam, S\. Adler, S\. Agarwal, L\. Ahmad, I\. Akkaya, F\. L\. Aleman, D\. Almeida, J\. Altenschmidt, S\. Altman, S\. Anadkat,et al\.Gpt\-4 technical report\.arXiv preprint arXiv:2303\.08774\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p9.1)\.
- Agnesinaet al\.\(2023\)A\. Agnesina, P\. Rajvanshi, T\. Yang, G\. Pradipta, A\. Jiao, B\. Keller, B\. Khailany, and H\. RenAutodmp: automated dreamplace\-based macro placement\.InProceedings of the 2023 International Symposium on Physical Design,pp\. 149–157\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p4.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p2.1)\.
- Ahnet al\.\(2024\)J\. Ahn, R\. Verma, R\. Lou, D\. Liu, R\. Zhang, and W\. YinLarge language models for mathematical reasoning: progresses and challenges\.InProceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics: Student Research Workshop,pp\. 225–237\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p9.1)\.
- Amidet al\.\(2020\)A\. Amid, D\. Biancolin, A\. Gonzalez, D\. Grubb, S\. Karandikar, H\. Liew, A\. Magyar, H\. Mao, A\. Ou, N\. Pemberton, P\. Rigge, C\. Schmidt, J\. Wright, J\. Zhao, Y\. S\. Shao, K\. Asanović, and B\. NikolićChipyard: integrated design, simulation, and implementation framework for custom socs\.IEEE Micro40\(4\),pp\. 10–21\.External Links:[Document](https://dx.doi.org/10.1109/MM.2020.2996616),ISSN 1937\-4143Cited by:[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p5.1)\.
- Andrews and Witteveen \(2025\)M\. Andrews and S\. WitteveenGPU kernel scientist: an llm\-driven framework for iterative kernel optimization\.arXiv preprint arXiv:2506\.20807\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p11.1)\.
- Banzhafet al\.\(1998\)W\. Banzhaf, F\. D\. Francone, R\. E\. Keller, and P\. NordinGenetic programming: an introduction: on the automatic evolution of computer programs and its applications\.Morgan Kaufmann Publishers Inc\.\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p10.1)\.
- \[7\]c/ua is the Docker Container for Computer\-Use AI Agents\.Note:[https://github\.com/trycua/cua](https://github.com/trycua/cua)Cited by:[§4](https://arxiv.org/html/2608.24946#S4.p2.1)\.
- Changet al\.\(2017\)C\. Chang, Y\. Chang, and T\. ChenA novel damped\-wave framework for macro placement\.In2017 IEEE/ACM International Conference on Computer\-Aided Design \(ICCAD\),pp\. 504–511\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p5.1),[§1](https://arxiv.org/html/2608.24946#S1.p6.1),[§3\.2](https://arxiv.org/html/2608.24946#S3.SS2.p1.1)\.
- Changet al\.\(2024\)K\. Changet al\.Data is all you need: finetuning llms for chip design via an automated design\-data augmentation framework\.InDAC,Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p9.1)\.
- Chenet al\.\(2007\)T\. Chen, P\. Yuh, Y\. Chang, F\. Huang, and D\. LiuMP\-trees: a packing\-based macro placement algorithm for mixed\-size designs\.InProceedings of the 44th annual Design Automation Conference,pp\. 447–452\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1)\.
- Chenet al\.\(2023\)Y\. Chen, Z\. Wen, Y\. Liang, and Y\. LinStronger mixed\-size placement backbone considering second\-order information\.In2023 IEEE/ACM International Conference on Computer Aided Design \(ICCAD\),pp\. 1–9\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p4.1),[§3\.5](https://arxiv.org/html/2608.24946#S3.SS5.p2.1),[§3\.5](https://arxiv.org/html/2608.24946#S3.SS5.p3.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p1.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p2.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p3.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p5.1),[Table 3](https://arxiv.org/html/2608.24946#S5.T3.2.1.1.3),[Table 4](https://arxiv.org/html/2608.24946#S5.T4.4.1.1.3),[Table 6](https://arxiv.org/html/2608.24946#S5.T6.2.1.1.4.1),[§6](https://arxiv.org/html/2608.24946#S6.p1.1)\.
- Chenget al\.\(2023\)C\. Cheng, A\. B\. Kahng, S\. Kundu, Y\. Wang, and Z\. WangAssessment of reinforcement learning for macro placement\.InProceedings of the 2023 International Symposium on Physical Design,pp\. 158–166\.Cited by:[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p5.1)\.
- Cong and Xie \(2008\)J\. Cong and M\. XieA robust mixed\-size legalization and detailed placement algorithm\.IEEE Transactions on Computer\-Aided Design of Integrated Circuits and Systems27\(8\),pp\. 1349–1362\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p4.1)\.
- Fuet al\.\(2023\)Y\. Fuet al\.Gpt4aigchip: towards next\-generation ai accelerator design automation via large language models\.InICCAD,Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p9.1)\.
- Gaoet al\.\(2022\)X\. Gao, Y\. Jiang, L\. Shao, P\. Raspopovic, M\. E\. Verbeek, M\. Sharma, V\. Rashingkar, and A\. JalotaCongestion and timing aware macro placement using machine learning predictions from different data sources: cross\-design model applicability and the discerning ensemble\.InProceedings of the 2022 International Symposium on Physical Design,pp\. 195–202\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p2.1)\.
- Guoet al\.\(2025\)D\. Guo, D\. Yang, H\. Zhang, J\. Song, R\. Zhang, R\. Xu, Q\. Zhu, S\. Ma, P\. Wang, X\. Bi,et al\.Deepseek\-r1: incentivizing reasoning capability in llms via reinforcement learning\.arXiv preprint arXiv:2501\.12948\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p9.1)\.
- \[17\]S\. Hong, M\. Zhuge, J\. Chen, X\. Zheng, Y\. Cheng, J\. Wang, C\. Zhang, Z\. Wang, S\. K\. S\. Yau, Z\. Lin,et al\.MetaGPT: meta programming for a multi\-agent collaborative framework\.InThe Twelfth International Conference on Learning Representations,Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p9.1)\.
- \[18\]Innovus user guide\.23 edition,Cadence Design Systems\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p5.1)\.
- Jawaharet al\.\(2024\)G\. Jawahar, M\. Abdul\-Mageed, L\. Lakshmanan, and D\. DingLLM performance predictors are good initializers for architecture search\.InFindings of the Association for Computational Linguistics ACL 2024,pp\. 10540–10560\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p11.1),[§2\.1](https://arxiv.org/html/2608.24946#S2.SS1.p1.1)\.
- Jianget al\.\(2025\)J\. Jiang, Y\. Pu, M\. Li, Y\. Zhao, P\. Liao, Z\. Zhang, Y\. Lin, and B\. YuRegPlace: regularity\-aware placement for full\-system dnn accelerator designs\.IEEE Transactions on Computer\-Aided Design of Integrated Circuits and Systems\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p4.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p2.1)\.
- Kahnget al\.\(2022\)A\. B\. Kahng, R\. Varadarajan, and Z\. WangRTL\-mp: toward practical, human\-quality chip planning and macro placement\.InProceedings of the 2022 International Symposium on Physical Design,pp\. 3–11\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p5.1),[§1](https://arxiv.org/html/2608.24946#S1.p6.1),[§1](https://arxiv.org/html/2608.24946#S1.p7.1),[§1](https://arxiv.org/html/2608.24946#S1.p8.1),[§3\.2](https://arxiv.org/html/2608.24946#S3.SS2.p1.1),[§3\.3](https://arxiv.org/html/2608.24946#S3.SS3.p1.1)\.
- Kahnget al\.\(2023\)A\. B\. Kahng, R\. Varadarajan, and Z\. WangHier\-rtlmp: a hierarchical automatic macro placer for large\-scale complex ip blocks\.IEEE Transactions on Computer\-Aided Design of Integrated Circuits and Systems43\(5\),pp\. 1552–1565\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p5.1),[§1](https://arxiv.org/html/2608.24946#S1.p6.1),[§1](https://arxiv.org/html/2608.24946#S1.p7.1),[§1](https://arxiv.org/html/2608.24946#S1.p8.1),[§3\.2](https://arxiv.org/html/2608.24946#S3.SS2.p1.1),[§3\.3](https://arxiv.org/html/2608.24946#S3.SS3.p1.1)\.
- Linet al\.\(2018\)J\. Lin, Y\. Deng, S\. Li, B\. Yu, L\. Chang, and T\. PengRegularity\-aware routability\-driven macro placement methodology for mixed\-size circuits with obstacles\.IEEE Transactions on Very Large Scale Integration \(VLSI\) Systems27\(1\),pp\. 57–68\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p4.1),[§1](https://arxiv.org/html/2608.24946#S1.p5.1),[§1](https://arxiv.org/html/2608.24946#S1.p5.1.2),[§1](https://arxiv.org/html/2608.24946#S1.p6.1),[§1](https://arxiv.org/html/2608.24946#S1.p7.1),[§1](https://arxiv.org/html/2608.24946#S1.p8.1),[§3\.2](https://arxiv.org/html/2608.24946#S3.SS2.p1.1),[§3\.3](https://arxiv.org/html/2608.24946#S3.SS3.p1.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p2.1)\.
- Linet al\.\(2020\)Y\. Lin, D\. Z\. Pan, H\. Ren, and B\. KhailanyDREAMPlace 2\.0: open\-source gpu\-accelerated global and detailed placement for large\-scale vlsi designs\.In2020 China Semiconductor Technology International Conference \(CSTIC\),pp\. 1–4\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p4.1),[§3\.5](https://arxiv.org/html/2608.24946#S3.SS5.p4.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p1.1),[Table 3](https://arxiv.org/html/2608.24946#S5.T3.2.1.1.2),[Table 4](https://arxiv.org/html/2608.24946#S5.T4.4.1.1.2),[Table 6](https://arxiv.org/html/2608.24946#S5.T6.2.1.1.3.1),[§6](https://arxiv.org/html/2608.24946#S6.p1.1)\.
- Liuet al\.\(2024\)F\. Liuet al\.A systematic survey on large language models for algorithm design\.arXiv\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p11.1),[§1](https://arxiv.org/html/2608.24946#S1.p12.1),[§2\.1](https://arxiv.org/html/2608.24946#S2.SS1.p1.1),[§5\.7](https://arxiv.org/html/2608.24946#S5.SS7.p1.1)\.
- \[26\]F\. Liu, T\. Xialiang, M\. Yuan, X\. Lin, F\. Luo, Z\. Wang, Z\. Lu, and Q\. ZhangEvolution of heuristics: towards efficient automatic algorithm design using large language model\.InForty\-first International Conference on Machine Learning,Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p11.1),[§2\.1](https://arxiv.org/html/2608.24946#S2.SS1.p1.1),[§3\.3](https://arxiv.org/html/2608.24946#S3.SS3.p5.1),[§3\.3](https://arxiv.org/html/2608.24946#S3.SS3.p6.1),[§3\.3](https://arxiv.org/html/2608.24946#S3.SS3.p7.1),[§3\.3](https://arxiv.org/html/2608.24946#S3.SS3.p8.1)\.
- Liuet al\.\(2023\)M\. Liuet al\.Verilogeval: evaluating large language models for verilog code generation\.InICCAD,Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p9.1)\.
- Liuet al\.\(2024\)S\. Liu, J\. Jiang, Z\. He, Z\. Wang, Y\. Lin, B\. Yu, and M\. WongRouting\-aware legal hybrid bonding terminal assignment for 3d face\-to\-face stacked ics\.InProceedings of the 2024 International Symposium on Physical Design,pp\. 75–82\.Cited by:[§3\.4](https://arxiv.org/html/2608.24946#S3.SS4.p1.1)\.
- Mankowitzet al\.\(2023\)D\. J\. Mankowitz, A\. Michi, A\. Zhernov, M\. Gelmi, M\. Selvi, C\. Paduraru, E\. Leurent, S\. Iqbal, J\. Lespiau, A\. Ahern,et al\.Faster sorting algorithms discovered using deep reinforcement learning\.Nature618\(7964\),pp\. 257–263\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p10.1)\.
- McLellan \(2020\)P\. McLellanInnovus mixed placer\.Note:[https://community\.cadence\.com/cadence\_blogs\_8/b/breakfast\-bytes/posts/innovus\-mixed\-placer](https://community.cadence.com/cadence_blogs_8/b/breakfast-bytes/posts/innovus-mixed-placer)Cadence Blogs \- Breakfast Bytes, accessed 14 September 2025Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p1.1)\.
- Novikovet al\.\(2025\)A\. Novikov, N\. Vũ, M\. Eisenberger, E\. Dupont, P\. Huang, A\. Z\. Wagner, S\. Shirobokov, B\. Kozlovskii, F\. J\. Ruiz, A\. Mehrabian,et al\.AlphaEvolve: a coding agent for scientific and algorithmic discovery\.arXiv preprint arXiv:2506\.13131\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p11.1),[§2\.1](https://arxiv.org/html/2608.24946#S2.SS1.p1.1),[§3\.1](https://arxiv.org/html/2608.24946#S3.SS1.p1.1)\.
- O’Neillet al\.\(2010\)M\. O’Neill, L\. Vanneschi, S\. Gustafson, and W\. BanzhafOpen issues in genetic programming\.Genetic Programming and Evolvable Machines11\(3\),pp\. 339–363\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p10.1)\.
- Peng and Zhu \(2023\)K\. Peng and W\. ZhuPplace\-ms: methodologically faster poisson’s equation\-based mixed\-size global placement\.IEEE Transactions on Computer\-Aided Design of Integrated Circuits and Systems43\(2\),pp\. 613–626\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p4.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p2.1)\.
- Puet al\.\(2024\)Y\. Pu, T\. Chen, Z\. He, C\. Bai, H\. Zheng, Y\. Lin, and B\. YuIncreMacro: incremental macro placement refinement\.InProceedings of the 2024 International Symposium on Physical Design,pp\. 169–176\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p2.1),[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p4.1),[§1](https://arxiv.org/html/2608.24946#S1.p5.1),[§1](https://arxiv.org/html/2608.24946#S1.p6.1),[§1](https://arxiv.org/html/2608.24946#S1.p8.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p2.1)\.
- Romera\-Paredeset al\.\(2024\)B\. Romera\-Paredes, M\. Barekatain, A\. Novikov, M\. Balog, M\. P\. Kumar, E\. Dupont, F\. J\. Ruiz, J\. S\. Ellenberg, P\. Wang, O\. Fawzi,et al\.Mathematical discoveries from program search with large language models\.Nature625\(7995\),pp\. 468–475\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p10.1),[§1](https://arxiv.org/html/2608.24946#S1.p9.1),[§2\.1](https://arxiv.org/html/2608.24946#S2.SS1.p1.1),[§3\.1](https://arxiv.org/html/2608.24946#S3.SS1.p1.1)\.
- Sypulaet al\.\(2022\)A\. Sypula, P\. Yin, J\. Lacomis, C\. Le Goues, E\. J\. Schwarts, and G\. NeubigLearning to superoptimize real\-world programs\.InDeep Learning for Code Workshop \(ICLR 2022 Workshop\),Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p10.1)\.
- Vidal\-Obiolset al\.\(2019\)A\. Vidal\-Obiols, J\. Cortadella, J\. Petit, M\. Galceran\-Oms, and F\. MartorellRTL\-aware dataflow\-driven macro placement\.In2019 Design, Automation & Test in Europe Conference & Exhibition \(DATE\),pp\. 186–191\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1)\.
- Wanget al\.\(2023\)H\. Wang, T\. Fu, Y\. Du, W\. Gao, K\. Huang, Z\. Liu, P\. Chandak, S\. Liu, P\. Van Katwyk, A\. Deac,et al\.Scientific discovery in the age of artificial intelligence\.Nature620\(7972\),pp\. 47–60\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p9.1)\.
- \[39\]K\. Xue, R\. Chen, X\. Lin, Y\. Shi, S\. Kai, S\. Xu, and C\. QianReinforcement learning policy as macro regulator rather than macro placer\.InThe Thirty\-eighth Annual Conference on Neural Information Processing Systems,Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p3.1),[§1](https://arxiv.org/html/2608.24946#S1.p5.1),[§1](https://arxiv.org/html/2608.24946#S1.p6.1),[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p2.1)\.
- \[40\]C\. Yang, X\. Wang, Y\. Lu, H\. Liu, Q\. V\. Le, D\. Zhou, and X\. ChenLarge language models as optimizers\.InThe Twelfth International Conference on Learning Representations,Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p11.1),[§2\.1](https://arxiv.org/html/2608.24946#S2.SS1.p1.1)\.
- Yaoet al\.\(2026\)X\. Yao, J\. Jiang, Y\. Zhao, P\. Liao, Y\. Lin, and B\. YuEvoPlace: evolution of optimization algorithms for global placement via large language models\.IEEE Transactions on Computer\-Aided Design of Integrated Circuits and Systems\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p11.1),[§2\.1](https://arxiv.org/html/2608.24946#S2.SS1.p1.1)\.
- Yuet al\.\(2025\)C\. Yu, R\. Liang, C\. Ho, and H\. RenAutonomous code evolution meets np\-completeness\.arXiv preprint arXiv:2509\.07367\.Cited by:[§1](https://arxiv.org/html/2608.24946#S1.p11.1)\.
- Zhaoet al\.\(2024\)C\. Zhao, Z\. Guo, R\. Wang, Z\. Wen, Y\. Liang, and Y\. LinHeLEM\-gr: heterogeneous global routing with linearized exponential multiplier method\.InProceedings of the 43rd IEEE/ACM International Conference on Computer\-Aided Design,pp\. 1–9\.Cited by:[§5\.1](https://arxiv.org/html/2608.24946#S5.SS1.p3.1),[§5\.4](https://arxiv.org/html/2608.24946#S5.SS4.p1.1)\.Similar Articles
Distribution-Aware Algorithm Design with LLM Agents
This paper introduces a framework for distribution-aware algorithm design where LLM agents learn to generate solver code specialized to target distributions, achieving high solution quality and significant speedups over standard solvers.
Agent-MD: Selective LLM Intervention with Event-Driven Escalation for Stateful GCMC--MD Campaigns
Agent-MD is a framework that selectively applies LLM reasoning to long-running molecular simulation campaigns, using a deterministic rule-based agent for routine tasks and event-triggered LLM review for exceptional conditions. Demonstrated in GCMC–MD water-vapor desorption simulations, it shows that auditable, reproducible scientific workflows can avoid placing every operation inside an LLM reasoning loop.
My agent.md to improve LLM-assisted code quality
The article shares a method using an agent.md file to define coding style preferences for LLM-assisted development, improving code quality by reducing repetitive feedback.
Towards Security-Auditable LLM Agents: A Unified Graph Representation
This paper introduces Agent-BOM, a unified graph representation for security auditing in LLM-based agentic systems. It addresses the semantic gap in post-hoc auditing by modeling static capabilities and dynamic runtime states to detect complex attack chains like memory poisoning and tool misuse.
ZhuLong: Execution-Grounded LLM Agent for EDA Scripting with Offline API Self-Exploration
This paper presents ZhuLong, an execution-grounded LLM coding agent for EDA scripting that uses API retrieval, documentation inspection, and sandbox execution via MCP tools, augmented by an offline API self-exploration mechanism to infer undocumented API behaviors. It achieves 78.5% Pass@1 on a benchmark of 158 real-world EDA tasks, significantly outperforming a pure LLM baseline.