• Stefy Lanza (nextime / spora )'s avatar
    ocr: a confidence nobody measured is worse than none (v0.3.8) · 903797e0
    Stefy Lanza (nextime / spora ) authored
    Surya asks every request for logprobs and averages exp(logprob) over the
    generated tokens to score each line. coderai accepted the parameter, never
    sent it, and hardcoded `logprobs: None` in every response builder.
    
    Surya's fallback is what makes that expensive: with no logprobs it does not
    report "unknown", it reports a literal 1.0 (recognition/__init__.py:248, :302,
    layout/__init__.py:97). Every line of every page comes back perfectly
    confident, the guesses included, and nothing downstream can tell which
    judicial document needs a human to look at it.
    
    So the round trip is wired where it can exist: the proxy backends (vLLM,
    RunPod) forward `logprobs`/`top_logprobs` and hand back what the server
    measured, buffered and streamed, accumulating the streamed pieces into one
    response-shaped object. The manager asks the backend's signature rather than
    negotiating by TypeError, which would have called it twice for a kwarg it
    never had. A request that did not ask is sent exactly as before, and a
    backend that cannot answer still returns null.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01PxYHWbCAjjjD7A1rhFKtaW
    903797e0
vllm.py 15.1 KB