The Autotuning Challenge: How to Use $5 to Cover a Search Space Worth of $168K?
In Pt. 1 of this blog series, we discussed the challenge of using $5 and 24 minutes to autotune a search space worth $168K. To recap, with four tunable steps and three cogs, each with four options, the search space is (43)4=412, and searching the entire space using brute-force can cost around $168K and several weeks. While in Pt.1, we directly presented Cognify’s optimized workflow result, in this blog post, we dive deeper into the technique behind Cognify’s efficient and effective autotuning: the AdaSeek algorithm.
Cognify’s Secret Sauce: the AdaSeek Search Algorithm
The secret behind Cognify’s outstanding results is a novel adaptive hierarchical Bayesian Optimization (BO) search algorithm called AdaSeek that works as follows:
- [Result-Driven] Evaluation-Based Iterative Search: AdaSeek performs workflow autotuning in iterations. Each iteration, it samples a set of cog configurations to apply to the original workflow and evaluates the updated workflow using a user-provided input dataset and evaluators.
- [Efficient] Bayesian-Optimization-Based Sampling: AdaSeek samples new configurations using Tree-structured Parzen Estimator (TPE), a Bayesian optimization method that picks new configurations based on past evaluation results (instead of randomly).
- [Coverage] Hierarchical Search: AdaSeek organizes cogs into different hierarchies based on their type (by default, the top layer being architecture cogs, the middle layer being step cogs, and the bottom layer being weight cogs). AdaSeek chooses cogs in the topmost layer first, then under each chosen configuration, it chooses the next layer’s configurations until the bottom layer. In this way, we could force each layer to sample some values, allowing better coverage in the entire search space, even when the total search budget is small.
- [Budget-Aware] Adaptive Search Budget Allocation: AdaSeek assigns search budgets based on how promising a configuration looks, which means bad configurations are quickly eliminated, and the search focuses only on the most effective setups.
- If a certain workflow configuration performs well, AdaSeek focuses more resources on fine-tuning it (by exploring more cogs in the lower layers).
- If a workflow configuration performs poorly, it abandons that path and explores better alternatives.
- If exploration under a configuration converges (not showing much improvement over the past few rounds), it also stops exploring this path.
Now, let’s see AdaSeek in action:

Evaluation Results
Now, let’s look at the evaluation of Cognify with six representative gen-AI workflows (HotpotQA, Text-to-SQL, Data Visualization, Financial Analysis, Code Generation, and BIG-bench). As shown below, Cognify’s improved generation quality by up to 2.8x, cost cuts by 10x, and latency reduction by 2.7x compared to original expert-written workflows. Cognify outperforms DSPy and Microsoft Trace with up to 2.6x higher generation quality, up to 10x cost reduction, and up to 3x latency reduction.


The Takeaway
Powered by the innovative AdaSeek algorithm, Cognify delivers fully automated, efficient workflow tuning within users’ budgets. Our result outperformed state-of-the-art tuning algorithms on representative workflows. We invite you to try out Cognify on your own workflow, and share your experience and feedback with us. Let’s make the 30-minute process one of your best decisions.
Curious to dive deeper? Check out the Cognify research paper; get Cognify from GitHub; read Cognify’s Documentation.