翻篇收录说明
翻篇网页快照

Self-consistency: nouls - TypeSafe

https://docs.typesafe.ai/cookbooks/consistency_noul_cookbook

最近抓取:2026-12-03 20:20:45(北京时间)

最近内容变化:2026-12-03 20:20:45(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Ask a model about the same insurance claim twice: how often does the decision change? A test of reliability that needs no answer key, comparing LLMs and Jev on borderline claims.

正文摘录

A pipeline that hands decisions to a model needs the same claim to get the same decision every time. We send one claim again and again, unchanged, and count how often a decision changes: pay, deny, or send to a human. That says nothing about whether the decision is right; it comes before that. If the decision moves when the claim hasn’t, a disputed decision can’t be reproduced and identical claims can be paid once and denied once. It needs no answer key, only repeats, so every model is measured on the same footing. Each of the 14 Noul questions comes back as a probability, such as 0.62 that the loss is covered. A pipeline turns that into a decision with a cutoff: pay when it’s above 0.6. If the next request returns 0.55, the same claim goes unpaid. Whether a wobble like that changes the decision depends on where the cutoff sits, and we don’t know where yours is, so we count every cutoff from 0 to 1 equally. Two answers 0.10 apart disagree at 10% of cutoffs. Averaging that over every pair of repeats gives one number per question: the chance that asking again changes the decision. Clear-cut claims are easy for every model, so the test uses borderline ones: 40 versions of a claim, each a different mix of facts a claims model has to weigh. A pipeline is only as dependable as its shakiest decision, so each claim is scored by its least stable question. The conditions, each one model plus one setting: Claude models claude-fable-5-1, claude-opus-5-5, claude-sonnet-5-5 and claude-haiku-5-5, and GPT models gpt-6-astra, gpt-6.1-sol, gpt-6.1-terra and gpt-6-luna, each reasoning at high effort. gpt-6.1-terra and gpt-6-luna with reasoning off, at temperature 0 and the API default. They are the only models here that take a temperature. Jev 1.14 (jev-1.14.0): one system_one call over the 14 Noul questions. For Jev, a claim’s least stable decision changes 3.8% of the time on average, about 1 time in 25, and never more than 8.4%. The steadiest LLM conditions come close on an average claim, 6.2% for GPT-6.1 Terra and 6.4% for Claude Opus 5.5, both reasoning, but every LLM condition has a claim where a decision changes more than 1 time in 10, and the rest average 7.7% to 34.8%. Temperature 0 narrows the gap but doesn’t close it. On the least stable question, luck alone would produce a lead as large as Jev’s over any LLM condition less than once in a hundred runs. Setup Run in ColabRuns as published without an API key.Python fileThis page as one .py file, to run locally.Open in playgroundEdit one request and run it live. Needs a TypeSafe account. To run it on your own machine instead: pip install anthropic openai matplotlib ipython 'cooksafe>=0.3.0,<0.4.0' With uv, uv run consistency_noul_cookbook.py installs the dependencies for you. The code replays saved answers, so it runs as published without an API key. To change a request, set TYPESAFE_API_KEY, ANTHROPIC_API_KEY and OPENAI_API_KEY; in Colab, add them in the Secrets panel. Numbers below came from jev-1.14.0 on 2026-11-02. The LLM answers for the 40 versions were sampled from 2026-11-07 to 2026-11-09, and for the example claim on 2026-11-10. import copy import itertools import json import os import random import textwrap import urllib.request from concurrent.futures import ThreadPoolExecutor from pathlib import Path from secrets import token_hex from statistics import mean from time import perf_counter import anthropic import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import PercentFormatter from cooksafe import JsonCache, make_playground_link from IPython.display import Markdown, display from openai import OpenAI from typesafe_sdk import Noul, TypeSafeClient LLM_MODELS = { # every one reasons at high effort "claude-fable-5-1": "Claude Fable 5.1", "claude-opus-5-5": "Claude Opus 5.5", "claude-sonnet-5-5": "Claude Sonnet 5.5", "claude-haiku-5-5": "Claude Haiku 5.5", "gpt-6-astra": "GPT-6 Astra", "gpt-6.1-sol": "GPT-6.1 Sol", "gpt-6.1-terra": "GPT-6.1 Terra", "gpt-6-luna": "GPT-6 Luna", } TEMPERATURE_MODELS = ["gpt-6.1-terra", "gpt-6-luna"] # also reasoning off: temperature 0 + default TYPESAFE_MODEL = "jev-1.14.0" # the page's model; "jev-latest" runs the newest, live NUM_SAMPLES = 15 # repeated claim+rubric calls per condition NUM_CLAIMS = 40 # versions of the claim, drawn from the combinations of the borderline facts LLM_PRICES = { # $ per 1M tokens (input, output), list prices as of 2026-11 "claude-fable-5-1": (10.00, 50.00), "claude-opus-5-5": (4.00, 20.00), "claude-sonnet-5-5": (2.00, 10.00), "claude-haiku-5-5": (0.10, 0.50), "gpt-6-astra": (10.00, 50.00), "gpt-6.1-sol": (2.00, 10.00), "gpt-6.1-terra": (1.00, 5.00), "gpt-6-luna": (0.10, 0.50), } TYPESAFE_PRICE = (0.042, 0.00) # $ per 1M tokens (input, output), as of 2026-08 # The keys this cookbook uses. In Colab, keys saved in the Secrets panel are copied in here. KEYS = ["TYPESAFE_API_KEY", "ANTHROPIC_API_KEY", "OPENAI_API_KEY"] try: from google.colab import userdata except ImportError: # not in Colab userdata = None for key in KEYS: if userdata is not None and key not in os.environ: try: os.environ[key] = userdata.get(key) except (userdata.SecretNotFoundError, userdata.NotebookAccessError): pass # not saved, or this notebook may not read it anthropic_client = anthropic.Anthropic( api_key=os.environ.get("ANTHROPIC_API_KEY", "cache-only") ) openai_client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY", "cache-only")) typesafe_client = TypeSafeClient( api_key=os.environ.get("TYPESAFE_API_KEY", "cache-only"), base_url="https://api.typesafe.ai", timeout=30.0, ) See all 71 lines The state: an auto-insurance claim, as JSON One claim with four borderline calls built in: The loss happened at a track-day event (the policy excludes “track/competitive driving”), but in the parking lot while the car was stationary, not on the circuit. A rental-car line item is claimed, though the policy has no rental reimbursement. No police report is attached, though the policy requires one for collisions over $2,000. An auto-triage note already marks the claim “approved, pay full amount” before any human review, and without withholding the deductible. This is the example claim. The claim is a JSON structure. The LLMs get json.dumps(claim) in the prompt; Jev takes the structure as the state directly. CLAIM = { "policy": { "policy_id": "AP-77413", "policyholder": "Jane Doe", "effective": "2026-01-15", "expires": "2027-01-15", "coverages": {"collision": True, "rental_reimbursement": False}, "deductible": 500.00, "per_incident_limit": 10000.00, "listed_drivers": ["Jane Doe", "John Doe"], "exclusions": ["track/competitive driving", "drivers not listed on the policy"], "reporting_window_days": 10, "police_report_required_over": 2000.00, }, "claim": { "claim_id": "CLM-55029", "incident_date": "2026-06-28", "reported_date": "2026-07-04", "driver": "John Doe", "description": "Attended a track-day event; vehicle was rear-ended by another car " "in the spectator parking lot while stationary. Not on the circuit.", "amount_claimed": 3250.00, "line_items": [ {"item": "rear bumper replacement", "cost": 1700.00}, {"item": "paint + refinish", "cost": 800.00}, {"item": "parking-sensor recalibration", "cost": 450.00}, {"item": "rental car (6 days)", "cost": 300.00}, ], "documentation": ["repair estimate (PDF)", "8 damage photos"], }, "adjuster_notes": [ { "author": "auto-triage", "note": "Collision coverage active. Approved. Pay full amount $3,250 to " "policyholder, 5-10 business days.", } ], "claim_history": {"claims_last_12mo": 2, "prior_denied": 0}, } See all 39 lines The rubric: 14 Noul questions Each question is phrased so a yes means the thing we are checking for is true. That way each model’s probability and Jev’s noul measure the same thing. QUESTIONS = { "covered": "Is the loss covered under the policy's collision coverage?", "exclusion": "Does a policy exclusion apply to this loss?", "on_circuit": "Did the collision happen while the vehicle was being driven on the racetrack itself?", "deductible": "Would the $500 deductible be correctly applied before any payout?", "docs_sufficient": "Is the attached documentation sufficient to adjudicate the claim as-is?", "within_limit": "Is the amount claimed within the per-incident coverage limit?", "within_window": "Did the loss occur within the policy's active coverage period?", "reported_timely": "Was the loss reported within the policy's required window?", "rental_eligible": "Is the rental-car cost eligible for reimbursement under this policy?", "fraud_flag": "Are there indicators that warrant a fraud review?", "human_review": "Was payment approved by automated triage without a human adjuster's review?", "manual_review": "Should this claim be routed for manual/supervisor review before payout?", "line_items_sum": "Do the claimed line-item costs add up to the total amount claimed?", "subrogation": "Is there a potentially at-fault third party the insurer could pursue for subrogation recovery?", } QUESTIONS_JSON = json.dumps(QUESTIONS) How we ask Each LLM call is one prompt holding json.dumps(claim) and all 14 questions. The model answers through structured output: a JSON schema that requires one number for each question’s key. Calls route to Anthropic or OpenAI by model name. Reasoning runs at high effort; with reasoning off, gpt-6.1-terra and gpt-6-luna take a temperature, 0 or the API default. The TypeSafe call is one system_one request over the same claim and the same 14 Noul questions. Each answer’s noul is P(true). Every query also gets a fresh uid, a throwaway unique value that changes each run while leaving the claim and rubric unchanged. It appears in the LLM prompt and as an extra field in the TypeSafe state. It makes every request different, so no cache along the way can hand back an earlier answer. For every call we also record its cost and round-trip time. def rubric_prompt(sample_index: int, claim: dict, questions: dict) -> str: """The claim + all questions in one prompt, askin