This paper, by Lewis Tham and Cayden Chik, asks one runtime question: when an agent holds a library of learned API routes, which one should fire for a given intent? Our answer was a learned energy score per (intent, route) pair, ranked lowest first, plus a content-addressed cache so a repeated selection becomes a lookup. It wins on discrete structure and gives nothing on free-form text, and the paper reports both halves.
Research paper, June 2026. Describes the design at the time. Status as of 12 October 2026: the energy head, its training loop and the benchmark gates below were research code in our June 2026 repository and are not in the hosted Unbrowse service; unbrowse.discover finds candidates by keyword search, then a hosted judgment model reads the task and each tool's description and picks one; keyword order stands when that model is unavailable or abstains. Section 5 below shows why a keyword fallback is a sensible default: on a public retrieval set, a plain keyword baseline beat the energy ranker.
Abstract
An autonomous agent accumulates a library of callable routes: learned first-party API endpoints, each answering some class of intent. The runtime question is selection. Given an intent, which route should fire?
We answer it the way biology already did, which is mildly embarrassing for the field. Each route is a cell that carries a scalar energy, the negative coherence between the intent and what the route is for, and it trains that energy every time it fires: a reward-weighted running-mean prototype, constant work per firing (the incremental weighted mean of West 1979 [7]), that folds toward the context on a good outcome and away from it on a bad one. Selection is then not a decision but a measurement: rank the library by ascending energy E(intent, route) and fire the lowest.
The operation is scale-free. It composes unchanged from a single unit up through an atom, cell, tissue, organ hierarchy, so select(select) = select all the way down. That is either a deep structural fact or the only trick we know, and the experiments do not require us to decide. A content-addressed cache makes a repeated selection a lookup, on the principle that a cell which already fired should not have to think again.
We report only reproduced results. On discrete-structure tasks the method wins: route ranking reaches R@1 = 0.0488, 4.6x a keyword baseline; access-pattern type classification reaches 0.71 to 0.81 accuracy, about 2.1x baseline across two seeds; a closed-loop learned ranker reaches a cold-cell AUC of 0.750 against 0.5 chance; the runtime-embedded head scores 0.83 warm and 0.64 cold; and a content-addressed cache yields a 92x mean speedup on a reuse micro-benchmark.
We are equally explicit about where the method gives nothing, because a ranker that wins everywhere is usually a ranker that has not been measured carefully. Energy-reranking a free-form language model's own generations is indistinguishable from random (lift +0.000), and on a public 101-route retrieval set a plain keyword baseline beats the energy ranker. The honest boundary is the contribution: a learned energy plus a content-addressed cache wins on discrete structure (route retrieval, type classification, cache reuse) and contributes nothing to free-form prose generation.
1. Introduction
Once an agent learns callable routes from real usage, it holds a growing tool library. Each route is a typed, replayable first-party endpoint that answers some class of intent; our April 2026 paper, Internal APIs Are All You Need [8], makes the case for calling those endpoints instead of driving a browser (summary: the arXiv paper explained).
The hard runtime problem is then no longer discovery but selection: given an incoming intent and dozens or hundreds of candidate routes, pick the one that actually answers it. A naive keyword or embedding match treats the library as a flat lexical index and ignores the structured signal in how a route was used and what it returned.
We frame selection as energy-based learning [1]. A learned energy head maps an (intent, route) pair to a scalar energy. Low energy means the route is compatible with the intent; high energy means it is not. The selector embeds the intent, scores every candidate, ranks the library by ascending energy, and fires the lowest-energy route.
The head is trained discriminatively from observed (intent, route, outcome) triples: routes that succeeded for an intent are pushed to low energy, routes that did not are pushed up. The trained head is small enough to embed directly in the runtime, so ranking is one inference pass, and a content-addressed cache stores each result under the hash of its content so a repeated selection resolves without recomputing.
We make one claim and bound it carefully. The method is a discrete-structure ranker. It wins where candidates carry separable structure (distinct routes, distinct access-pattern types), and it wins by a wide margin there. It is not a generative model and adds no signal to free-form text. Our contributions:
- An energy-based selector over an agent's route library, trained from observed outcome triples and embedded in the runtime for inference-time ranking.
- A reproduced evaluation on discrete-structure tasks (route ranking, access-pattern type classification, a closed-loop learned ranker, a runtime-embedded head, and content-addressed cache reuse), each with a runnable gate.
- An explicit negative-results section that sets the method's boundary: it does nothing for free-form generation, and a keyword baseline can beat it on a public retrieval set. The boundary is the result.
2. Related work
Energy-based and joint-embedding models
Energy-based models score the compatibility of an input pair with a single scalar and select by minimising that scalar, rather than normalising a probability over a large output space [1]. Joint-embedding predictive architectures extend the idea to representation learning: predict the latent of a target from the latent of a context and penalise the gap in embedding space [2]. We borrow the score-rank-select shape and apply it to a concrete, finite selection problem (which route fires) rather than to representation pre-training.
Retrieval and learned ranking
Dense retrieval embeds queries and documents into a shared space and ranks by similarity [3]; learning to rank optimises an ordering objective over candidates [4]. Our setting differs in the training signal. The candidates are routes, and the supervision is the observed outcome of firing a route for an intent, not a relevance label. The energy head is a discriminative ranker over that outcome signal.
Tool selection for agents
Tool-use work teaches a model when to call a tool [5] and to emit correct calls across many declared APIs [6]. These rank tools inside the language model's own forward pass. We separate selection from generation: a dedicated energy head ranks the route library, and the language model is left to do what it is good at. The negative-results section below is precisely the boundary between those two jobs.
3. Method
3.1 The selection problem
An intent q arrives against a library R = {r_1, ..., r_n} of candidate routes. A learned energy head E_θ scores each pair:
s_i = E_θ(q, r_i)
and the selector returns the lowest-energy route:
r* = argmin over r_i in R of E_θ(q, r_i)
or, for a shortlist, the library sorted by ascending s_i. Low energy encodes "this route answers this intent."
3.2 Training the energy head
The head is trained from (intent, route, outcome) triples logged at runtime. For an intent, the route that answered it is the positive; a sampled set of other library routes are the negatives. The objective pushes the positive's energy below the negatives' by a margin, so that the argmin selects the route that historically worked. Because the supervision is the real outcome of firing a route, the head improves as the agent accumulates usage. The ranker is closed-loop.
3.3 Embedding the head in the runtime
The trained head is small and loads directly into the live selection path, so ranking the library is one inference pass per resolution. A content-addressed cache sits in front of execution: each intermediate result is stored under the hash of its content, so a second identical selection resolves to a cached lookup instead of re-scoring and re-firing. Selection cost is paid once per distinct intent and amortised over every repeat.
3.4 The self-similar shape
The same score-rank-select shape recurs at more than one scale. Selecting which route fires is one energy ranking. Classifying a route's access-pattern type (for example anchor, server-rendered, structured query) is the same energy ranking over a small label set. One learned-energy mechanism serves both, which is why both appear in the evaluation.
4. Evaluation
We report only results backed by a runnable witness that re-ran green. Each row below names its gate in section 8. The energy path and each baseline are scored on the same held-out data.
4.1 Discrete-structure results (wins)
| Task | Metric | Energy | Baseline |
|---|---|---|---|
| Route ranking | R@1 (1 true route, 99 distractors) | 0.0488 | 0.0106 (keyword) |
| Access-pattern type | Accuracy, 2 seeds | 0.71 to 0.81 | 0.32 to 0.39 |
| Closed-loop ranker | Cold-cell AUC | 0.750 | 0.500 (chance) |
| Runtime-embedded head | Warm / cold score | 0.83 / 0.64 | none |
| Content-addressed cache | Reuse speedup | 92x | cold recomputation |
Route ranking. Ranking the true route against 99 distractors for a real intent, the energy head reaches R@1 = 0.0488 versus 0.0106 for a keyword baseline: a 4.6x improvement. The absolute number is small because the task is severe (1 in 100, with real, near-duplicate distractors). The relevant quantity is the multiple over the lexical baseline, and the learned energy more than quadruples it.
Access-pattern type classification. Energy-ranking a route's access pattern over a 7-class label set reaches 0.71 to 0.81 accuracy across two seeds, about 2.1x a baseline of 0.32 to 0.39. The structure here is discrete and separable, which is exactly the regime where the energy ranker is strong.
Closed-loop learned ranker. In the closed-loop variant, where the head trains on accumulated outcomes and then ranks unseen cells, it reaches a cold-cell AUC of 0.750 against 0.5 chance. The learned ranker generalises to cold cells; it does not just memorise warm ones.
Runtime-embedded head. Embedded in the live runtime of the time, the head scored 0.83 warm and 0.64 cold. The trained selector loaded and ranked inside the serving path, not only in an offline harness.
Content-addressed cache reuse. The cache yields a 92x mean speedup on a reuse micro-benchmark that isolates a warm cached selection against a cold recomputation. This is a mechanism demonstration: it shows the categorical gap between warm and cold, not an end-to-end task number.
5. Honest negatives: where the method gives nothing
The boundary of the method matters as much as its wins, and we report it as measured failure, not omission.
| Task | Result | Reading |
|---|---|---|
| Rerank a language model's generations | lift +0.000 | same as random |
| Public 101-route retrieval set | keyword wins | baseline beats energy |
Free-form generation: nothing. Using the energy head to rerank a free-form language model's own candidate generations produces a lift of +0.000, indistinguishable from random selection. The energy carries no signal about free-form answer quality. This is the sharp edge of the method: it ranks discrete candidates with separable structure, and a model's prose continuations are neither.
Public retrieval: a keyword baseline can win. On a public 101-route retrieval set, a plain keyword baseline beats the energy ranker. We do not hide this behind the favourable route-ranking number above. The energy ranker's advantage is not universal; on some retrieval distributions a lexical match is simply better, and the method should not be deployed as if it dominates everywhere.
The boundary, stated plainly. Taken together, the wins and the negatives draw one line: a learned energy plus a content-addressed cache wins on discrete structure (route retrieval, type classification, cache reuse) and contributes nothing to free-form prose generation. The selector picks which route fires. It does not, and should not, replace the language model that writes text.
6. Discussion
The result is deliberately narrow. Energy-based selection is the right tool when the candidate set is finite, the candidates carry separable structure, and there is an observed outcome signal to train on, which is exactly the situation of a runtime choosing among an agent's learned routes. It is the wrong tool when the "candidates" are open-ended text continuations, because the energy has no separable structure to score; there, the measured lift is zero. Reporting the zero is the point. The inverse of optimising a metric until it stops meaning anything is naming, precisely, where the metric goes flat.
Two consequences follow. First, selection and generation are best kept as separate responsibilities: a discriminative ranker for which route, a generative model for what to say. Second, the absolute route-ranking number is a floor, not a ceiling. It is a 1-in-100 task with real distractors, and the load-bearing quantity is the 4.6x multiple over the lexical baseline, which the cache then makes cheap to serve repeatedly.
A note added on 12 October 2026: as of that date, the hosted service has kept the first consequence and not the specific ranker. Discovery separates which tool from what the agent says, but the picker is keyword retrieval followed by a hosted judgment model, with keyword order as the fallback. The second negative above is the standing warning for any learned ranker, ours included: measure it against the keyword list it is meant to improve on, because it can lose. The companion paper on benchmarks, Run It or It Didn't Happen, applies the same "report the negatives" rule to a small tool-routing model.
7. Conclusion
We presented energy-based route ranking: a learned energy head that scores (intent, route) compatibility, ranks an agent's tool library by ascending energy, and fires the lowest-energy match, trained from observed outcome triples and embedded in the runtime with a content-addressed cache. On discrete-structure tasks the method won and reproduced: route ranking at 4.6x a keyword baseline, type classification at about 2.1x, a closed-loop ranker at AUC 0.750, a runtime head at 0.83 warm and 0.64 cold, and a 92x cache reuse speedup. On free-form generation it won nothing (lift +0.000), and on at least one public retrieval set a keyword baseline beat it. The contribution is the line between those two halves. The method is a discrete-structure selector, and naming where it stops is what makes the wins trustworthy.
If you want to see how route selection works in the product as of 12 October 2026, start with unbrowse.discover in the docs.
8. Reproducibility
Every reported number re-ran from a single command in our June 2026 research repository, which is internal; the list below is a record of what backed each number. The full set ran with bash bench/energy/reproduce-all.sh. Individual gates:
- Route ranking (R@1, 4.6x):
bench/energy/route-ranking-gate.sh - Access-pattern type classification (about 2.1x, two seeds):
bench/energy/intent-type-gate.sh - Closed-loop learned ranker (cold-cell AUC 0.750):
bench/ebm-closed-loop-gate.sh - Runtime-embedded head (0.83 warm, 0.64 cold):
bench/ebm-runtime-ship-gate.sh - Content-addressed cache reuse (92x):
paper/reference/bench/bench_reuse.py
Each gate exits 0 only when its measured number clears its threshold, so a regression fails honestly rather than printing a stale figure. The negatives were recorded in the same accumulating ledger as the wins, so the boundary is part of the reproduced record, not an aside.
References
- Y. LeCun, S. Chopra, R. Hadsell, M. Ranzato, F. Huang. A Tutorial on Energy-Based Learning. In Predicting Structured Data, MIT Press, 2006. https://cs.nyu.edu/~yann/research/ebm/
- M. Assran et al. Self-Supervised Learning from Images with a Joint-Embedding Predictive Architecture. CVPR, 2023. https://arxiv.org/abs/2301.08243
- V. Karpukhin et al. Dense Passage Retrieval for Open-Domain Question Answering. EMNLP, 2020. https://arxiv.org/abs/2004.04906
- C. Burges et al. Learning to Rank using Gradient Descent. ICML, 2005. https://doi.org/10.1145/1102351.1102363
- T. Schick et al. Toolformer: Language Models Can Teach Themselves to Use Tools. NeurIPS, 2023. https://arxiv.org/abs/2302.04761
- S. G. Patil et al. Gorilla: Large Language Model Connected with Massive APIs. arXiv:2305.15334, 2023. https://arxiv.org/abs/2305.15334
- D. H. D. West. Updating Mean and Variance Estimates: An Improved Method. Communications of the ACM 22(9), 1979. https://doi.org/10.1145/359146.359153
- L. Tham et al. Internal APIs Are All You Need: Shadow APIs, Shared Discovery, and the Case Against Browser-First Agent Architectures. arXiv:2604.00694, 2026. https://arxiv.org/abs/2604.00694