Skip to main content

AutoHD: Automated Heuristics Discovery for LLM Planning

PyPI Python License Documentation


What is AutoHD?

AutoHD (Automated Heuristics Discovery) is a Python package that enables LLMs to generate and evolve heuristic functions for guiding inference-time search in complex planning tasks.

Based on the research paper: "Complex LLM Planning via Automated Heuristics Discovery" (arXiv:2502.19295v1, Feb 2025, Texas A&M University).

Key Features

  • LLM-Generated Heuristics: LLMs automatically generate heuristic functions as Python code
  • Heuristic Evolution: Iterative refinement through exploration and modification strategies
  • Multiple Search Algorithms: Support for Greedy BFS and A* search
  • Multiple Planning Tasks: Blocksworld, Game of 24, and Rubik's Cube
  • LLM-Agnostic: Works with OpenAI, Anthropic, and other providers via litellm
  • LangChain Integration: Plug into LangChain agents and chains

Quick Start

pip install autohd

Basic Usage

import asyncio
from autohd import AutoHD
from autohd.core.config import AutoHDConfig, LLMConfig

async def main():
    # Configure AutoHD
    config = AutoHDConfig(
        task_name="blocksworld",
        llm=LLMConfig(model="gpt-4o", provider="openai"),
    )
    
    # Initialize AutoHD
    autohd = AutoHD(config=config)
    
    # Generate synthetic training data
    train_data = [
        {"initial_state": "the red block is clear...", "goal_state": "the orange block is on top of the red block..."},
        # ... more examples
    ]
    
    # Run the pipeline
    results = await autohd.run(
        train_data=train_data,
        test_data=test_data,
    )
    
    print(f"Best heuristic accuracy: {results['test_results']['accuracy']:.1%}")

asyncio.run(main())

CLI Usage

# Run on Blocksworld
autohd run --task blocksworld --model gpt-4o

# Run on Game of 24
autohd run --task game24 --model gpt-4o

# Run on Rubik's Cube
autohd run --task rubiks_cube --model gpt-4o

# Custom configuration
autohd run --task blocksworld --generations 5 --population 10 --search-algorithm astar

Architecture

autohd/
├── core/           # Core framework
│   ├── autohd.py   # Main AutoHD class
│   ├── config.py   # Configuration classes
│   └── llm_client.py # LLM API abstraction
├── search/         # Search algorithms
│   ├── greedy_bfs.py # Greedy BFS solver
│   └── astar.py     # A* solver
├── benchmarks/     # Planning task implementations
│   ├── base.py     # Base benchmark class
│   ├── blocksworld.py # Blocksworld task
│   ├── game24.py   # Game of 24 task
│   └── rubiks_cube.py # Rubik's Cube task
├── integrations/   # Framework integrations
│   └── langchain.py # LangChain integration
└── cli/            # Command-line interface
    └── main.py     # CLI entry point

How It Works

AutoHD follows a 5-step pipeline:

  1. Generate Initial Heuristics: LLMs are prompted to create heuristic functions as Python code
  2. Evaluate Heuristics: Each heuristic is tested on validation data using heuristic-guided search
  3. Evolve Heuristics: Iterative refinement through exploration (new ideas) and modification (tweaking existing)
  4. Select Best: The best heuristic from all generations is chosen
  5. Test: The selected heuristic is evaluated on test data

Performance

Based on the research paper:

Task GPT-4o-mini GPT-4o Llama 3.1 70B Best Baseline
Blocksworld 42.4% 75.1% 59.1% ~2× improvement
Game of 24 54% 70% 69% vs ToT 42/62/59
Rubik's Cube (2×2) 82.5% 83.1% 84.7% vs XoT 67/80/78

Requirements

  • Python 3.10+
  • OpenAI API key (or other LLM provider)
  • Optional: litellm for multi-provider support

License

MIT License

Citation

If you use AutoHD in your research, please cite:

@article{ling2025autohd,
  title={Complex LLM Planning via Automated Heuristics Discovery},
  author={Ling, Hongyi and Parashar, Shubham and Khurana, Sambhav and Olson, Blake and Basu, Anwesha and Sinha, Gaurangi and Tu, Zhengzhong and Caverlee, James and Ji, Shuiwang},
  journal={arXiv preprint arXiv:2502.19295},
  year={2025}
}

Metadata

Release files for autohd 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autohd 0.1.1
File Size Uploaded Provenance
autohd-0.1.1.tar.gz 28.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for autohd 0.1.1
File Interpreter ABI Platform
autohd-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 60.1 kB

Release files / autohd-0.1.1.tar.gz

Download URL autohd-0.1.1.tar.gz
Size 28.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dd6ec9d66be12e80906c304befebc89a80866b8764d0d621fcc92ddd8a0016d0
BLAKE2b-256 checksum
How to use checksums
ece1f27242f04ae704a997f9ad3ace37a4d4201f0958932469e19f52c7c3a6ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / autohd-0.1.1-py3-none-any.whl

Download URL autohd-0.1.1-py3-none-any.whl
Size 31.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ce58b1c7cc0e1ed33d34be8f64a2d2c242e40902b46bc412238c127ac89a814
BLAKE2b-256 checksum
How to use checksums
70144812eec88013af454998b5096f04b5e09d5b0e07e60226d4eec7b0504981
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for autohd 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page