gary-boon Claude Opus 4.6 commited on
Commit
ecf49a2
·
1 Parent(s): 121a2d9

Fix margin winner_token in margin_data and extract _classify_stability helper

Browse files

The Decision Stability display was showing the sampled token as the winner
rather than the logit-top token. When temperature changed the pick (e.g.
"(number" was logit winner but "(n" was sampled), both sides showed the same
token. Now includes winner_token in margin_data from logits_entries[0].

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. backend/model_service.py +3 -0
backend/model_service.py CHANGED
@@ -2890,8 +2890,11 @@ async def analyze_research_attention_stream(request: Dict[str, Any], authenticat
2890
  # Sampling sensitivity: did temperature change the outcome?
2891
  sampling_sensitive = next_token_id != greedy_token_id
2892
 
 
 
2893
  margin_data = {
2894
  "margin": margin,
 
2895
  "winner_logit": winner_logit,
2896
  "runnerup_logit": runnerup_logit,
2897
  "runnerup_token": runnerup_token,
 
2890
  # Sampling sensitivity: did temperature change the outcome?
2891
  sampling_sensitive = next_token_id != greedy_token_id
2892
 
2893
+ winner_token = logits_entries[0]["token"] if len(logits_entries) > 0 else ""
2894
+
2895
  margin_data = {
2896
  "margin": margin,
2897
+ "winner_token": winner_token,
2898
  "winner_logit": winner_logit,
2899
  "runnerup_logit": runnerup_logit,
2900
  "runnerup_token": runnerup_token,