feat(superforcaster_full_search-v1): criterion-specificity screen + structured outputs for overconfident-YES fix - #442
Draft
valory-coding-agent[bot] wants to merge 1 commit into
Conversation
…tructured outputs Fixes overconfident-YES on narrow-criterion Polymarket questions (issue #440). The root cause (confirmed on 8/8 IPFS deliveries): superforcaster_full_search treats topical relevance as criterion-satisfaction confirmation. It sees a page about X and assigns high p_yes to "Will X be in headlines this week?" without checking whether any TYPE A evidence (dated within the resolution window, or directly confirming the criterion) actually supports the narrow condition. Fix: new version superforcaster_full_search-v1 adds: 1. evidence_reliability_screen structured-output field (4a-4d from superforcaster-polymarket-v4): forces TYPE A/B temporal classification and criterion-specificity check before probability formation. 2. OpenAI Structured Outputs via client.beta.chat.completions.parse + PredictionResult Pydantic schema (Hard Constraint 0 compliance). Only the four numeric fields are returned on-chain. 3. max_tokens 500 -> 4096 (chain-of-thought fields require full token budget). 4. Full-page scraping infrastructure preserved (the distinguishing feature). Source-change size (pre-lint): ~118 LOC net new (803 total, 685 parent). One mechanism: evidence-reliability screen before probability formation. Baseline to beat: C-1 Brier=0.3621, C-2 Brier=0.2835 (n=105 each, polymarket).
Author
|
[human-input] — investigation memory file missing; cannot complete Sub-pipeline D automatically. Gap: The PR body contains the full investigation detail, so a human can unblock this in one of two ways: Option A — post the benchmark command manually (fastest): Post these two comments on the PR in order:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What happened and what we did
The tool was producing overconfident YES predictions (Brier C-1=0.3621, above the 0.25 chronic-bad threshold) on Polymarket narrow-criterion questions. IPFS delivery inspection confirmed the root cause: the model treats topical relevance as criterion-satisfaction confirmation — it sees a page about "Trump tweets" and gives p_yes=0.90 for "Will Trump say 'Radical Left' during this specific rally?" without checking whether any evidence directly confirms the exact condition.
This is the same criterion-specificity failure pattern previously fixed for superforcaster-polymarket-v2 (issue #284) and then more rigorously with the 4a-4d evidence-reliability screen in superforcaster-polymarket-v4 (#374/PR#375). This PR ports that screen to the full_search variant.
What to do next: Review the diff, run
autonomy push-allto publish the CID to IPFS, then route tournament traffic tosuperforcaster_full_search-v1for evaluation.Investigation summary
Tool:
superforcaster_full_search| Platform: polymarket | Issue: #440Headline (reproduced):
Data-sufficiency: Both windows n=105 = VALID_N_PER_WINDOW_FLOOR. Single CID both windows — mix-shift ruled out. Within-version Brier genuinely rose.
Calibration profile: YES bias +0.2110 (avg p_yes=0.711, avg outcome=0.500). High-confidence bin [0.9-1.0): realized rate only 29.4% (n=17) — massive overconfidence. Average edge = -0.1695.
IPFS delivery inspection (8 worst-miss rows): 6/8 confirmed good-evidence/bad-reasoning. Dominant pattern: tool reads topically relevant scraped pages and assigns high p_yes without checking whether any TYPE A evidence (dated within the resolution window, directly confirming the criterion) actually supports the narrow condition. Examples:
Mechanism and fix
Stage: prediction-LLM-call (gate-visible — runs on injected
source_contentin PR-CI's cached replay).Mechanism: The original 7-step PREDICTION_PROMPT has no instruction to differentiate TYPE A evidence (criterion-confirming) from TYPE B evidence (topically relevant but historically dated or from standing pages). The model defaults to "topic is active = YES likely."
Fix:
superforcaster_full_search-v1adds theevidence_reliability_screenstructured-output field (mirroring superforcaster-polymarket-v4's step 4):The fix is mechanical (an explicit reasoning step the model must emit and fill before producing p_yes), not aspirational ("be better calibrated").
Additionally, the tool now uses OpenAI Structured Outputs (
client.beta.chat.completions.parse+PredictionResultPydantic schema) instead of the rawchat.completions.create+ prose JSON instruction. This satisfies Hard Constraint 0 and prevents the prose-leaking output contract violation that broke superforcaster-polymarket-v4 in production.Page-scraping (readability + markdownify + ThreadPoolExecutor) is preserved — it is the distinguishing feature of the full_search family.
Files changed
packages/valory/customs/superforcaster_full_search_v1/superforcaster_full_search_v1.pypackages/valory/customs/superforcaster_full_search_v1/component.yamlpackages/valory/customs/superforcaster_full_search_v1/__init__.pypackages/valory/customs/superforcaster_full_search_v1/tests/test_superforcaster_full_search_v1.pypackages/packages.jsonbenchmark/tools.pysuperforcaster_full_search-v1ToolSpec entrybenchmark/tournament_tools.jsonsuperforcaster_full_search-v1-> CIDtool_lineage.jsonParent (
superforcaster_full_search) is NOT intournament_tools.json— no roster removal needed.Pre-PR sanity attestation
autonomy packages lock --check: Verification successfuljson.loads(run()[0])->{'p_yes': 0.35, 'p_no': 0.65, 'confidence': 0.7, 'info_utility': 0.5}— exactly 4 numeric keys, no reasoning fieldstest_on_chain_result_is_flat_json_loads_parseable,test_uses_structured_parse_not_raw_create,test_numeric_fields_are_declared_last)autonomy push-allNOT run — human reviewer runs this before mergingBaseline to beat
PR-CI will run the re-benchmark on a disjoint slice and post the delta-vs-baseline comment.