VeriLoop-E2-W4A16 / evaluation-protocol.py
bowmanslayer's picture
Release unmodified quantization with complete saved evaluation metrics and historical reference
711ed9f verified
Raw History Blame Contribute Delete
840 Bytes
"""Score publisher-protocol content without treating truncated thoughts as answers."""
def normalize_content(raw, finish_reason):
raw=(raw or '').lstrip()
# llama.cpp content-only mode echoes the template's generation prefix.
# It is protocol framing, not part of the answer (notably for MC letters).
if raw.startswith('<think>'):
raw=raw[len('<think>'):].lstrip('\r\n')
if '</think>' in raw:
reasoning,_,content=raw.rpartition('</think>')
return content,reasoning.removeprefix('<think>').strip(),'explicit-close'
if finish_reason=='length':
return '',raw,'unclosed-length-limit'
# Publisher serves without a reasoning parser: completed direct answers
# without a closing tag are content. Never infer an answer from hidden fields.
return raw,'','publisher-direct-content'