LM-Searcher: Cross-domain Neural Architecture Search with LLMs via Unified Numerical Encoding

Yuxuan Hu, Jihao Liu, Ke Wang, Jinliang Zhen, Weikang Shi, Manyuan Zhang, Qi Dou, Rui Liu, Aojun Zhou, Hongsheng Li · DOI

Abstract

Neural Architecture Search (NAS) has traditionally been a domain-specific and computationally intensive endeavor. LM-Searcher introduces a paradigm shift by repurposing Large Language Models (LLMs) as universal architecture optimizers. By encoding complex architectures into a unified numerical format (NCode) and framing search as a ranking task, LM-Searcher demonstrates remarkable zero-shot generalization across diverse domains—including image classification, segmentation, translation, and generative modeling—without requiring task-specific fine-tuning.

Introduction

The automation of neural network design, known as Neural Architecture Search (NAS), is a cornerstone of modern machine learning. However, traditional NAS algorithms are often "brittle," designed for specific search spaces and requiring significant reconfiguration to adapt from a convolutional neural network (CNN) to a transformer. While recent attempts have leveraged the reasoning capabilities of LLMs like GPT-4, these methods often rely on manual prompt engineering or struggle with the structural complexity of large search spaces.

LM-Searcher addresses these challenges by teaching LLMs the "language" of architecture optimization. Instead of treating architectures as code or natural language descriptions, the framework abstracts them into numerical sequences. This allows the model to focus on the underlying patterns between structural configurations and performance metrics, enabling a single model to act as a general-purpose search engine across entirely different architectural families.

Methodology

The LM-Searcher framework is built upon three foundational pillars: Unified Numerical Encoding, a Ranking-based search strategy, and a massive, diverse instruction-tuning dataset.

1. NCode: Unified Numerical Encoding

To achieve domain-agnosticism, the authors developed NCode. This scheme represents an architecture as a string of digits where each position and value corresponds to specific structural choices (e.g., operation types or connection indices). By stripping away domain-specific terminology (like "3x3 Depthwise Convolution"), NCode transforms NAS into a combinatorial optimization problem. This abstraction allows the LLM to process architectures from different domains using a consistent mathematical logic.

2. Search as a Ranking Task

Generating a high-performing architecture from scratch is prone to hallucinations. LM-Searcher instead frames the problem as a ranking task. The model is provided with a "History"—a sequence of previously evaluated NCodes and their corresponding performance scores—and a set of "Candidates." The LLM’s objective is to rank the candidates based on the trends observed in the history. This approach leverages the in-context learning capabilities of LLMs, allowing them to interpolate and extrapolate from past successes and failures.

3. Pruning-based Data Curation

Training an LLM for NAS requires vast amounts of high-quality data. The researchers utilized a "supernet" approach, where they randomly pruned edges and operations to create thousands of diverse sub-spaces. This process, combined with data from established benchmarks like NAS-Bench-101 and NAS-Bench-201, resulted in a 228k instruction-tuning dataset. The final model was developed by fine-tuning LLaMA-3.1-8B on this comprehensive corpus.

Experimental Results

LM-Searcher was evaluated across a wide array of tasks to test its robustness and generalization capabilities.

In-Domain Performance

On standard image classification benchmarks, LM-Searcher achieved competitive results, such as 94.20% accuracy on CIFAR-10. These results confirm that the model effectively learns the search logic within the domains it was trained on.

Cross-Domain and Zero-Shot Generalization

The true strength of LM-Searcher lies in its ability to generalize to unseen tasks without further training:

  • Image Generation: In optimizing LoRA configurations for Stable Diffusion, LM-Searcher identified structures that improved image similarity (CLIP-I) by 28.2% over standard LoRA.
  • Segmentation and Audio: The model outperformed traditional baselines like Random Search and Regularized Evolution on medical imaging (Kvasir-SEG) and audio tasks (NAS-Bench-ASR), despite having no prior exposure to these specific search spaces.
  • Translation: It successfully identified efficient Transformer structures for the IWSLT’14 De-En translation task.

Discussion

The success of LM-Searcher suggests that LLMs can capture the "latent physics" of neural architectures when provided with the right abstraction. By focusing on numerical patterns rather than semantic descriptions, the model avoids the pitfalls of domain-specific jargon. Furthermore, the scaling analysis revealed that larger base models (moving from 1B to 8B parameters) consistently yielded better search performance, indicating that the reasoning capacity of the underlying LLM is a critical factor in NAS efficiency.

Limitations and Future Work

Despite its versatility, LM-Searcher faces certain limitations. Its performance is inherently tied to the diversity of the training benchmarks; fundamentally new architecture types might still pose a challenge. Additionally, while NCode provides a unified interface, it may lack the granularity required for highly complex, non-sequential architectures. Future work will focus on expanding the training data and refining the encoding scheme to bridge the performance gap with hyper-specialized, manually-tuned NAS algorithms.

Conclusion

LM-Searcher demonstrates that LLMs can be transformed into powerful, cross-domain architecture searchers. By combining numerical abstraction with a ranking-based search framework, the authors have created a tool that is both efficient and remarkably generalizable, paving the way for more accessible and universal automated machine learning.

Summary updated

BibTeX
@inproceedings{hu2025lm,
  author = {Yuxuan Hu and Jihao Liu and Ke Wang and Jinliang Zhen and Weikang Shi and Manyuan Zhang and Qi Dou and Rui Liu and Aojun Zhou and Hongsheng Li},
  title = {{LM-Searcher: Cross-domain Neural Architecture Search with LLMs via Unified Numerical Encoding}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
  url = {https://openreview.net/forum?id=pXdJoIal8d},
}
Figure