strip prompt-echo leakage in indicator summaries
DeepSeek occasionally regurgitates the system prompt verbatim
("Constraints: ≤60 words...", "Example good: ..."). Three-pronged fix:
1. Removed the inline good/bad example blocks from the per-group and
aggregate system prompts — DeepSeek was treating them as templates
to copy. The hard constraints alone are clear enough.
2. Expanded the LEAK_PATTERNS list to catch the prompt-label echoes
that still occasionally slip through ("Key observations:", "The
indicators are:", "Must cite ...", "Should give ...", bare "Key:").
Cleanup now runs up to 6 passes for compound leakage.
3. Added looks_like_leakage() — if the cleaned output still contains
tell-tale phrases ("≤60 words", "instructions:", etc.), the summary
is skipped rather than persisted. Logs a 'leakage_detected' warning
and an ai_calls row with status=leaked so we can see the failure
rate over time. The previous good summary stays visible.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4e7e4981e3
commit
2f223b75a3
2 changed files with 82 additions and 24 deletions
|
|
@ -199,20 +199,12 @@ interpretation. Don't list moves; explain them.
|
|||
- Multi-week / multi-month horizon. 1-day moves under 2% are noise — skip.
|
||||
- No buy/sell language. No predictions. No watch list. No TL;DR. No date \
|
||||
header. No "system temperature" line — that belongs to the full daily log.
|
||||
- Output the read directly. Do NOT include phrases like "Example", "Good \
|
||||
example", "Bad example", "Reference", or any meta-framing of your output.
|
||||
|
||||
{tone_block}
|
||||
|
||||
{analysis_block}
|
||||
|
||||
# Bad example — describes what happened
|
||||
"S&P +5.2% 1m and Nasdaq +8.8% 1m diverge from FTSE -3.4% and Euro Stoxx \
|
||||
-2.6%. The US-vs-rest gap is widening."
|
||||
|
||||
# Good example — interprets what it means
|
||||
"The US-vs-rest equity gap is funded by AI-capex concentration in 7 names; \
|
||||
the breadth-weighted RSP barely keeps pace with SPY, which is the classic \
|
||||
late-cycle marker — narrow leadership, not broad recovery. The 5% 1m gap \
|
||||
between Nasdaq and FTSE is a narrative trade, not a fundamental one."
|
||||
"""
|
||||
|
||||
|
||||
|
|
@ -255,21 +247,12 @@ risk premium is in commodities but not vol". Cite no more than 3 specific \
|
|||
numbers, and only as anchors for the interpretation.
|
||||
- Multi-week / multi-month horizon. 1-day moves under 2% are noise.
|
||||
- No buy/sell language. No predictions of specific levels.
|
||||
- Output the read directly. Do NOT include phrases like "Example", "Good \
|
||||
example", "Bad example", "Reference", or any meta-framing of your output.
|
||||
|
||||
{tone_block}
|
||||
|
||||
{analysis_block}
|
||||
|
||||
# Bad example — describes
|
||||
"Equities are up, real yields are higher, HY OAS is tight, breadth is \
|
||||
narrowing."
|
||||
|
||||
# Good example — interprets
|
||||
"The tape is paying a rising real discount rate (US 10y real +15bp 1m) with \
|
||||
conviction for AI growth, but credit refuses to confirm and breadth is \
|
||||
narrowing — that combination is what late-cycle looks like, not pre-crash. \
|
||||
The risk is not the level but the convergence: if any one of credit, \
|
||||
breadth, or vol turns, the others will follow fast."
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue