Wednesday, July 15, 2026

LLM as a Verifier Paper

 The research paper "LLM-as-a-Verifier: A General-Purpose Verification Framework" (published July 6, 2026), which introduces a training-free method to grade LLM outputs more accurately by utilizing continuous rewards based on token probabilities rather than discrete scoring.


Key Takeaways:

Mechanism: Instead of traditional discrete judgments, the framework computes continuous scores from token logits. This approach significantly reduces ties in evaluation.

Performance: The framework demonstrates state-of-the-art results across four benchmarks, including 86.5% on Terminal Bench 2.0 and 78.2% on SWE Bench Verified.

Scaling Dimensions: Verification accuracy is improved through three main axes: scoring granularity, repeated evaluations, and criteria decomposition.

Efficiency: The authors introduce the probabilistic pivot tournament, a cost-efficient five-stage pipeline that reduces search costs from the order of n squared to n*k, making it practical for selecting the best candidate solution.

Impact: By providing fine-grained feedback, the framework bridges the gap between candidate generation and selection, serving as a powerful, training-free scaling axis for agentic AI.


The paper "LLM-as-a-Verifier: A General-Purpose Verification Framework" (published in July 2026 by researchers from Stanford, UC Berkeley, Nvidia, and other institutions) introduces a training-free framework that treats solution verification as a major new scaling axis for AI performance. [12]
Instead of using standard "LLM-as-a-judge" methods that output rigid, discrete scores, this framework calculates a mathematical expectation over the model's entire scoring token logit distribution, generating a highly precise, continuous reward signal. [12]
⚖️ The 3 Dimensions of Verification Scaling
The paper establishes that verification accuracy scales along three core levers: [123]
  • Score Granularity: Fine-grained continuous scores eliminate ties and better separate correct solutions from incorrect ones.
  • Repeated Evaluation: Multiple inference passes dramatically reduce variance.
  • Criteria Decomposition: Breaking down complex evaluation goals into individual, distinct sub-criteria eliminates rounding and signal loss. [12345]
📊 Performance and Benchmarks
By pairing this probabilistic approach with a novel "probabilistic pivot tournament" ranking algorithm, the framework achieves state-of-the-art results without any additional model training: [123]
  • Terminal-Bench V2: Scores 86.5% accuracy, significantly outperforming baseline LLMs.
  • SWE-Bench Verified: Achieves 78.2% accuracy on complex software engineering and code-patching tasks.
  • RoboRewardBench: Hits 87.4% accuracy, outperforming existing trained reward models on robotics tasks.
  • MedAgentBench: Scores 73.3% accuracy on multi-step medical workflow tracking



The core code difference between LLM-as-a-Judge and LLM-as-a-Verifier lies in how they extract data from the model. [1]
  • LLM-as-a-Judge relies on standard text generation (max_tokens=1 or JSON mode) to capture a single, hard-coded discrete score token (e.g., "7" out of 10). [123]
  • LLM-as-a-Verifier requests the model's raw log probabilities (logprobs) for a predetermined set of score tokens, converting the entire next-token probability distribution into a highly precise, continuous expected mathematical value. [12]
Below is a direct comparison of the architectural patterns implemented in Python using the OpenAI API.

1. LLM-as-a-Judge: The Discrete Approach
This traditional method asks the model for a rating, extracts the single highest-probability token, and throws away the rest of the model's underlying distribution data. [1]

import openai

def llm_as_a_judge(prompt, response_to_evaluate):
judge_prompt = f"""
Evaluate the following response based on correctness.
Output exactly one single integer from 1 to 5. Do not write anything else.
Response: {response_to_evaluate}
Score:"""
client = openai.OpenAI()
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": judge_prompt}],
max_tokens=1, # Force a single discrete token output
temperature=0.0
)
# Returns a hard string like "4", 
# treating a 4.1 confidence and 4.9 confidence identically
return int(response.choices[0].message.content.strip())
  
2. LLM-as-a-Verifier: The Continuous Logprob Approach
The verifier framework forces the model to choose between specific tracking tokens (the paper uses a letter-based scale like A, B, C, D, E to perfectly isolate score tokens) and uses logprobs=True to extract the full confidence distribution. [123]
 

import numpy as np
import openai

