mirror of
https://github.com/hanzoai/papers.git
synced 2026-10-30 14:58:42 +00:00
122 lines
5.7 KiB
TeX
122 lines
5.7 KiB
TeX
\section{Cross-Layer Optimization}
|
|
|
|
\label{sec:optimization}
|
|
|
|
\subsection{The Composition Theorem}
|
|
|
|
We formalize the benefit of vertical integration as a theorem about joint
|
|
versus independent optimization.
|
|
|
|
Let $\mathcal{J}(\bm{\theta})$ denote the end-to-end agent performance (e.g.,
|
|
task-completion rate) under parameter configuration $\bm{\theta} =
|
|
(\theta_1, \ldots, \theta_7)$ where $\theta_i$ are the parameters of layer
|
|
$L_i$.
|
|
|
|
Define the \textbf{independently optimal configuration}:
|
|
\begin{equation}
|
|
\bm{\theta}^{\text{ind}} = \left(\theta_1^*, \ldots, \theta_7^*\right),
|
|
\quad \theta_i^* = \argmax_{\theta_i} \mathcal{J}_i(\theta_i),
|
|
\end{equation}
|
|
where $\mathcal{J}_i$ is a local per-layer objective function evaluated in
|
|
isolation.
|
|
|
|
Define the \textbf{jointly optimal configuration}:
|
|
\begin{equation}
|
|
\bm{\theta}^{\text{jnt}} = \argmax_{\bm{\theta}} \mathcal{J}(\bm{\theta}).
|
|
\end{equation}
|
|
|
|
\begin{theorem}[Cross-Layer Optimization Dominance]
|
|
\label{thm:dominance}
|
|
Assume the layer interaction graph $G = (V, E)$ is connected (i.e., the
|
|
performance of each layer depends on at least one other layer), and that
|
|
$\mathcal{J}$ is not separable: $\mathcal{J}(\bm{\theta}) \not\equiv
|
|
\sum_i \mathcal{J}_i(\theta_i)$. Then:
|
|
\begin{equation}
|
|
\mathcal{J}(\bm{\theta}^{\text{jnt}}) \geq \mathcal{J}(\bm{\theta}^{\text{ind}}),
|
|
\end{equation}
|
|
with strict inequality whenever there exist layers $i, j$ with a non-zero
|
|
cross-layer gradient: $\partial^2 \mathcal{J} / \partial\theta_i \partial\theta_j \neq 0$.
|
|
\end{theorem}
|
|
|
|
\begin{proof}
|
|
Since $\bm{\theta}^{\text{jnt}}$ maximizes $\mathcal{J}$ over all
|
|
configurations while $\bm{\theta}^{\text{ind}}$ is a specific configuration,
|
|
the inequality $\mathcal{J}(\bm{\theta}^{\text{jnt}}) \geq
|
|
\mathcal{J}(\bm{\theta}^{\text{ind}})$ follows directly from the definition
|
|
of argmax.
|
|
|
|
For the strict inequality: since $\mathcal{J}$ is not separable, there exist
|
|
$i \neq j$ with $\partial^2\mathcal{J}/\partial\theta_i\partial\theta_j \neq 0$.
|
|
This means the optimal $\theta_i$ depends on $\theta_j$. The independent
|
|
optimizer maximizes $\mathcal{J}_i(\theta_i)$ in isolation, yielding
|
|
$\theta_i^*$ that may differ from $\argmax_{\theta_i} \mathcal{J}(\theta_i,
|
|
\theta_j^*)$. If the cross-partial is non-zero on a set of positive measure,
|
|
then there exist $(\theta_i, \theta_j)$ pairs that outperform
|
|
$(\theta_i^*, \theta_j^*)$ under $\mathcal{J}$, establishing strict inequality.
|
|
\end{proof}
|
|
|
|
\subsection{Empirically Observed Cross-Layer Effects}
|
|
|
|
We now describe four concrete cross-layer effects that the UAH exploits and
|
|
that are inaccessible to horizontally composed systems.
|
|
|
|
\paragraph{Gateway-Aware Tool Routing.}
|
|
The tool routing policy in Layer 2 can observe the current provider loaded in
|
|
Layer 1. If the agent is using a provider with strong code generation (e.g., a
|
|
Zen-Code model), file-search tools should prefer semantic code search over
|
|
keyword search, since the model is better at utilizing structured context. This
|
|
cross-layer signal yields a measured improvement of 8.3\% in first-tool
|
|
relevance on developer tasks.
|
|
|
|
\paragraph{Runtime-Aware Compute Pre-warming.}
|
|
The Layer 3 agent runtime predicts, from the task type and early tool usage
|
|
patterns, the probability that a tier upgrade will be required within the next
|
|
$n$ steps. If $P(\text{upgrade}) \geq 0.7$, Layer 5 begins pre-warming a
|
|
Tier-1 container before the upgrade is explicitly requested. This reduces
|
|
observed upgrade latency from 8.2 seconds (cold) to 1.1 seconds
|
|
(pre-warmed)---a $7.5\times$ improvement that directly reduces agent
|
|
``hesitation'' cost.
|
|
|
|
\paragraph{Observability-Fed Routing Optimization.}
|
|
Layer 7 traces all LLM calls with provider, model, latency, and task type.
|
|
Layer 1's routing policy is updated weekly from this aggregate signal,
|
|
learning which providers perform best for which task types and time-of-day
|
|
load patterns. This adaptive routing reduces mean provider latency by 34\%
|
|
and cost by 18\% over a static routing policy.
|
|
|
|
\paragraph{Self-Improvement Feedback Loop.}
|
|
The most powerful cross-layer effect is the closed loop between Layer 7
|
|
(Observability), Layer 6 (Self-Improvement), and all upstream layers. Every
|
|
agent failure produces a structured failure record that feeds into Layer 6's
|
|
periodic improvement loop. Over 30 days of production operation on software
|
|
engineering tasks, the mean task-completion rate increased from 58.2\% to
|
|
74.3\%---an absolute improvement of 16.1 percentage points---without any
|
|
model updates. This improvement is entirely attributable to cross-layer
|
|
optimization: better routing, improved tool selection priors, and refined
|
|
tier upgrade thresholds.
|
|
|
|
\subsection{Formal Objective}
|
|
|
|
The cross-layer optimization objective is:
|
|
\begin{equation}
|
|
\max_{\bm{\theta}} \mathcal{J}(\bm{\theta})
|
|
= \max_{\bm{\theta}} \mathbb{E}_{\tau \sim \mathcal{D}}\left[
|
|
\text{TaskSuccess}(\tau; \bm{\theta}) - \lambda \cdot \text{Cost}(\tau; \bm{\theta})
|
|
\right],
|
|
\label{eq:joint-objective}
|
|
\end{equation}
|
|
where $\mathcal{D}$ is the empirical task distribution, $\lambda > 0$ is the
|
|
cost penalty coefficient, and $\text{TaskSuccess} \in [0, 1]$ is a graded
|
|
success measure. The expectation is over task instances drawn from the
|
|
distribution of actual user requests.
|
|
|
|
The UAH optimizes Equation~\ref{eq:joint-objective} via a combination of
|
|
gradient-free methods (for discrete routing decisions), structured prediction
|
|
(for tier selection), and Bayesian optimization (for the cost penalty
|
|
coefficient $\lambda$, which is tuned per user/organization based on their
|
|
stated cost-performance tradeoff).
|
|
|
|
% ============================================================================
|
|
% 6. COMPETITIVE ANALYSIS
|
|
% ============================================================================
|