fix: stop the coordinator copying its own prompt example
The JSON shape in both prompts used real values as placeholders, and the model
was reading them as the answer:
instrument: 'NVDA' -> 397 of 611 predictions are NVDA (65%),
second place is LMT with 8
horizon_days: 10 -> 606 of 611 are horizon 10 (99.2%), out of
seven allowed horizons
direction: 'positive|negative' -> 502 of 611 are positive (82.2%)
event_type: 'stable_enum' -> the enum was never listed, so the model
invented one label per event, 201 distinct
values across 611 predictions
replayWorker had its own copy of the same prompt with the same values, which is
why both lanes show the identical skew (replay is 147/147 horizon 10, 138/147
NVDA).
Every placeholder is now a description of the field rather than a usable value,
with an explicit line saying not to copy them. event_type is validated against
the same closed family list the cohort key uses, so a label cannot mean one
thing in the prompt and another in calibration. Off-enum labels are salvaged
through the existing mapper when they are placeable and rejected when they are
not, so 'other' does not quietly become the bin again.
This does not by itself create edge. It means the next batch of predictions
measures the model's judgement instead of its willingness to copy an example.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WnNxwxfXSbeNtjvtz5gayb
This commit is contained in:
@@ -6,6 +6,7 @@ const { initAutonomySchema } = require('../src/autonomy/schema');
|
||||
const { leaseNextJob, completeJob, failJob } = require('../src/autonomy/jobs');
|
||||
const { callCoordinator } = require('../src/autonomy/llm');
|
||||
const { acceptProposal, recordRejectedProposal } = require('../src/autonomy/coordinator');
|
||||
const { EVENT_FAMILY_NAMES } = require('../src/autonomy/calibration');
|
||||
|
||||
function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); }
|
||||
|
||||
@@ -24,10 +25,12 @@ function buildPrompt(event, articles) {
|
||||
`[Evidence ${index + 1}] article_id=${article.id}\nTitle: ${article.title}\n${String(article.content || article.description || '').slice(0, 4000)}`
|
||||
).join('\n\n---\n\n');
|
||||
return `Event title: ${event.title}\n\n${evidence}\n\nReturn JSON only in this shape:\n${JSON.stringify({ predictions: [{
|
||||
instrument: 'NVDA', direction: 'positive|negative', event_type: 'stable_enum',
|
||||
causal_channel: 'short description', horizon_days: 10,
|
||||
evidence_article_ids: [123], invalidation_condition: 'condition',
|
||||
}] }, null, 2)}\n\nUse only instruments and evidence directly supported by the articles. Return an empty predictions array when there is no clear, tradable hypothesis. Never include probabilities, returns, confidence, position sizes, or actions.`;
|
||||
instrument: '<ticker supported by the articles>', direction: '<positive or negative>',
|
||||
event_type: '<one value from the event_type list below>',
|
||||
causal_channel: '<short description>', horizon_days: '<one of 1, 5, 10, 20, 30, 60, 90>',
|
||||
evidence_article_ids: ['<article_id values from the evidence above>'],
|
||||
invalidation_condition: '<what would falsify this>',
|
||||
}] }, null, 2)}\n\nEvery value in that shape is a placeholder describing the field. Do not copy them. Choose instrument, direction and horizon_days from the evidence in front of you.\n\nevent_type must be exactly one of: ${EVENT_FAMILY_NAMES.join(', ')}. Pick the closest one. Use "other" only when none of them genuinely apply, and never invent a value outside this list.\n\nUse only instruments and evidence directly supported by the articles. Return an empty predictions array when there is no clear, tradable hypothesis. Never include probabilities, returns, confidence, position sizes, or actions.`;
|
||||
}
|
||||
|
||||
async function runCoordinatorWorker({ archivePath, intelligencePath, workerId = `coordinator-${os.hostname()}-${process.pid}`, pollMs = 1000 } = {}) {
|
||||
|
||||
Reference in New Issue
Block a user