def llm_as_a_verifier(prompt, response_to_evaluate):
verifier_prompt = f"""
Evaluate the following response based on strict criteria.
Select the single most accurate letter grade from this scale:
A: Perfect (Value 5)
B: Good (Value 4)
C: Average (Value 3)
D: Poor (Value 2)
E: Failing (Value 1)
Output exactly one letter character. Do not write anything else.
Response: {response_to_evaluate}
Grade:"""
# Map token strings to their designated numeric weight
score_mapping = {"A": 5.0, "B": 4.0, "C": 3.0, "D": 2.0, "E": 1.0}
client = openai.OpenAI()
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": verifier_prompt}],
max_tokens=1,
logprobs=True, # CRITICAL: Ask the API for the log probabilities
top_logprobs=5 # Get the probabilities for all 5 score tokens
)
# Extract the top token logprob array
top_logprobs = response.choices[0].logprobs.content[0].top_logprobs
# Convert logprobs back to raw probabilities using softmax: e^logprob
raw_probabilities = {}
denominator = 0.0
for logprob_obj in top_logprobs:
token = logprob_obj.token.strip()
if token in score_mapping:
prob = np.exp(logprob_obj.logprob)
raw_probabilities[token] = prob
denominator += prob
# Calculate the continuous mathematical expectation
expected_score = 0.0
if denominator > 0:
for token, prob in raw_probabilities.items():
# Normalize probabilities specifically among the score tokens
normalized_prob = prob / denominator
expected_score += score_mapping[token] * normalized_prob
# Returns a highly granular float (e.g., 4.38 instead of a flat 4)
return expected_score
🛠️ Key Implementation Differences
FeatureLLM-as-a-JudgeLLM-as-a-Verifier
API Parameterslogprobs=Falselogprobs=Truetop_logprobs=5
Output Typeint or str (Discrete)float (Continuous Expectation)
Tie ResolutionLow (Many responses get the exact same score)High (Resolves ties down to decimal confidence)
Parsing LogicSimple string strippingSoftmax transformation on logits
API AvailabilityWorks on all text generation APIsRequires engines exposing token logits (OpenAI, Together AI, vLLM)
Would you 



Ai

  four essential concepts for building reliable and effective AI agent systems: Agent Harness, Loop Engineering, LLM Ops, and Evaluation (Eval). The creator explains that while LLMs are powerful, they require structured architecture to become functional, autonomous systems.


Key concepts covered:


AI Agent Run & Memory Systems (0:42 - 3:37): An agent run is a single cycle from user prompt to output. To function well, agents need a memory system—procedural (instructions), semantic (durable facts), and episodic (past events/history)—to gain context beyond their base training.

The 'Harness' (3:37 - 10:00): Just as a harness controls a horse, the agent harness refers to the framework (using tools like LangGraph or LangChain) that governs the LLM. It manages memory storage, databases, and retrieval (RAG) to ensure the agent operates with purpose rather than randomness.

Loop Engineering (10:00 - 14:18): When agents use tools, they often run in loops to complete complex tasks. Loop engineering involves setting end-loop guardrails to prevent infinite loops, defining clear stopping points, and ensuring the agent asks for human input when necessary.

LLM Ops & Evaluation (14:18 - 18:56): To maintain system health, LLM Ops introduces observability through tracing (tracking every step of an agent run using tools like Langfuse or LangSmith). This data allows for evaluation—using an LLM as a judge to score performance—which helps diagnose bottlenecks and inform necessary fixes.


The Iterative Cycle: The final system creates an autonomous feedback loop: you trace the run, evaluate the results, diagnose issues, and ship improvements (updates to prompts or model configurations) back into the agent framework (18:16 - 19:53).

Thursday, June 18, 2026

Build Lakehouse using Iceberg

 Flow Diagram of Data Lakehouse



While Data Lake is excels for Machine Learning , Data warehouse is used for Business Intelligence , Data Lakehouse excels at both.

Data Lakehouse supports :

  •  ACID 
  • Schema Enforcement and Evaluation

Flow Diagram of Data Warehouse




Flow Diagram of Data Lake 



Medallion Architecture

  • Bronze - Raw data receive for replay
  • Silver - Clean data , processed
  • Gold - Features


Kafka for Fan Out Design Pattern 



where one stream is converted to multiple allowing more than one consumer 


LLM as a Verifier Paper

 The research paper "LLM-as-a-Verifier: A General-Purpose Verification Framework" (published July 6, 2026), which introduces a tra...