Heuristic Analysis from Source Code via Symbolic-Guided Optimization

Pantea Karimi (PhD student · MIT), Siva Kesava Reddy Kakarla (Microsoft Research), Ryan Beckett (Microsoft Research), Santiago Segarra (Rice University), Pooria Namyar (Microsoft Research), Mohammad Alizadeh (MIT), Behnaz Arzani (Microsoft Research)

23rd USENIX Symposium on Networked Systems Design and Implementation (NSDI '26) · Day 3 · Self-Managing Networks

Overview

In large-scale networked systems, finding optimal solutions to complex resource allocation, traffic routing, and virtual machine placement problems is frequently slow or computationally intractable at scale. To maintain operational viability, systems engineers rely on approximate algorithms and heuristics—such as demand pinning in traffic engineering, first-fit decreasing in VM placement, and least-loaded queueing (LLQ) in load balancing. While these heuristics perform well under typical conditions, their approximate nature introduces structural risk: they can suffer from severe underperformance, performance degradation, and wasted infrastructure resources on adversarial or corner-case inputs. This risk is amplified by the increasing adoption of automated coding agents in production pipelines, which generate heuristic implementations with minimal human insight into their failure modes.

Watch on YouTube · Slides

Visual summary for Heuristic Analysis from Source Code via Symbolic-Guided Optimization by Pantea Karimi, Siva Kesava Reddy Kakarla, Ryan Beckett, Santiago Segarra, Pooria Namyar, Mohammad Alizadeh, Behnaz Arzani
Visual summary for Heuristic Analysis from Source Code via Symbolic-Guided Optimization by Pantea Karimi, Siva Kesava Reddy Kakarla, Ryan Beckett, Santiago Segarra, Pooria Namyar, Mohammad Alizadeh, Behnaz Arzani

Key moments

  1. 0:00 Introduction and the problem of heuristic underperformance
  2. 2:00 The performance gap and limitations of existing tools
  3. 3:58 Introduction to MetaEase and key design challenges
  4. 5:57 Gradient estimation for optimal and heuristic functions
  5. 9:36 Symbolic execution for seed generation and equivalence classes
  6. 11:47 Evaluation results compared to state-of-the-art analyzers
  7. 13:34 Conclusion and future outlook for continuous improvement

Heuristic Analysis from Source Code via Symbolic-Guided Optimization

Speakers: Pantea Karimi (PhD student, MIT); Siva Kesava Reddy Kakarla (Microsoft Research); Ryan Beckett (Microsoft Research); Santiago Segarra (Rice University); Pooria Namyar (Microsoft Research); Mohammad Alizadeh (MIT); Behnaz Arzani (Microsoft Research)

Conference: USENIX NSDI

YouTube: https://www.youtube.com/watch?v=OMeOKNjGZNw

Overview

In large-scale networked systems, finding optimal solutions to complex resource allocation, traffic routing, and virtual machine placement problems is frequently slow or computationally intractable at scale. To maintain operational viability, systems engineers rely on approximate algorithms and heuristics—such as demand pinning in traffic engineering, first-fit decreasing in VM placement, and least-loaded queueing (LLQ) in load balancing. While these heuristics perform well under typical conditions, their approximate nature introduces structural risk: they can suffer from severe underperformance, performance degradation, and wasted infrastructure resources on adversarial or corner-case inputs. This risk is amplified by the increasing adoption of automated coding agents in production pipelines, which generate heuristic implementations with minimal human insight into their failure modes.

This talk introduces MetaEase, the first general-domain heuristic analyzer that operates directly from source code. Developed by researchers from MIT, Microsoft Research, and Rice University, MetaEase bridges the gap between raw production code and rigorous performance verification. Rather than requiring developers to manually translate arbitrary heuristic logic into complex mathematical formulations—such as mixed-integer linear programs or satisfiability (SAT) constraints—MetaEase takes the actual production code as input alongside a standard optimal reference formulation. By combining symbolic execution with a novel gradient-guided optimization framework, MetaEase systematically discovers the worst-case failure scenarios (peaks in the performance gap landscape) of production heuristics without requiring exhaustive, expensive black-box sampling.

The implications for systems engineers and infrastructure teams are substantial. MetaEase shifts heuristic evaluation from an ad-hoc, trial-and-error process into an automated verification loop. By identifying failure modes prior to production deployment, infrastructure teams can perform targeted root-cause analysis, execute regression testing against code modifications, and safely deploy approximation algorithms in mission-critical environments.

Background

▶ Watch: Introduction and the problem of heuristic underperformance (0:00)

The foundational challenge addressed by MetaEase stems from a fundamental tension in systems engineering: the mathematical optimization problems governing large-scale infrastructures are often NP-hard or intractable at runtime. For example, computing optimal multi-commodity flows over large wide-area network (WAN) topologies involves solving massive linear or non-linear programs that cannot execute fast enough to keep pace with dynamic traffic shifts. Consequently, production systems rely on heuristics.

Consider traffic engineering in enterprise cloud networks. The inputs ($I$) represent traffic matrices, and the performance objective is to maximize routed traffic subject to link capacity constraints. The optimal solution, denoted $\text{opt}(I)$, is computationally expensive. In contrast, practical heuristics like demand pinning—previously deployed in production at Microsoft Azure—use straightforward conditional logic: traffic demands below a specific numerical threshold are pinned to the shortest available path, while larger demands are routed via an optimal solver. Prior analytical work demonstrated that demand pinning can incur a staggering 30% performance gap (defined as $\text{opt}(I) - \text{heuristic}(I)$) on specific network topologies. Tolerating a 30% shortfall in routed traffic translates directly to over-provisioned infrastructure, degraded user quality of experience, and inefficient capital expenditure.

Systematically locating these worst-case scenarios requires exploring a high-dimensional input space where the performance gap forms a complex landscape. Valleys represent regions where the heuristic performs close to optimal, while peaks represent failure scenarios. Prior community tools such as Explain, MetaOpt, and F-PAX attempted to map this landscape, but they suffer from a severe usability bottleneck: they require developers to manually encode arbitrary heuristic code into specialized mathematical formats (e.g., bilevel optimization problems with binary variables). If a developer modifies the heuristic or introduces a new algorithm, the entire encoding must be rewritten from scratch by an optimization expert. MetaEase eliminates this barrier by analyzing the heuristic directly from its source code.

Key Findings

▶ Watch: Introduction to MetaEase and key design challenges (3:58)

MetaEase establishes that automated heuristic analysis can be decoupled from manual mathematical encoding while matching or exceeding the efficacy of state-of-the-art verification tools. The primary findings and comparative evaluations presented in the talk include:

  • Superior Gap Discovery: When compared against MetaOpt (the state-of-the-art optimization-based heuristic analyzer) under identical time budgets, MetaEase consistently found larger performance gaps (expressed as gap ratios exceeding 100%). For demand pinning across five network topologies, MetaEase found gaps larger than 90% of those found by baseline methods, with the relative advantage scaling upward on larger topologies.
  • Domain Agnosticism: MetaEase successfully analyzed heuristics across disparate systems domains without structural modifications. This includes traditional network routing heuristics, deep neural network (DNN)-based traffic engineering heuristics (such as DOT), and randomized optical IP traffic engineering heuristics with non-convex behaviors (such as Arrow).
  • Efficiency via Gradient Separation: By decomposing the gradient of the performance gap into separate approximations for the optimal solver ($\nabla \text{opt}$) and the heuristic ($\nabla \text{heuristic}$), MetaEase avoids the prohibitive computational cost of repeatedly running expensive optimal solvers during the search phase.
  • Path-Aware Exploration: Using symbolic execution to partition the input space into code-path equivalence classes prevents the search from getting trapped in local maxima, a common failure mode for black-box fuzzers and random samplers.

Technical Design and Implementation

▶ Watch: Gradient estimation for optimal and heuristic functions (5:57)

The architecture of MetaEase addresses two primary technical hurdles: the extreme computational cost of gap sampling ($\text{opt}(I) - \text{heuristic}(I)$) and the non-smooth, multi-modal nature of the gap landscape, which is riddled with local maxima and sharp cliffs.

Gradient-Guided Gap Optimization

Computing the absolute performance gap requires evaluating both the optimal solver and the heuristic for every sampled input. Because $\text{opt}(I)$ is expensive, naive gradient ascent via finite differences over the gap function is intractable. MetaEase solves this by differentiating the gap equation analytically:

$$\nabla \left( \text{opt}(I) - \text{heuristic}(I) \right) = \nabla \text{opt}(I) - \nabla \text{heuristic}(I)$$

Instead of sampling the gap directly, MetaEase estimates $\nabla \text{opt}(I)$ and $\nabla \text{heuristic}(I)$ independently and subtracts them to determine the steepest ascent direction in the input space.

  • Approximating $\nabla \text{opt}(I)$: MetaEase leverages optimization duality theory to estimate the gradient direction of the optimal solution without repeatedly running the full solver to convergence. Taking a few local steps provides the gradient direction, avoiding the extensive iterations required to compute the absolute value of $\text{opt}(I)$.
  • Approximating $\nabla \text{heuristic}(I)$: Because the heuristic is an arbitrary piece of production code without a closed-form analytical derivative, MetaEase estimates its local gradient using Gaussian Processes (GPs). Around a current input point $I$, the system samples the heuristic locally within a defined block, executes the heuristic code on those samples, and fits a smooth, differentiable Gaussian Process over the results. The analytical gradient of the fitted GP then serves as $\nabla \text{heuristic}(I)$.

Symbolic-Guided Seed Generation

To prevent gradient ascent from stalling in local optima, MetaEase must select intelligent starting seeds that explore distinct behavioral regions of the input space. Random sampling is insufficient because complex heuristics contain conditional branches (e.g., if-else statements based on demand thresholds) that partition the input space into distinct execution paths.

MetaEase runs symbolic execution—specifically utilizing the KLEE symbolic execution engine—directly on the heuristic source code. Symbolic execution identifies the path conditions and generates representative input seeds for every feasible code path.

Within each code path, the heuristic's behavior is relatively smooth, but sharp, non-differentiable "cliffs" exist at the boundaries between paths. MetaEase restricts its gradient ascent search strictly within the boundaries of each individual code path. If a gradient step pushes the search outside the current path's validity domain, MetaEase projects the point back by moving to the most aligned point within the valid code-path region. This ensures thorough exploration of every execution branch, culminating in the identification of the absolute worst-case scenario across all paths.

Experimental Setup and Results

▶ Watch: Evaluation results compared to state-of-the-art analyzers (11:47)

The evaluation of MetaEase spans multiple problem domains, baseline frameworks, and network topologies, demonstrating its robustness and generality.

  • Baselines: MetaEase was benchmarked against MetaOpt (requiring manual mathematical encoding of the heuristic) and various black-box optimization approaches (including random sampling and standard fuzzing techniques).
  • Domains Tested:
  1. Traditional Traffic Engineering: Demand pinning heuristics evaluated across standard network topologies, including the Abilene topology and larger synthetic/real-world topologies.
  2. DNN-Based Systems: DOT, a deep neural network-based traffic engineering heuristic, compared against specialized DNN analyzers presented at HotNets 2024.
  3. Optical IP Traffic Engineering: Arrow, a randomized heuristic characterized by non-convex behaviors.
  • Metrics: The primary evaluation metric is the gap ratio, defined as the maximum performance gap found by MetaEase divided by the maximum gap found by the baseline method within an identical time budget.
  • Headline Results: Across demand pinning benchmarks on the Abilene topology and broader network structures, MetaEase consistently outperformed black-box optimization, finding significantly larger performance gaps in shorter timeframes. Against MetaOpt, MetaEase achieved comparable or superior gap identification (gap ratios exceeding 100%) while completely eliminating the requirement for manual mathematical encodings. In evaluating randomized and non-convex heuristics like Arrow, black-box approaches failed to systematically expose failure modes, whereas MetaEase successfully mapped the worst-case performance cliffs.

Practical Implications

▶ Watch: Conclusion and future outlook for continuous improvement (13:34)

For infrastructure teams, SREs, and machine learning engineers deploying optimization heuristics or AI-generated code, MetaEase offers a transformative paradigm for validation.

  1. Elimination of Encoding Overhead: Historically, formal verification and gap analysis required specialized knowledge in mathematical optimization (mixed-integer programming, binary variables, duality). By operating directly on source code, MetaEase lowers the adoption barrier, allowing software engineers to verify heuristics using the exact codebase deployed in production.
  2. Continuous Integration & Regression Testing: MetaEase is designed to fit into a continuous improvement pipeline. When developers modify a heuristic—whether manually or via automated coding agents—MetaEase can be triggered to perform regression testing, ensuring that code updates do not inadvertently introduce new worst-case failure cliffs.
  3. Root-Cause Analysis: By outputting specific worst-case input matrices and traffic patterns that trigger maximum degradation, MetaEase gives developers concrete artifacts to inspect, enabling targeted code hardening (e.g., adjusting threshold parameters in demand pinning logic).
  4. Trade-offs and Limitations: The effectiveness of MetaEase depends on the tractability of the underlying optimal formulation ($\text{opt}$), which must be computationally accessible for gradient estimation via duality theory. Additionally, while symbolic execution (KLEE) effectively handles discrete branching in moderate-sized codebases, extremely large or deeply nested codebases may experience path explosion, requiring developers to scope the symbolic analysis to critical heuristic kernels.

Key Takeaways

  • Source-Code First Analysis: MetaEase is the first general-domain heuristic analyzer that bypasses manual mathematical encodings, analyzing production heuristic code directly.
  • Gradient Separation: By computing $\nabla \text{opt}(I)$ via duality theory and estimating $\nabla \text{heuristic}(I)$ locally via Gaussian Processes, MetaEase avoids expensive gap sampling.
  • Symbolic-Guided Exploration: Utilizing KLEE symbolic execution to generate seeds per code-path equivalence class prevents the optimization process from getting trapped in local maxima.
  • Broad Domain Applicability: Proven effective across traditional routing heuristics (demand pinning), DNN-based networking heuristics (DOT), and randomized non-convex systems (Arrow).
  • Production CI/CD Integration: Positioned as a continuous verification tool for root-cause analysis, safe deployment, and regression testing of approximation algorithms.

About the Speaker(s)

Pantea Karimi is a PhD student in electrical engineering and computer science at MIT and a student researcher at Microsoft Research, focusing on systems optimization, formal verification, and network traffic engineering. The broader author team includes researchers and engineers from Microsoft Research (Siva Kesava Reddy Kakarla, Ryan Beckett, Pooria Namyar, Behnaz Arzani), MIT (Mohammad Alizadeh, Pantea Karimi), and Rice University (Santiago Segarra), combining expertise in networking, machine learning systems, and optimization theory.

Reviews

→ Top-rated talks at 23rd USENIX Symposium on Networked Systems Design and Implementation (NSDI '26)

All talks from 23rd USENIX Symposium on Networked Systems Design and Implementation (NSDI '26)