--- title: Algorithm Finder emoji: 🔍 colorFrom: blue colorTo: blue sdk: gradio sdk_version: "6.19.0" python_version: "3.10" app_file: app.py pinned: false hardware: zero-gpu --- # Algorithm Finder Find the best algorithm for any code/math problem using LLM-powered C++ agents, compiled and benchmarked locally (Zero GPU). ## How It Works 1. **Initial Coder**: Generates a compilable C++ solution for your problem. 2. **Researcher**: Generates N novel alternative C++ algorithms. 3. **Validator**: Evaluates all candidates against performance metrics and selects a winner. - If no winner passes, it regenerates N new algorithms (up to `max_validation_rounds`). 4. **Real-World Tester**: Tests the winner against the baseline in N realistic scenarios. 5. **Summary**: Displays a Markdown summary of the winning algorithm and results. ## Setup ### Local ```bash pip install -r requirements.txt python app.py ``` ### Hugging Face Spaces (Zero GPU) 1. Create a new Space with the **Gradio** SDK. 2. Set `app.py` as the entrypoint. 3. Add `requirements.txt`. 4. (Optional) Add your `HF_TOKEN` as a Space secret. 5. Deploy. ## Usage - **Problem Description**: Describe the problem you want to optimize. - **Objective**: What you are trying to optimize (speed, memory, accuracy, etc.). - **User-defined Metric**: A custom metric the validator should prioritize. - **Model ID**: Any Hugging Face Instruct model (e.g., `meta-llama/Meta-Llama-3-8B-Instruct`). - **Number of candidate algorithms**: How many new algorithms the researcher generates per round. - **Number of real-world scenarios**: How many scenarios the winner is tested in. - **Max validation rounds**: How many times to regenerate if no winner is found. ## Notes - This app uses the **Hugging Face Inference API** (free tier or Pro) to run LLMs. - C++ compilation happens locally using `g++`. - Execution time and memory usage are measured for each algorithm. - All code is generated and executed within the app sandbox.