Retrieval API for Post-Training Data: Leakage, Replay, Cost and Rights
.png)

TLDR: A retrieval API for post-training data has to do four jobs well: keep benchmark answers out of rollouts, return the same evidence when a run is replayed, fit a per-rollout budget for calls and tokens, and come with terms that allow training. In our 13 November 2026 test, 2 of 40 SimpleQA questions pulled a HuggingFace copy of the question and answer into the top 10. Check all four before you choose.
What a retrieval API does in post-training
Search shows up at three points in a post-training pipeline, and each stresses the API differently.
| Job | What the API does | What matters most | What breaks if you ignore it |
|---|---|---|---|
| Build the data | Find source pages for synthetic QA, generate SFT traces, run difficulty filtering | Coverage, page content, cost at volume | Questions that only test Wikipedia recall, or a filtering bill that rivals the RL run |
| Serve rollouts | Answer the policy's tool calls during RL | Throughput, latency, tokens per call, stable results | GPUs waiting on 429s, rewards that drift because the web changed mid-run |
| Grade and evaluate | Back the agent's search during held-out evals | Leakage control, date cutoffs, replay | Scores inflated by answers copied from dataset mirrors |
The published example to learn from is the three-week sprint in which CoreWeave, NVIDIA and You.com post-trained Nemotron 3.5 Lightning for agentic search. CoreWeave's write-up reports BrowseComp accuracy rising from 36.97% to 45.45% while average tool calls per task fell from about 168 to 115. The data side used 4,932 SFT traces and 1,480 RL tasks trained with GRPO and a binary judge reward. Questions were filtered by running each one eight times and keeping those the model sometimes solved. It also says that tuning the search endpoints for post-training consistency improved performance by about 4% before any training happened: the retrieval layer sets a ceiling on what training can reach.
RAG vs fine-tuning covers whether to train at all. This guide assumes you are training an agent to search and need to pick what it searches.
Leakage: what our live test found
Search-time contamination happens when a search returns a page that contains the test question and its answer, so the agent copies instead of reasoning. Scale AI's Search-Time Data Contamination paper found that for about 3% of Humanity's Last Exam questions, Perplexity's Sonar agents retrieved a HuggingFace copy of the dataset. For SimpleQA the rate was 0.99% to 1.20%. Blocking HuggingFace cut accuracy on the contaminated subset by about 15%. A June 2026 study from Alibaba and NTU, Search-Time Contamination in Deep Research Agents, measured inflation of up to 4% across six public medical question-answering benchmarks.
We ran a smaller, harsher version on 13 November 2026. We drew 40 questions at random from OpenAI's public SimpleQA test set (random.Random(20261113).sample(range(4326), 40) over the CSV rows), sent each one verbatim through You.com's keyless MCP search tool (top 10, highlights on), and checked every result for the question text and the answer.
| Check | Result |
|---|---|
| Questions with a page carrying both question and answer | 3 of 40: two on huggingface.co (3 pages, ranked 7th to 9th) and one on a blog post that quotes the pair, ranked 3rd |
| HuggingFace pages found | 3 third-party datasets: a SimpleQA Verified copy, a Qwen3-8B variant of it, and a model-eval log with the answer beside a wrong prediction |
| Other question echoes | 1 student Q&A page with a near-identical multiple-choice question and a different answer |
| Questions whose answer string appeared somewhere in the top 10 | 39 of 40. Answers are ordinary facts, so a page that states one is not a leak by itself |
The 3 leaking questions rerun with exclude_domains: ["huggingface.co"] | 0 HuggingFace pages; the blog post stayed at rank 3; the answer still appeared in the top 10 for all 3 |
Two caveats keep this honest. Pasting the exact question is the worst case, because agents usually rephrase. And 40 questions is a small sample: 2 of 40 is 5%, against about 1% in the Scale paper, so read it as "often enough to plan for", not as a rate. As in the Scale paper, the leaks were third-party copies, not the original dataset. Gating the official copy does not help, and a blocklist keyed to one host misses the next mirror, or a blog post that quotes the pair, as ours did. You need two layers: exclude known dataset hosts at the API, then drop any returned page that echoes a held-out question.
Date cutoffs are not a time machine
The other standard defense is a date filter: only return pages from before the benchmark's release. We reran the first 20 of the questions with You.com's freshness range set to 1990-01-01to2024-10-29, the day before OpenAI published SimpleQA.
- The HuggingFace pages disappeared, along with nearly every undated result. Unfiltered, 74 of the 199 results had no
page_age; filtered, 1 of 200 had none. - Wikipedia results fell from 17 to 3, all non-English pages dated before the cutoff. All 39 Wikipedia results across the full 40-question run had a
page_ageafter it. - The answer dropped out of the top 10 for 1 of the 19 questions that had it, one whose only source was the blog post that quotes it.
- 7 of the 200 filtered results still carried a
page_ageafter the cutoff, dated from March to November 2026.
So a date filter is a blunt tool. It removed the leaks here because the HuggingFace pages carried no date, and it took good evidence with them. You.com's API reference defines web page_age only as "the age of the search result", which is not a crawl or capture timestamp. Scale's team saw the same dependence on metadata in Perplexity's date filter, which can leave pages with missing metadata unfiltered. If an eval must be leakage-safe by construction, you need retrieval that gates on capture time. The options differ mainly on that point:
| Approach | Example | Same results on replay | Leakage control | Trade-off |
|---|---|---|---|---|
| Live web search API | You.com, Tavily, Firecrawl, Exa | Only if you record responses | Domain and date filters where offered; date filters key off page metadata | Current web, but it moves under you |
| Pinned index | Linkup | Yes, by arrangement | Fixed index plus a "time machine" date | Pinning and the RL API are separate offerings you negotiate |
| Point-in-time archive | OpenReward BackSearch | Yes, per as_of date | Gates on capture date for web and news, official dates for SEC, arXiv and Wikipedia | General web coverage starts 2025-06-12, Wikipedia 2026-02-01; $10 per 1,000 searches, 2 requests per second sustained |
| Local corpus | Search-R1 with a 2018 Wikipedia dump (paper) and an E5 or BM25 retriever | Yes | Complete, you own the corpus | Stale and Wikipedia-heavy |
A practical split: use a live API to build data and serve RL rollouts, record every response, and grade held-out evals against either the recording or a point-in-time archive. We reran 10 of the queries three minutes later and got identical top-10 URL lists in the same order, which says nothing about a multi-day run, so record responses anyway.
Cost and context per rollout
Search spend in RL scales with every multiplier in the loop:
searches = tasks × rollouts per task × epochs × searches per rollout
Here is an illustrative run built on the CoreWeave task count, with assumptions you should replace with your own. Take 1,480 tasks, 8 rollouts per task (the default group size in Hugging Face TRL's GRPO trainer), one epoch, and 50 searches per rollout. CoreWeave's 115 tool calls per task were not all searches: in its worked trace, only 149 of the base model's 313 calls were searches, with 118 page fetches and 46 shell commands making up the rest. That comes to 592,000 searches, or $2,960 at You.com's $5 per 1,000 calls (billing, as of November 2026). The same volume on BackSearch would be $5,920. Difficulty filtering runs eight attempts per candidate question, so every 1,000 candidates at 50 searches each adds another 400,000 searches.
Throughput is often the tighter limit. You.com's self-serve default is 10 requests per second on /v1/search (rate limits). At that rate, 592,000 searches take about 16.4 hours of pure search time, about twice the roughly 8 hours CoreWeave reported for its whole RL run. Tavily advertises up to 1,000 searches per second on its post-training page. Get the contracted rate in writing before you size the cluster.
Tokens are the cost people forget, because the policy reads every result. In our 40-question run, a 10-result call with highlights returned a median of 31,912 characters of titles, descriptions and excerpts, about 8,000 tokens at four characters per token. On 8 of the questions rerun with plain snippets, the median fell from 31,044 to 13,822 characters, and the answer appeared in all 8 either way. At 50 searches per rollout, default highlights add up to roughly 400,000 tokens of retrieved text, about three times a 128,000-token context window. On the REST API, set count to 5 and highlights.total_max_tokens to 2,048 (the allowed range is 1,024 to 8,192). The cap is approximate, but it keeps a 50-search rollout near 100,000 tokens of retrieved text.
Training rights: read the terms before the first rollout
Check this before the first rollout, because it can sink a dataset after the compute is spent. Storing results for replay, or training them into weights, may fall outside what your API license covers. Here is what each provider's own terms said on 13 November 2026:
| Provider | What the terms say | What it means for post-training |
|---|---|---|
| You.com | The AUP bars training or fine-tuning on Search Content, and copying or storing significant portions for re-use, without written authorization. The MSA allows training, or evaluating for that purpose, only as specified in an Order Form. | Post-training on You.com runs under an Order Form. Talk to sales before you record a replay cache or generate traces. |
| Tavily | The help center says you may store and cache Search, Extract and Crawl results long term with no deletion requirement. Its AI-generated answers may not be used to build competing models, and publisher rights stay with you. | Permissive on storage; check publisher terms for full-page content. |
| Exa | The terms of service (section 4.2) bar copying, reproducing or creating derivative works from information obtained through the Services unless Exa permits it in writing. | Get written permission before building a stored training set. |
| Firecrawl | Its AI training page says you decide which sites go into a training set and are responsible for complying with each site's terms. | Built for training use; site-level compliance is yours. |
Publisher opt-outs sit underneath all of this. NVIDIA's NeMo Gym Tavily environment requires an approved domain-exclusion policy file and enforces it locally on both requested and returned URLs. One reason is that Tavily's /search accepts at most 150 exclude_domains. NVIDIA's docs add that "a finite exclusion list cannot prevent all online answer exposure." You.com's /v1/search accepts up to 5,000 excluded domains (request controls), enough for a real opt-out registry in one request. Enforce it locally anyway.
A replayable, leak-guarded search tool in Python
The tool below is the policy's search function during SFT trace generation and RL. In record mode it calls POST https://ydc-index.io/v1/search on a cache miss and stores the response. In replay mode it never touches the network, so every epoch and every eval rerun sees the same environment. It sends known dataset hosts as exclude_domains, re-checks returned URLs locally, drops any page that echoes a held-out question, caps highlights per call, and enforces a per-rollout call budget. A failed call returns an error result and is never cached, so an outage is not replayed as evidence.
import hashlib, http.client, json, os, re, sqlite3, urllib.request
from urllib.parse import urlparse
API = "https://ydc-index.io/v1/search"
BLOCKED_HOSTS = {"huggingface.co", "kaggle.com", "github.com",
"raw.githubusercontent.com", "paperswithcode.com"}
def norm(text):
return re.sub(r"\W+", " ", text.lower()).strip()
def host_blocked(url, blocked):
host = urlparse(url).netloc.lower()
return any(host == b or host.endswith("." + b) for b in blocked)
class RolloutSearch:
"""Search tool for SFT trace generation and RL rollouts.
mode="record": call the API on a cache miss and store the response.
mode="replay": never touch the network; a miss returns no results,
so every epoch sees the same environment.
"""
def __init__(self, db_path, eval_questions=(), mode="record",
max_calls_per_rollout=40, count=5, max_tokens=2048,
blocked=BLOCKED_HOSTS, cutoff=None):
self.db = sqlite3.connect(db_path)
self.db.execute("CREATE TABLE IF NOT EXISTS cache (k TEXT PRIMARY KEY, v TEXT)")
self.mode, self.blocked, self.cutoff = mode, set(blocked), cutoff
self.count, self.max_tokens = count, max_tokens
self.max_calls = max_calls_per_rollout
# 60-character prefixes of held-out questions, used to catch mirrors
self.probes = [norm(q)[:60] for q in eval_questions if len(norm(q)) >= 30]
self.calls = 0
self.log = []
def new_rollout(self):
self.calls = 0
def _key(self, query):
body = {"q": norm(query), "count": self.count, "tok": self.max_tokens,
"blocked": sorted(self.blocked), "cutoff": self.cutoff}
return hashlib.sha256(json.dumps(body, sort_keys=True).encode()).hexdigest()
def _fetch(self, query):
body = {"query": query, "count": self.count,
"exclude_domains": sorted(self.blocked),
"extraction": {"extraction_mode": "highlights",
"highlights": {"total_max_tokens": self.max_tokens}}}
if self.cutoff:
body["freshness"] = self.cutoff # e.g. "1990-01-01to2024-10-29"
req = urllib.request.Request(API, data=json.dumps(body).encode(), headers={
"X-API-Key": os.environ["YDC_API_KEY"], "Content-Type": "application/json"})
with urllib.request.urlopen(req, timeout=30) as resp:
return json.load(resp)
def _clean(self, data):
kept = []
for r in (data.get("results") or {}).get("web") or []:
url = r.get("url", "")
text = norm(" ".join([r.get("title") or "", r.get("description") or ""] +
((r.get("contents") or {}).get("highlights") or [])))
if host_blocked(url, self.blocked):
self.log.append(("blocked_host", url))
continue
if any(p in text for p in self.probes):
self.log.append(("question_echo", url))
continue
kept.append({"url": url, "title": r.get("title"),
"text": (r.get("contents") or {}).get("highlights") or [],
"page_age": r.get("page_age")})
return kept
def __call__(self, query):
if self.calls >= self.max_calls:
return {"error": "search budget for this rollout is spent", "results": []}
self.calls += 1
key = self._key(query)
row = self.db.execute("SELECT v FROM cache WHERE k = ?", (key,)).fetchone()
if row:
data = json.loads(row[0])
elif self.mode == "replay":
self.log.append(("replay_miss", query))
return {"results": []}
else:
try:
data = self._fetch(query)
except (OSError, ValueError, http.client.HTTPException) as err:
# HTTP 429 or 5xx, timeout, dropped connection, non-JSON body.
self.log.append(("fetch_error", repr(err)))
return {"error": f"search failed: {err}", "results": []} # never cached
self.db.execute("INSERT OR REPLACE INTO cache VALUES (?, ?)", (key, json.dumps(data)))
self.db.commit()
return {"results": self._clean(data)}
We tested it offline with the network call stubbed: 19 unit tests, including a replay run that fails if it touches the network, failure paths for a 429, a timeout, a dropped connection and a non-JSON 200 response, and a pass over the 40 real responses from our leakage test. The keyless MCP tool returns the same results.web fields as the REST API, so those captures exercise the real response shape. The paid REST call itself was not run. On those 40 responses the host block removed the 3 HuggingFace pages, and the question-echo check dropped the blog post and the student Q&A page that no blocklist knew about.
Three cautions. Excluding github.com hurts coding tasks, so tune the host list per task. The cache is the "store for re-use" the You.com AUP mentions, so run it under your Order Form. The SQLite connection cannot be shared across threads, so give each worker its own instance. For 429s, add retries with backoff as the rate-limit docs describe; Build Production-Ready AI Agents shows a gateway that does it.
For grading the agent once it is trained, the You.com web search eval harness and the AI agent evaluation guide cover scoring and harness design.
Where You.com fits, and where it does not
You.com fits the live half of the pipeline, building web-grounded questions, generating traces and serving rollouts, and it has a published post-training result behind it. The Web Search API gives you a 5,000-domain exclusion list, date ranges, and highlight budgets for controlling rollout context, at $5 per 1,000 calls. To snapshot the exact pages behind a synthetic question, the Contents API takes a batch of URLs, returns clean Markdown, skips its cache with max_age: 0, and costs $1 per 1,000 pages. It extracts page content; it is not a crawler, so pair it with search or your own URL list.
Where it does not fit:
- No point-in-time search. The search request has no
as_ofdate or pinned-index option, so grade leakage-safe evals against a recording or a capture-dated archive. - Training needs a contract. A self-serve key does not license training on results or storing significant portions of them for re-use.
- Default throughput is modest. 10 requests per second suits prototyping; RL at volume needs a contracted limit or a warm replay cache.
- No NeMo Gym server yet. CoreWeave says the team is upstreaming a You.com search provider, but as of 13 November 2026 the repo's resource servers include
tavily_searchandgoogle_searchand no You.com server.
Whichever provider you choose, run the leakage check on your own benchmark first. Ours took 40 searches, about 20 cents at list price, and it shows whether your benchmark is already sitting in the index.
Frequently Asked Questions
A retrieval API for post-training data is the search or fetch service an AI team uses while building training data and running reinforcement learning. It finds source pages for synthetic questions, answers the policy's tool calls during rollouts, and backs held-out evals. Beyond result quality, it must control benchmark leakage, return the same evidence on replay, fit a per-rollout budget, and come with terms that permit training use.
Use two layers. Send known dataset hosts such as huggingface.co as excluded domains, then drop any returned page that repeats a held-out question. In our 13 November 2026 test, 2 of 40 SimpleQA questions surfaced HuggingFace copies carrying the answer, and excluding that host removed all of them. A blog post quoting one pair stayed in the results, so the local question-echo check catches pages that no blocklist knows about.
Only if the provider's terms allow it. You.com's acceptable use policy bars training on Search Content, or storing significant portions for re-use, without written authorization, so post-training runs under an Order Form. Exa's terms require written permission to copy information obtained through its service. Tavily's help center permits long-term storage of results. Publisher rights apply in every case, so check site terms too.
No. A date filter works on page metadata, not on when a page was captured. When we limited You.com search to pages dated before SimpleQA's release, the HuggingFace pages vanished, but so did 14 of 17 Wikipedia results, and 7 of 200 results still showed later dates. For leakage-safe evals, grade against recorded responses or a point-in-time archive that gates on capture date.
Multiply tasks by rollouts per task, epochs and searches per rollout. An illustrative run of 1,480 tasks with 8 rollouts each and 50 searches per rollout needs 592,000 searches, about $2,960 at You.com's $5 per 1,000 calls. Throughput matters as much as price: at the self-serve default of 10 requests per second, that volume takes roughly 16 hours of search time.
LI Test
LI Test
Share Article:
Related resources.
.webp)
Search 1B+ professional profiles, 100M+ companies with Knowledge Pro
December 2, 2026
Product Updates

Introducing the You.com Extract API: fetch and parse any URL, with 80% higher accuracy on PDFs
November 17, 2026
Product Updates

FDA Approval Monitoring API: Sources, Lag and a Working Pipeline
November 15, 2026
Blog

Equity Research Automation API: What to Automate and How to Check the Numbers
November 14, 2026
Blog

Retail Assortment Monitoring API: How to Track What Competitors Add, Drop, and Carry
November 13, 2026
Blog