Autoadapt
AutoAdapt: An Automated Domain Adaptation Framework for Large Language Models
README
โก AutoAdapt
This is the official implementation of AutoAdapt: An Automated Domain Adaptation Framework for Large Language Models
Large language models (LLMs) excel in open domains but struggle in specialized settings with limited data and evolving knowledge. Existing domain adaptation practices rely heavily on manual trial-and-error processes, incur significant hyperparameter complexity, and are highly sensitive to data and user preferences, all under the high cost of LLM training. Moreover, the interactions and transferability of hyperparameter choices across domains remain poorly understood, making adaptation gains uncertain even with substantial effort. To solve these challenges, we present AutoAdapt, a novel end-to-end automated framework for efficient and reliable LLM domain adaptation. AutoAdapt leverages curated knowledge bases from literature and open-source resources to reduce expert intervention. To narrow the search space, we design a novel multi-agent debating system in which proposal and critic agents iteratively interact to align user intent and incorporate data signals and best practices into the planning process. To optimize hyperparameters under tight budgets, we propose AutoRefine, a novel LLM-based surrogate that replaces costly black-box search. Across 10 tasks, AutoAdapt achieves a 25% average accuracy improvement over state-of-the-art Automated Machine Learning baselines with minimal optimization overhead.
Installation and Quick Start
We recommend using a conda environment:
conda create --name autoadapt python=3.12.3
To install AutoAdapt, execute the following command, after cloning the repository:
pip install .
Usage
AutoAdapt supports two ways of usage:
- A Command Line Interface (CLI)
- A React-based UI that runs locally in your browser
Choose the option that best fits your needs.
Option 1: Use AutoAdapt via CLI
Follow the steps below to configure and run AutoAdapt:
-
Navigate to the
app/sampledirectory and create adatasubdirectory. Place your training dataset, test dataset, and RAG context files (if needed) within this folder. -
Update the configuration file located at
app/sample/conf/config.yamlwith the following:- Path to the project directory (
general.project_path) - Paths to the respective datasets and context documents (
data.dataset_name_or_path,data.test_dataset_name_or_path) - Column nomenclature specifications (
data.input_column,data.response_column) - Other optional configurations
- Path to the project directory (
-
Set the Hugging Face access token, OpenAI API Key and Serp API Key:
export HF_ACCESS_TOKEN="your_hf_token" export API_KEY="your_openai_key" export SERPAPI_KEY="your_serpapi_key" -
Customize the configuration file according to your requirements.
-
(Optional) Update the
app/sample/conf/user_preferences.mdfile to specify any user preferences. -
(Optional) Update/Add an evaluation function specific to your task in the
src/autoadapt/utils/template.pyfile and specify the function name using theevaluation.eval_funcconfig. -
Navigate to the application directory (
app/sample) and execute the following command to start AutoAdapt:python3 run.py
Option 2: Use AutoAdapt via the UI
Follow the steps below to configure and run AutoAdapt UI:
-
Set the Hugging Face access token, OpenAI API Key and Serp API Key:
export HF_ACCESS_TOKEN="your_hf_token" export API_KEY="your_openai_key" export SERPAPI_KEY="your_serpapi_key" -
Navigate to
app/reactand run thesetup.shfile:cd app/react bash setup.sh -
Once the servers have started, run the following command:
bash start.sh -
Open browser and navigate to http://localhost:8080.
Note: The templates provided in src/autoadapt/template can also be directly used by navigating to the required directory (e.g. src/autoadapt/template/sft) and changing the config file (e.g. src/autoadapt/template/sft/conf/config.yaml) within the directory, for domain-adaptation of LLM on hyperparameters chosen by the user.
Folder Structure
AutoAdapt/
โโโ app/ # Application entry points and data
โ โโโ data/
โ โ โโโ models_data_database/ # Model and dataset metadata (JSON)
โ โโโ react/ # React-based UI
โ โ โโโ backend/ # FastAPI backend server
โ โ โ โโโ conf/ # Backend configuration
โ โ โโโ frontend/ # React + Vite frontend
โ โ โ โโโ public/
โ โ โ โโโ src/
โ โ โโโ setup.sh # UI setup script
โ โ โโโ start.sh # UI start script
โ โโโ sample/ # CLI sample application
โ โโโ conf/ # Sample config (config.yaml, user_preference.md)
โ โโโ run.py # Main CLI entry point
โ โโโ run_plan.py # Plan-only execution
โ โโโ run_dashboard.sh # Dashboard launcher
โ
โโโ src/
โ โโโ autoadapt/ # Core AutoAdapt package
โ โ โโโ cli.py # CLI interface
โ โ โโโ adapt/ # Adaptation pipeline orchestration
โ โ โ โโโ adapt_pipeline.py # End-to-end adaptation pipeline
โ โ โ โโโ adapt_step.py # Individual adaptation step
โ โ โ โโโ autoadapt_executor.py # AutoAdapt executor
โ โ โ โโโ base_executor.py # Base executor class
โ โ โ โโโ extract_dataset_stats.py# Dataset statistics extraction
โ โ โ โโโ pipeline.py # Pipeline definition
โ โ โ โโโ pipeline_executor.py # Pipeline execution engine
โ โ โโโ agents/ # Multi-agent system
โ โ โ โโโ aggregator_agent.py # Aggregates agent outputs
โ โ โ โโโ base_agent.py # Base agent class
โ โ โ โโโ base_worker.py # Base worker class
โ โ โ โโโ best_practice_agent.py # Best practices retrieval agent
โ โ โ โโโ data_agent.py # Data analysis agent
โ โ โ โโโ knowledge_retriever_agent.py # Knowledge retrieval agent
โ โ โ โโโ messages.py # Agent message definitions
โ โ โ โโโ research_agent.py # Research/web search agent
โ โ โ โโโ user_preference_agent.py# User preference parsing agent
โ โ โ โโโ best_practices/ # Best practice retrieval utilities
โ โ โ โโโ knowledge_retriever/ # Knowledge retrieval utilities
โ โ โโโ config/ # Configuration and knowledge bases
โ โ โ โโโ knowledge.md # Domain adaptation knowledge base
โ โ โ โโโ knowledge_hparams.md # Hyperparameter knowledge base
โ โ โ โโโ model_selection_kb.md # Model selection knowledge base
โ โ โโโ dashboard/ # Streamlit dashboard
โ โ โ โโโ Home.py # Dashboard home page
โ โ โ โโโ pages/ # Dashboard sub-pages
โ โ โ โโโ static/ # Static assets
โ โ โโโ evaluate/ # Evaluation module
โ โ โ โโโ evaluator.py # Model evaluation logic
โ โ โโโ frontend/ # Frontend message interfaces
โ โ โ โโโ cli_message.py # CLI message formatting
โ โ โ โโโ streamlit_message.py # Streamlit message formatting
โ โ โโโ hpo/ # Hyperparameter optimization (AutoRefine)
โ โ โ โโโ coreset_selection.py # Core-set selection for training
โ โ โ โโโ gaussian_process.py # Gaussian process surrogate
โ โ โ โโโ hpo_executor.py # HPO execution engine
โ โ โ โโโ llm_gp_sampler.py # LLM-guided GP sampler
โ โ โ โโโ llm_sampler.py # LLM-based sampler
โ โ โ โโโ llm_surrogate_sampler.py# LLM surrogate sampler
โ โ โโโ memory/ # Shared state management
โ โ โ โโโ shared_memory.py # Shared memory across components
โ โ โโโ plan/ # Planning module
โ โ โ โโโ adapt_config_graph.py # Adaptation configuration graph
โ โ โ โโโ base_planner.py # Base planner class
โ โ โ โโโ multiagent_debate_planner.py # Multi-agent debate planner
โ โ โโโ template/ # Standalone adaptation templates
โ โ โ โโโ sft/ # Supervised fine-tuning template
โ โ โ โโโ dpo/ # Direct preference optimization template
โ โ โ โโโ rag/ # Retrieval-augmented generation template
โ โ โโโ utils/ # Utility modules
โ โโโ deepcore/ # Data selection methods
โ
โโโ pyproject.toml # Project build configuration
โโโ requirements.txt # Python dependencies
โโโ README.md
โโโ LICENSE
โโโ CODE_OF_CONDUCT.md
โโโ CONTRIBUTING.md
โโโ SECURITY.md
โโโ SUPPORT.md
Intended Use
This repository provides research-oriented code and reference implementations for studying automated domain adaptation and agentโbased optimization techniques in machine learning systems. The primary goal of this project is to support experimentation, benchmarking, and academic or industrial research into model adaptation workflows, planning strategies, and evaluation methodologies.
The code in this repository is not a productionโready system and is not intended to be deployed as a live service, integrated into operational decisionโmaking pipelines, or used to directly make or automate realโworld decisions affecting users, customers, or systems. It does not include hosted services, pretrained proprietary models, or runtime components that operate on live customer or production data. The framework has been tested on benchmark datasets (in English language) for research purposes and academic validation.
This project does not provide endโuser AI applications, decision engines, or autonomous systems. Any outputs generated by experiments using this code are intended solely for offline analysis, research validation, and prototyping. Users are responsible for performing their own validation, safety assessments, and compliance reviews before applying concepts or code from this repository in downstream systems or production environments.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit Contributor License Agreements.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct.
For more information see the Code of Conduct FAQ or
contact [email protected] with any additional questions or comments.
Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
Microsoft's Trademark & Brand Guidelines.
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.
Third-Party Code
This project uses the following third-party open source packages (installed via requirements.txt):
- openai โ OpenAI Python client (MIT License)
- azure-identity / azure-core โ Azure SDK authentication (MIT License)
- tiktoken โ Token counting (MIT License)
- trl โ Transformer Reinforcement Learning (Apache-2.0 License)
- deepcore โ Data-efficient learning and coreset selection (MIT License)
- vllm โ High-throughput LLM serving engine (Apache-2.0 License)
- optuna โ Hyperparameter optimization framework (MIT License)
- gpytorch โ Gaussian process inference with PyTorch (MIT License)
- serpapi โ SerpApi web search client (MIT License)
- langchain-community / langchain-huggingface โ LLM orchestration framework (MIT License)
- autogen-core / autogen-ext โ Multi-agent conversation framework (MIT License)
See requirements.txt for the full list of dependencies.
License
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT license.
Citation
If you find this work useful, please cite:
@misc{sinha2026autoadaptautomateddomainadaptation,
title={AutoAdapt: An Automated Domain Adaptation Framework for LLMs},
author={Sidharth Sinha and Anson Bastos and Xuchao Zhang and Akshay Nambi and Chetan Bansal and Saravan Rajmohan},
year={2026},
eprint={2603.08181},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2603.08181},
}