MOSAIC: Memory-Organized Search with Anti-Imitation Crossover for Training-Free Microarchitecture Optimization
Organizations: Electrical and Computer Engineering, North Carolina State University
Abstract
Large language models can generate cache-replacement policies. The central challenge is to retain performance on workloads excluded from the search. In our adaptations of published search methods, generated code resembles established policies, with cosine similarities of 0.78-0.84. The wider comparison also shows held-out harmonic-mean instructions-per-cycle (IPC) losses of 1.0-2.4%. We present MOSAIC, a search controller that improves policies without updating language-model weights. It stores concise lessons from previous evaluations rather than repeatedly copying high-scoring code. When improvement stops, it selects two high-scoring policies whose code embeddings differ and asks the model to combine their mechanisms. Novelty prompts and model rotation support this search; controlled memory edits test how the stored lessons affect later proposals. We evaluate cache replacement using intervention-level cross-validation and a wider comparison on ten memory-intensive SPEC2006 workloads. MOSAIC reaches a 51.1% peak hit rate on the primary search workload and a 47.9% held-out mean in the intervention study. Removing crossover reduces these values by 7.8 and 21.8 percentage points, respectively, whereas the tested stronger model improves the held-out mean by 0.4 points. In the wider IPC comparison, MOSAIC has the smallest held-out gap (0.31%) and the highest held-out IPC among the evaluated LLM configurations. Adapting the same controller to data prefetching gives a 4.8% mean speedup over the LRU reference configuration. The accompanying corpus contains 10,687 generated policies with lineage and per-iteration prompt logs.
Figures & tables
Appendix figures & tables23 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | IPC | Novelty | KiB | mW | kGE | ps |
|---|---|---|---|---|---|---|
| P1 – naive raw-IPC | 0.4004 | 1.50 | 16.0 | 14.6 | 852 | 130 |
| P2 – GoT + APE | 0.4083 | 1.29 | 12.0 | 11.0 | 639 | 195 |
| P3 – Surrogate-DFS | 0.4100 | 3.50 | 24.0 | 33.0 | 1093 | 440 |
| P4 – Multi-agent roles | 0.4135 | 2.38 | 32.0 | 51.4 | 1334 | 505 |
| P5 – Atomic mutation | 0.4137 | 2.55 | 22.0 | 25.6 | 1079 | 375 |
| P6 – Concise + RL bandit | 0.4139 | 3.88 | 17.5 | 20.1 | 863 | 375 |
| Method | Seen IPC | Held-out IPC | Gap | Loop knob |
|---|---|---|---|---|
| MOSAIC (ours) | 0.41643 | 0.41512 | embedding crossover | |
| P9 – Diff frontier | 0.41686 | 0.41019 | explicit code diffs | |
| P5 – Atomic mutation | 0.41367 | 0.40912 | atomic single-edit | |
| P7 – Single-agent + seed | 0.41406 | 0.40868 | contract + seed | |
| P4 – Multi-agent roles | 0.41351 | 0.40772 | 5-role pipeline | |
| P6 – Concise + RL bandit | 0.41387 | 0.40725 | RL prompt selection |
| Component | Description | Multiperspective | MOSAIC | Tuning | ||||||||
| A | B | E | W | X | A | B | E | W | X | |||
| Perceptron Features | ||||||||||||
| F_PC | PC: Bits B–E of the PC of the th memory access instruction. A is the recency-stack position beyond which the block is considered dead. | 7 | 14 | 43 | 11 | 0 | 6 | 0 | 16 | 8 | 0 | Changed |
| F_PC | 16 | 3 | 11 | 16 | 1 | 8 | 6 | 22 | 3 | 0 | Changed | |
| F_PC | 10 | 1 | 53 | 10 | 0 | 10 | 4 | 20 | 1 | 0 | Changed | |
| F_PC | 16 | 8 | 16 | 5 | 0 | 12 | 4 | 20 | 0 | 2 | Changed | |
| Contract | Injected blocks | Excerpt | Validators / guarantees |
|---|---|---|---|
| System (always) | Role, fixed -section schema, metadata accounting, victim/bypass invariants, one-shot LRU exemplar. | Output EXACTLY 5 sections ; victim in [0, WAYS-1] ; No bypass on WRITEBACK | Schema, code-fence, overhead-parser, invariant checks. |
| Compile-repair | Failing C++ + raw compiler diagnostics + repair-only constraint. | FIX COMPILATION ONLY ; Do NOT rename ; ONE ```cpp block | CompileGate; DriftGuard (names preserved); bounded retries. |
| Exploration | Workloads, – baselines (code score), template scaffold, novelty instruction. | Propose 3--4 distinct ideas ; choose one ; strict -section format. | NoveltyGate; SchemaValidator; CompileGate; BudgetChecker. |
| Exploitation | Parent (full code score), lineage trace, episodic top- , summary memory, edit-budget . | Refine parent only ; patch ; // MUTATION . | LineageConsistency; EditBudgetEnforcer; SchemaValidator. |
| Lineage block | Recent variants newest oldest, entries, BEST_SO_FAR anchor. | see Table 5 . | Auditability; anti-repeat. |
| Episodic top- | Similarity-retrieved lessons (name, delta, outcome, lesson). | Relevant prior lessons (Top-k) . | Bounded retrieval; anti-redundancy. |
| Listing: lineage-memory block from a live run |
|---|
| Lineage (newest->oldest): |
| iter=3 name=HydraLRU_v4 avg_ipc=0.4478 desc=tightened decay; reuse-meter |
| iter=2 name=HydraLRU_v3 avg_ipc=0.4449 desc=streaming-bypass gate |
| iter=1 name=HydraLRU_v2 avg_ipc=0.4402 desc=widened RRPV to 3 bits |
| iter=0 name=HydraLRU avg_ipc=0.4361 desc=baseline two-tier RRIP |
| Tier | Example policy | IPC over LRU | Mechanism summary |
|---|---|---|---|
| Low | HotInsertOnly | Insert all loads at MRU; no PC tracking | |
| Low | LFU-Naive | Pure frequency counter per line; no decay | |
| Mid | SigCounter-Light | SHiP-style signature table, single SHCT | |
| Mid | RRIP-Stride-Fused | RRIP plus stride-pattern-aware insertion | |
| High | TA-DPIP | Thrash-aware dual-pattern insertion | |
| High | RSP-MPPP | Region–StreamPath multiperspective hybrid |
Large Language Model-Guided Optimization
Large Language Model-Guided Optimization uses language models to propose, steer, and refine solutions to hard search and design problems.
See all 671 papers