Back to all articlesAI మరియు ఏజెంట్లు

స్వయం-భ్రమ లేకుండా ప్రతిబింబణ: ఆగిపోయే ధృవీకరణ లూప్‌లు (Part 7)

Verification before reflection

Decidable checkscitation, number, quote
Rubric criticscore drives arithmetic
Score penalty0.15 per open verdict
Three stop conditionsrounds, delta, oscillation

One reflection round

The program checks are a veto the critic cannot outvote.

One reflection round — flow diagramOne reflection round. Flow diagram with 6 steps. Shapes: pill = input, rounded rect = process, diamond = decision, double border = output, dashed = loop. Steps in order: Step 1, draft answer (input), from AgentLoop trace; Step 2, extract claims (process), sentence + [doc#n] citations; Step 3, programmatic checks (decision), no_citation / number_mismatch; Step 4, rubric critique (decision), score - 0.15 x errors; Step 5, revise from issues (process), clean citations kept; Step 6, labelled answer (output), stopped_by records why. Then loops back to step 3: ↺ repeat until accepted, no_progress, oscillation or max_rounds.draft answerfrom AgentLoop traceextract claimssentence + [doc#n] citationsprogrammaticchecksno_citation / number_mismatchrubric critiquescore - 0.15 x errorsrevise from issuesclean citations keptlabelled answerstopped_by records why
  • input
  • process
  • decision
  • output

అత్యంత సాధారణ ప్రతిబింబణ అమలు ఒకే ప్రాంప్ట్: Review your answer for errors and improve it. ఇది నమ్మకంగా మరింత పొడవాటి సమాధానాన్ని ఇస్తుంది. అది మెరుగైనదా అనేది వేరే ప్రశ్న, ఎందుకంటే తన డ్రాఫ్ట్‌ను సమీక్షించే మోడల్‌కు డ్రాఫ్ట్‌లో ఇప్పటికే లేని సమాచారం ఏమీ లేదు. విమర్శ మరింత ధైర్యంగా పదాలతో సమాధానాన్ని పునఃప్రకటిస్తుంది, సవరణ విమర్శను పునఃప్రకటిస్తుంది, మరియు మీరు టోకన్ సంఖ్యను పెంచడానికి మాత్రమే రెండు మోడల్ కాల్‌ల ఖర్చు చేసారు.

ప్రతిబింబణ ఖచ్చితంగా రెండు పరిస్థితుల్లో మాత్రమే ఉపయోగపడుతుంది: విమర్శ మొదటి ప్రయత్నం ఉపయోగించని సాక్ష్యానికి అంటుకుని ఉండాలి, లేదా ప్రోగ్రామ్ మోడల్ వాదించలేని దాన్ని తనిఖీ చేయాలి. ఈ భాగం రెండింటినీ నిర్మిస్తుంది — తర్వాత అందరూ దాటేసే భాగాన్ని, స్టాప్ షరతులను కూడా నిర్మిస్తుంది, ఎందుకంటే పరిమితి లేని ప్రతిబింబణ లూప్ ఒకే సమాధానం యొక్క రెండు రూపాల మధ్య మారుతూ స్టెప్ బడ్జెట్ అయిపోవడం వరకు ఉంటుంది.

గత మూడు భాగాల ఫలితం ఇక్కడ ప్రత్యక్షంగా కనిపిస్తుంది. Part 5 ప్రతి శోధన ఫలితానికి సిటేషన్ id ఇచ్చింది; Part 6 ప్రతి టాస్క్‌కు పరిమిత ఫలితం ఇచ్చింది. సిటేషన్ id లు ధృవీకరణను నిర్ణయించదగినది చేస్తాయి: ఉదహరించిన భాగం ఉంది మరియు సంఖ్యను కలిగి ఉంది లేదా లేదు. వాటి లేకుండా, ధృవీకరణ ఒక అభిప్రాయం మాత్రమే, మరియు అభిప్రాయాలు లూప్‌లను ఆపవు.

మీరు నిర్మించేది

నాలుగు భాగాలున్న reflect.py మాడ్యూల్:

  • extract_claims + EvidenceStore — సమాధానాన్ని వాక్యాలుగా విభజించి, ప్రతి దాన్ని రన్ నిజంగా సేకరించిన సాక్ష్యంతో తనిఖీ చేస్తుంది: సిటేషన్ ఉనికి, సంఖ్య సరిపోలిక, యథావాక్య కోట్‌లు.
  • RubricCritic — నాలుగు-అంశాల రూబ్రిక్‌తో, నిర్మాణాత్మక అవుట్‌పుట్‌తో రౌండ్‌కు ఒక మోడల్ కాల్, మరియు గట్టి నియమం: తప్పుగా ఏర్పడిన విమర్శ అంగీకారమే, సవరణ ఎప్పుడూ కాదు.
  • ReflectionLoop — విమర్శ, సవరణ, మూడు స్టాప్ షరతులతో: రౌండ్ పరిమితి, కనీస స్కోర్ మెరుగుదల, విమర్శ ఫింగర్‌ప్రింట్ ద్వారా కంపన గుర్తింపు.
  • ReflectiveAgent — డ్రాఫ్ట్ కోసం AgentLoop నడిపి, ట్రేస్ నుండి సాక్ష్య సముదాయాన్ని పునర్నిర్మించి, ధృవీకరిస్తుంది.

contracts.py లో ఒక చిన్న మార్పు ఇవన్నీ సాధ్యం చేస్తుంది, మరియు వేరే ఏదైనా చెప్పే ముందు దీన్ని ప్రస్తావించడం విలువైనది:

# Part 2's AgentLoop recorded the decision and the outcome; Part 7 needs the payload too.
record.update({"tool": name, "ok": result.ok, "attempts": result.attempts,
"error_code": result.error_code, "from_cache": result.from_cache,
"data": result.data})

data: result.data ఒక లైన్ మాత్రమే, మరియు ఇది చదవగలిగే ట్రేస్, ధృవీకరించగల ట్రేస్ మధ్య తేడా. ఇది లేకుండా, సాక్ష్య సముదాయాన్ని మోడల్ ఏం చదివిందో అనే దాని జ్ఞాపకం నుండి పునర్నిర్మించాల్సి వస్తుంది — ఇదే ప్రతిబింబణ పట్టుకోవాల్సిన వైఫల్యం.

ముందస్తు అవసరాలు

  • Part 1–6. reflect.py ఇంపోర్ట్ చేస్తుంది AgentLoop, LLMClient, Message, Tool — అవి contracts.py నుండి.
  • Python 3.10+, ప్రామాణిక లైబ్రరీ మాత్రమే (re, json, hashlib).
  • డెమో రెండు సిద్ధ పాసేజీలతో కూడిన స్టబ్ search టూల్‌ను ఉపయోగిస్తుంది కాబట్టి ఆఫ్‌లైన్‌లో నడుస్తుంది; నిజమైన ప్రాజెక్ట్‌లో Part 5 make_search_tool(retriever) ను కనెక్ట్ చేయండి — ప్రతిబింబణ లేయర్‌కు ఏది అయినా సమస్యే.

“మీ సమాధానంపై ప్రతిబింబించండి” ఎందుకు దారుణంగా మారుస్తుంది

అమూర్త స్వ-విమర్శ ఒక నిర్మాణాత్మక కారణంతో విఫలమవుతుంది, ప్రాంప్ట్-ఇంజనీరింగ్ కారణంతో కాదు. విమర్శ స్టెప్ రెండవ మోడల్ కాల్, దాని ఏకైక ఇన్‌పుట్ మొదటి కాల్ ఉత్పత్తి చేసిన టెక్స్ట్. కొత్త సమాచారం లేదు, కాబట్టి సాధ్యమైన ఉత్తమ విమర్శ ఇప్పటికే ఉన్నదాని పునఃఉత్పాదన — మరియు వాక్యాన్ని ఉత్పత్తి చేసిన అదే వెయిట్‌లు వాక్యాన్ని తీర్పు చెబుతాయి కాబట్టి మోడల్‌లు తమ ధైర్యంగా చేసిన తప్పులను గుర్తించడంలో ప్రత్యేకంగా బలహీనం.

ప్రతిబింబణ ఉపయోగించగలిగినది, ఈ భాగం అమర్చేది, భేదాత్మక సమాచారం:

  • సాక్ష్య సముదాయం — టూల్స్ నిజంగా ఏం తిరిగి ఇచ్చాయో, డ్రాఫ్ట్ దాన్ని విస్మరించి ఉండవచ్చు లేదా ఎదురుతిరిగి ఉండవచ్చు.
  • నిర్ణయించదగిన తనిఖీలు — సిటేషన్ ఉనికి, సంఖ్య సరిపోలిక, కోట్ ఉనికి, వీటికి మోడల్ అస్సలు అవసరం లేదు.
  • స్కేల్‌తో కూడిన రూబ్రిక్ — score వైబ్స్ బదులు గణితాన్ని నడపగలదు.

క్రమం ముఖ్యం, ఇదే కోర్ డిజైన్: మొదట ప్రోగ్రామాత్మక తనిఖీలు, రెండో మోడల్ తీర్పు. దీన్ని తప్పిగమనడం సులభమైన జవాబుదారీ అసమానత కూడా ఉంది. మోడల్ ఆధారిత విమర్శ తప్పైతే, సిస్టమ్‌లో దీన్ని చెప్పగలది ఎవరూ లేరు — విమర్శ ఒక తీర్పు, తీర్పులు ఆడిట్ ట్రైల్ వదిలిపెట్టవు. EvidenceStore.check number_mismatch ను ఎత్తిచూపినప్పుడు, తీర్పు వాదనను, కోడ్‌ను, పేర్కొన్న సిటేషన్‌లో లేని ఖచ్చిత సంఖ్యను పేర్కొంటుంది. open_verdicts చదివే డెవలపర్‌కు తిరస్కరించదగిన ప్రకటన కనిపిస్తుంది, అంటే తప్పు పాజిటివ్ డీబగ్ చేయదగినది: పాసేజ్ చూడు, regex చూడు, నియమాన్ని సరిచేయి. తనిఖీ చేయగల లేయర్‌ను మొదట నిర్మించండి, తర్వాత క్రిటిక్ మరియు తనిఖీల మధ్య ప్రతి భేదానికి అప్పీల్ చేయదగిన గ్రౌండ్ ట్రూత్ ఉంటుంది. 40 మైక్రోసెకన్లలో నడిచే తనిఖీ పాస్ అవుతుంది లేదా లోపాన్ని పేర్కొంటుంది; క్రిటిక్ తర్వాత ప్రోగ్రామ్ చేయలేనిదాన్ని తీర్పు చెబుతుంది — వాదన లక్ష్యానికి అనుగుణంగా ఉందా, తార్కికం సమంగా ఉందా. క్రిటిక్‌కు కేవలం గద్యం మాత్రమే ఇచ్చి రెండు పనులు చేయిస్తే రెండింటిలో చెత్త లభిస్తుంది: అది సంఖ్యలను నమ్మదగిన విధంగా ధృవీకరించలేదు, మరియు తన శ్రద్ధను వ్యాకరణంపై ఖర్చు చేస్తుంది.

ప్రోగ్రామ్ నడపగల తనిఖీలు: సిటేషన్లు, సంఖ్యలు, కోట్లు

వాదన అంటే సున్నా లేదా అంతకంటే ఎక్కువ సిటేషన్ id లున్న వాక్యం. తనిఖీలు ఉద్దేశపూర్వకంగా యాంత్రికం:

from __future__ import annotations
from dataclasses import dataclass, field
import hashlib
import json
import re
from contracts import AgentLoop, LLMClient, Message, Tool
CITATION = re.compile(r"\[([a-z][a-z0-9_-]{1,40}#\d+)\]")
NUMBER = re.compile(r"\d+(?:\.\d+)?")
QUOTE = re.compile(r'"([^"]{8,160})"')
SENTENCE = re.compile(r"(?<=[.!?])\s+")
@dataclass
class Evidence:
id: str
text: str
@dataclass
class Claim:
text: str
citations: tuple[str, ...]
@dataclass(frozen=True)
class Verdict:
claim: str
code: str # ok | no_citation | unknown_citation | number_mismatch | quote_missing
detail: str = ""
@property
def failed(self) -> bool:
return self.code != "ok"
def extract_claims(answer: str) -> list[Claim]:
return [
Claim(sentence, tuple(CITATION.findall(sentence)))
for sentence in (s.strip() for s in SENTENCE.split(answer.strip()))
if sentence
]
class EvidenceStore:
"""The evidence the run actually retrieved. Claims are checked against this, not against belief."""
def __init__(self, evidence: list[Evidence]) -> None:
self.items = {e.id: e for e in evidence}
def check(self, claim: Claim) -> list[Verdict]:
if not claim.citations:
return [Verdict(claim.text, "no_citation", "claim cites no evidence")]
verdicts: list[Verdict] = []
for citation in claim.citations:
item = self.items.get(citation)
if item is None:
verdicts.append(Verdict(claim.text, "unknown_citation",
citation + " was never retrieved"))
continue
missing_numbers = [n for n in NUMBER.findall(claim.text)
if n not in item.text]
if missing_numbers:
verdicts.append(Verdict(
claim.text, "number_mismatch",
",".join(missing_numbers) + " absent from " + citation))
missing_quotes = [q for q in QUOTE.findall(claim.text)
if not any(q in item.text for item in self.items.values())]
for quote in missing_quotes:
verdicts.append(Verdict(claim.text, "quote_missing", quote[:60]))
if not verdicts:
verdicts.append(Verdict(claim.text, "ok", ""))
return verdicts
def check_claims(self, claims: list[Claim]) -> list[Verdict]:
out: list[Verdict] = []
for claim in claims:
out.extend(self.check(claim))
return out
def block(self, max_chars: int = 1400) -> str:
lines: list[str] = []
for item in self.items.values():
lines.append("[%s] %s" % (item.id, item.text[:200]))
return "\n".join(lines)[:max_chars]

నాలుగు తనిఖీలు, ప్రతి దానికి డిజైన్ దాచకుండా అంగీకరించే ఒక తెలిసిన అంధ బిందువు.

no_citation అత్యంత చౌకైనది మరియు అత్యంత విలువైనది. సిటేషన్ లేని వాదన తప్పు కాకపోవచ్చు, కానీ ధృవీకరించలేనిది, మరియు రీసెర్చ్ ఏజెంట్‌లో ధృవీకరించలేనిది ఒక లోపం: Part 5 సిటేషన్ ఫార్మాట్ మొత్తం లక్ష్యమే వాదనలను తనిఖీ చేయదగినవి చేయడం. లేప్రాయంగా పరిగణిస్తే మోడల్ సిటేషన్లు ఇవ్వడం నేర్చుకుంటుంది — ప్రాంప్ట్-వైపు సూచన (cite as [doc#n]) ఈ తనిఖీతో కలిసి ఒక ముసిగిన లూప్.

unknown_citation మూసబోయిన సిటేషన్లను పట్టుకుంటుంది — ఆ డాక్యుమెంట్‌లో రెండు చంక్‌లున్నప్పుడు [retrieval-design#7]. వెక్టర్-డేటాబేస్-RAG సిస్టమ్లు దీన్ని దాటేస్తాయి, మరియు ఇది ఉచితం.

number_mismatch వాచస్పతి స్థాయికి కఠినం: వాదనలోని ప్రతి సంఖ్య ఉదహరించిన టెక్స్ట్‌లో యథావాక్యంగా కనిపించాలి. అంటే నిజమైన పునఃకథనం — సాక్ష్యం 180 to 240 milliseconds అంటే, వాదన about 200 ms అంటే — ఎత్తిచూపబడుతుంది. ఇది ఉద్దేశపూర్వకం. పునఃకథించిన సంఖ్యయే సరైన సేకరణ తప్పు సమాధానంగా మారడానికి అత్యంత సాధారణ దారి, ఎత్తిచూపిన పునఃకథనం ఒక సవరణ రౌండ్ ఖర్చు చేస్తుంది, గానీ ఎత్తిచూపని కల్పిత సంఖ్య తప్పు డెలివరబుల్ ఖర్చు చేస్తుంది. 200 ms కేసే క్రింద డెమో చూపేది.

quote_missing 8–160 అక్షరాల కోట్ భాగాలపై మాత్రమే పనిచేస్తుంది. తక్కువ భాగాలు శబ్దం; పొడవాటివి సాధారణంగా మోడల్ తన సారాంశాన్ని కోట్ చేయడం. తనిఖీ కోట్ సాక్ష్యంలో ఎక్కడైనా ఉందో మాత్రమే ధృవీకరిస్తుంది — సరైన సిటేషన్‌కు ఆపాదించబడిందో అని కాదు, అది స్పాన్ అలైన్‌మెంట్ అవసరం చేస్తుంది మరియు ఈ దశలో ఆ సంకీర్ణత విలువైనది కాదు.

రూబ్రిక్‌తో కూడిన క్రిటిక్, ఒక వీటో

క్రిటిక్ అంటే రూబ్రిక్, స్కేల్ మరియు నిర్మాణాత్మక అవుట్‌పుట్‌తో ఒక మోడల్ కాల్. లూప్ దానిపై గణితం చేయగలదు కాబట్టి స్కేల్ ఉంది.

CRITIC_SYSTEM = (
"You are a critic. Score the draft answer against the evidence. Rubric: "
"(1) every factual claim cites evidence; (2) numbers match the cited text exactly; "
"(3) no claim goes beyond what the evidence supports; (4) the answer responds to the goal. "
"Reply with JSON: {\"type\": \"critique\", \"score\": 0.0-1.0, \"verdict\": \"accept|revise\", "
"\"issues\": [{\"claim\": \"...\", \"problem\": \"...\", \"fix\": \"...\"}]}. "
"Score below 0.80 means revise."
)
@dataclass
class Critique:
score: float
verdict: str
issues: list[dict] = field(default_factory=list)
fingerprint: str = ""
class RubricCritic:
"""One model call per round. A malformed critique is an accept, never a revision."""
def __init__(self, llm: LLMClient) -> None:
self.llm = llm
def review(self, goal: str, draft: str, evidence_block: str) -> Critique:
decision = self.llm.complete(
[Message("system", CRITIC_SYSTEM),
Message("user", "Goal: %s\n\nEVIDENCE:\n%s\n\nDRAFT:\n%s" % (goal, evidence_block, draft))],
[],
)
try:
if decision.get("type") != "critique":
raise ValueError("expected a critique decision")
score = float(decision.get("score", 1.0))
verdict = str(decision.get("verdict", "accept"))
issues = decision.get("issues") or []
if verdict not in ("accept", "revise") or not 0.0 <= score <= 1.0:
raise ValueError("malformed critique")
except (TypeError, ValueError):
return Critique(1.0, "accept", [], "unparseable")
fingerprint = hashlib.sha256(
json.dumps([str(i.get("claim", i))[:120] for i in issues], sort_keys=True)
.encode("utf-8")).hexdigest()[:10]
return Critique(min(1.0, max(0.0, score)), verdict, issues, fingerprint)

ఆ క్లాస్‌లో రెండు విధానాలు తమ సొంత వాక్యాలకు అర్హం.

తప్పుగా ఏర్పడిన విమర్శ అంగీకారమే. ఇది వెన్నాడు కనిపిస్తుంది — పాడైన క్రిటిక్ అంటే “మరికొంత ప్రయత్నించు” అని ఉండాలి కదా? అయిదు, ఎందుకంటే లూప్ లోపల క్రిటిక్‌ను మళ్ళీ ప్రయత్నించడం పరిమితి లేని వైఫల్య మార్గం సృష్టిస్తుంది: క్రిటిక్ విఫలమవుతుంది, మీరు మళ్ళీ ప్రయత్నిస్తారు, అది వేరేలా విఫలమవుతుంది, మీరు మళ్ళీ. పార్స్ చేయలేని విమర్శను సురక్షితంగా చదవడం అంటే దానిపై పనిచేయలేం, పనిచేయకపోవడం అంటే ప్రస్తుత డ్రాఫ్ట్‌ను అంగీకరించడం, అది ఇప్పటికే ప్రోగ్రామాత్మక తనిఖీలు దాటింది. లూప్ critic_unparseable ను స్టాప్ కారణంగా నమోదు చేస్తుంది, రన్ మౌనంగా కాక లేబుల్ అవుతుంది.

ఫింగర్‌ప్రింటే కంపన గుర్తింపుదారు. సమస్య వాదనలను హాష్ చేయడం “క్రిటిక్ ఒకే విషయం చెబుతూనే ఉంటుంది” అనే దాన్ని సమానత్వ పరీక్షగా మారుస్తుంది. దీని లేకుండా claim one is thin ను ఎప్పటికీ ఎత్తిచూపే క్రిటిక్ అనంత సవరణ లూప్ ఉత్పత్తి చేస్తుంది — మరియు ఫింగర్‌ప్రింట్ సమానత్వం స్కోర్ సమానత్వం కంటే బలమైన సంకేతం, ఎందుకంటే స్కోర్లు తడారిపోతాయి గానీ ఆగిపోయిన సమస్య ఆగదు.

మూడు స్టాప్ షరతులు

లూప్ తనిఖీలు, క్రిటిక్ మరియు సవరణను కలుపుతుంది. దాని మొత్తం ప్రవర్తన మూడు నిష్క్రమణ షరతుల క్రమంలో ఉంది:

@dataclass
class ReflectionConfig:
max_rounds: int = 2
min_delta: float = 0.08
accept_score: float = 0.8
@dataclass
class ReflectionRun:
final_answer: str
rounds: int
stopped_by: str # accepted | no_progress | oscillation | max_rounds | critic_unparseable
history: list[dict] = field(default_factory=list)
@property
def open_verdicts(self) -> list[Verdict]:
last = self.history[-1] if self.history else {}
return [v for v in last.get("verdicts", []) if v.failed]
class ReflectionLoop:
"""Critique, then revise, with three stop conditions. Never revises on a hunch."""
def __init__(self, llm: LLMClient, critic: RubricCritic, store: EvidenceStore,
config: ReflectionConfig | None = None) -> None:
self.llm = llm
self.critic = critic
self.store = store
self.config = config or ReflectionConfig()
def run(self, goal: str, draft: str) -> ReflectionRun:
current = draft
last_score: float | None = None
last_fingerprint: str | None = None
history: list[dict] = []
stopped_by = "max_rounds"
for round_index in range(self.config.max_rounds):
verdicts = self.store.check_claims(extract_claims(current))
errors = sum(1 for v in verdicts if v.failed)
critique = self.critic.review(goal, current, self.store.block())
if critique.fingerprint == "unparseable":
history.append({"round": round_index, "score": None, "verdicts": verdicts,
"stopped_by": "critic_unparseable"})
return ReflectionRun(current, round_index + 1, "critic_unparseable", history)
score = max(0.0, min(1.0, critique.score - 0.15 * errors))
entry = {"round": round_index, "score": round(score, 2),
"programmatic_errors": errors, "critique": critique,
"verdicts": verdicts}
history.append(entry)
if errors == 0 and critique.verdict == "accept" and score >= self.config.accept_score:
stopped_by = "accepted"
break
if last_score is not None and score - last_score < self.config.min_delta:
stopped_by = "no_progress"
break
if critique.fingerprint == last_fingerprint and critique.issues:
stopped_by = "oscillation"
break
last_score = score
last_fingerprint = critique.fingerprint
current = self.revise(goal, current, critique.issues)
return ReflectionRun(current, len(history), stopped_by, history)
def revise(self, goal: str, draft: str, issues: list[dict]) -> str:
bullets = []
for issue in issues[:5]:
bullets.append("- claim: %s\n problem: %s\n fix: %s"
% (issue.get("claim", ""), issue.get("problem", ""),
issue.get("fix", "")))
decision = self.llm.complete(
[Message("system", "Rewrite the answer to fix every issue. Keep citations that "
"verified clean. Change nothing else."),
Message("user", "Goal: %s\n\nDRAFT:\n%s\n\nISSUES:\n%s" % (goal, draft, "\n".join(bullets)))],
[],
)
return str(decision.get("content", "")) or draft

జరిమానయే వీటో. score - 0.15 * errors నేరుగా తీసేస్తుంది, కాబట్టి సిటేషన్ లేని, సంఖ్యలు కల్పించిన డ్రాఫ్ట్‌కు 0.9 ఇచ్చిన క్రిటిక్ కూడా 0.6 కి చేరుతుంది — accept_score కి దిగువ, మరియు సవరణ జరుగుతుంది. అంగీకార షరతుకు errors == 0 కూడా అవసరం, కాబట్టి ఓపెన్ వెర్డిక్ట్ల రన్‌ను ఎటువంటి గణితం రక్షించదు. క్రిటిక్ నిజాయితీగా ఉండాలంటే ఇదే: ప్రోగ్రామ్ తనిఖీలు సలహా కాదు, క్రిటిక్ ఎదురొంచలేని వీటో.

min_delta=0.08 ఆలస్యం-తప్పించే షరతు. సవరణ ఖర్చు రెండు కాల్స్ (విమర్శ + సవరణ, పైగా సవరణను తీర్పు చెప్పడానికి ఒక విమర్శ). చివరి సవరణ స్కోర్‌ను 0.08 కంటే తక్కువగా కదిలిస్తే, తదుపరిది మెరుగా చేయదు, నిజాయితీ సమాధానం ఆగి లేబుల్ చేయడం: no_progress. క్రింద టెస్ట్‌లలో 0.55 → 0.60 రౌండ్ ఖచ్చితంగా ఇదే ట్రిగర్ చేస్తుంది.

కంపనం మెరుగుదల తర్వాత తనిఖీ చేయబడుతుంది, ఉద్దేశపూర్వకంగా. అదే ఫింగర్‌ప్రింట్‌తో పెద్ద స్కోర్ జంప్ అనుమానాస్పదం — క్రిటిక్‌కు రీరైట్ నచ్చింది మరియు అదే ఫిర్యాదు చేసింది. అక్కడ ఆగడం మూడో రౌండ్ కంటే మెరుస్తుంది, ఎందుకంటే మూడో రౌండ్ రెండోదాన్ని మాత్రమే పునఃప్రదర్శించగలదు. మూడు తనిఖీల క్రమం: అంగీకారం, తర్వాత మెరుగుదల, తర్వాత ఫింగర్‌ప్రింట్. వాటిని మార్చితే వేరే వైఫల్య రన్లు వస్తాయి; టెస్ట్‌లు క్రమాన్ని పిన్ చేస్తాయి.

max_rounds=2 బడ్జెట్, మరియు డిఫాల్ట్ సమాధానం. లూప్ stopped_by="max_rounds" తో మరియు ప్రస్తుత డ్రాఫ్ట్‌తో బయటకు వస్తుంది, రెండు సవరణల తర్వాత అది accept_score ని చేరకపోయినా సాధారణంగా అసలు కంటే మెరుస్తుంది. లేబుల్‌తో విడుదల చేయడం విసర్జించడం కంటే మెరుస్తుంది — కాలర్ (Part 8 చెక్‌పాయింట్ లేయర్) max_rounds సమాధానం దాని యూస్ కేసుకు అంగీకరించదగినదో నిర్ణయించగలదు.

దీన్ని రన్‌లోకి అమర్చడం

ఏజెంట్ ట్రేస్ నుండి సాక్ష్యాన్ని పునర్నిర్మిస్తుంది, ధృవీకరణ మోడల్ గుర్తుంచుకున్న దానికి కాక టూల్స్ తిరిగి ఇచ్చిన దానికి అంటుతుంది:

def evidence_from_trace(trace: list[dict]) -> list[Evidence]:
"""Rebuild the evidence set from a run's search calls. Requires trace records with data."""
items: dict[str, Evidence] = {}
for record in trace:
if record.get("tool") != "search" or not record.get("ok"):
continue
try:
for hit in json.loads(record.get("data", "[]")):
items[hit["citation"]] = Evidence(hit["citation"], hit["text"])
except (ValueError, KeyError, TypeError):
continue
return list(items.values())
class ReflectiveAgent:
"""AgentLoop for the draft, then verification. Evidence comes from the trace, not memory."""
def __init__(self, llm: LLMClient, tools: list[Tool], config: ReflectionConfig | None = None,
max_steps: int = 6, critic: RubricCritic | None = None) -> None:
self.llm = llm
self.tools = tools
self.config = config or ReflectionConfig()
self.max_steps = max_steps
self.critic = critic or RubricCritic(llm)
self.last_trace: list[dict] = []
def run(self, goal: str) -> ReflectionRun:
loop = AgentLoop(self.llm, self.tools, max_steps=self.max_steps)
draft = loop.run(goal)
self.last_trace = loop.trace
store = EvidenceStore(evidence_from_trace(loop.trace))
return ReflectionLoop(self.llm, self.critic, store, self.config).run(goal, draft)

evidence_from_trace విఫల శోధనలను దాటేస్తుంది (not record.get("ok")) — టూల్ ఉత్పత్తి చేయని సాక్ష్యం ఏదీ ధృవీకరించలేదు, విఫల శోధన సిటేషన్‌ను ఉదహరించే డ్రాఫ్ట్ unknown_citation ద్వారా పట్టుకోబడుతుంది.

ఆ పునర్నిర్మాణం యొక్క మూడు లక్షణాలు కనిపించే దానికంటే ముఖ్యం.

నకిలీల తొలగింపు స్వయంచాలకం. ఐదు శోధనలు చేసే రన్ అతిచారించిన పాసేజీలను సేకరిస్తుంది — Part 5 ఇండెక్స్ డిజైన్ ప్రకారం చంక్‌లను అతిచారుస్తుంది, మరియు రెండు క్వెరీలు తరచుగా అదే సిటేషన్ తీసుకువస్తాయి. items సిటేషన్ id ద్వారా కీడ్, కాబట్టి సాక్ష్య సముదాయం ప్రత్యేక పాసేజీల సమూహం, అదే మూడు చంక్‌ల ఐదు కాపీలు కాదు. ధృవీకరణ ఖర్చు రన్ పొడవు కాక కార్పస్ వైవిధ్యంతో పరిమితమవుతుంది.

సాక్ష్య బ్లాక్ ఒక బడ్జెట్ నిర్ణయం. block() 1,400 అక్షరాలకు పరిమితం — సుమారు 350 టోకన్లు — ప్రతి పాసేజ్ 200 కు ట్రంకేట్. ఐదు పాసేజీలు ఇచ్చే రెండు శోధనల ఖర్చు కనుక ప్రతి విమర్శ కాల్‌కు గరిష్ఠంగా 350 టోకన్లు, max_rounds=2 తో మొత్తం రన్‌కు 700 టోకన్ల విమర్శ కాంటెక్స్ట్. సహజ ప్రత్యామ్నాయాన్ని పోల్చండి, పూర్తి ట్రేస్‌ను క్రిటిక్‌కు అతికించడం: 420 టోకన్ల ఐదు శోధనలు 2,100 టోకన్లు, మరియు క్రిటిక్ డ్రాఫ్ట్ ఎప్పుడూ ఉపయోగించని టూల్ అవుట్‌పుట్ చదువుతుంది.

max_steps=6 డ్రాఫ్ట్‌కు పరిమితి, ధృవీకరణకు కాదు. ఆరు లూప్ స్టెప్స్ తర్వాత ఉత్పత్తి చేసిన డ్రాఫ్ట్ ఆరు శోధన పేలోడ్‌లను మాత్రమే ఉదహరించగలదు, కాబట్టి సాక్ష్య సముదాయానికి ఆరు వేర్వేరు సిటేషన్ క్లస్టర్ల గట్టి పైకప్పు ఉంటుంది. లూప్ కాన్ఫిగ్ అస్సలు ప్రస్తావించకపోయినా ధృవీకరణ ఖర్చు max_steps తో పెరుగుతుంది — మరియు అందుకే Part 8 దాన్ని మళ్ళీ గణించకుండా చెక్‌పాయింట్‌తో పాటు ట్రేస్‌ను సుస్థిరం చేస్తుంది.

డెమో ఈ భాగం ఉనికికి కారణమైన ఖచ్చిత వైఫల్యాన్ని పట్టుకుంటుంది. డ్రాఫ్ట్ 340 ms అంటుంది; సాక్ష్యం about 200 ms అంటుంది:

import json
import reflect as rf
from contracts import ScriptedLLM, Tool, ToolResult
EVIDENCE = [
rf.Evidence("latency-budget#0",
"Reranking 20 candidates costs about 200 ms per query at 12 layers. "
"Capping the set at 8 candidates brings the added cost under 100 ms."),
rf.Evidence("chunking#0",
"Chunk sizes between 300 and 500 characters with a fifth of the window "
"as overlap balance precision against index inflation."),
]
DRAFT = ("A cross-encoder reranker costs about 340 ms per query for 20 candidates "
"[latency-budget#0]. Chunk windows should sit between 300 and 500 characters "
"[chunking#0].")
REVISED = ("A cross-encoder reranker costs about 200 ms per query for 20 candidates "
"[latency-budget#0]. Chunk windows should sit between 300 and 500 characters "
"[chunking#0].")
def stub_search_tool() -> Tool:
passages = [
{"citation": "latency-budget#0", "doc": "latency-budget", "text": EVIDENCE[0].text, "score": 0.8},
{"citation": "chunking#0", "doc": "chunking", "text": EVIDENCE[1].text, "score": 0.6},
]
def _run(args: dict) -> ToolResult:
return ToolResult(ok=True, data=json.dumps(passages))
return Tool(
name="search",
description="Return two canned passages with citations.",
parameters={
"type": "object",
"properties": {"query": {"type": "string", "minLength": 2}},
"required": ["query"],
"additionalProperties": False,
},
_fn=_run,
)
def critique(score, verdict, claims):
return {"type": "critique", "score": score, "verdict": verdict,
"issues": [{"claim": c, "problem": "unsupported", "fix": "cite evidence"}
for c in claims]}
SCRIPT = [
{"type": "tool", "name": "search", "arguments": {"query": "reranker latency"}},
{"type": "final", "content": DRAFT},
critique(0.62, "revise", ("A cross-encoder reranker costs about 340 ms per query",)),
{"type": "final", "content": REVISED},
critique(0.90, "accept", ()),
]
def demo() -> None:
llm = ScriptedLLM(SCRIPT)
agent = rf.ReflectiveAgent(llm, [stub_search_tool()], max_steps=3)
run = agent.run("What does reranking cost in latency?")
for entry in run.history:
bad = [(v.code, v.detail) for v in entry.get("verdicts", []) if v.failed]
print("round %d score=%s programmatic_errors=%s open=%s"
% (entry["round"], entry.get("score"), entry.get("programmatic_errors", 0), bad))
print("stopped_by:", run.stopped_by, "rounds:", run.rounds, "model calls:", len(llm.calls))
print("final:", run.final_answer)
if __name__ == "__main__":
demo()
round 0 score=0.47 programmatic_errors=1 open=[('number_mismatch', '340 absent from latency-budget#0')]
round 1 score=0.9 programmatic_errors=0 open=[]
stopped_by: accepted rounds: 2 model calls: 5
final: A cross-encoder reranker costs about 200 ms per query for 20 candidates [latency-budget#0]. Chunk windows should sit between 300 and 500 characters [chunking#0].

ఖర్చులను చదవండి, ఎందుకంటే అవే max_rounds 5 కాక 2 అయ్యే కారణం. బేస్‌లైన్ రన్ 2 మోడల్ కాల్స్ (శోధన, తుది). ప్రతిబింబణ 3 జోడిస్తుంది: ఒక విమర్శ, ఒక సవరణ, ఒక విమర్శ. అది 2.5× కాల్స్ మరియు సుమారు 2× టోకన్లు — విమర్శ మరియు సవరణ ప్రాంప్ట్‌ల రెండూ సాక్ష్య బ్లాక్ (≤1,400 అక్షరాలు) ప్లస్ డ్రాఫ్ట్ మోస్తాయి. ఒక రౌండ్ ఒక కల్పిత సంఖ్యను పట్టింది. అది మంచి వ్యాపారం. సరైన సమాధానాన్ని మెరగించడానికి ఐదు రౌండ్లు అలా కాదు, అదే no_progress మరియు oscillation ఉనికిలోకి వచ్చిన కారణం.

క్రిటిక్ ఏం చేయాల్సిన పనిలేదో కూడా గమనించండి: అది 340 ను ఎన్నడూ గణిత సమస్యగా చూడలేదు. ప్రోగ్రామాత్మక తనిఖీ దాన్ని కనుగొని, పేర్కొంది (340 absent from latency-budget#0), క్రిటిక్ పని తీర్పుకు కుదించుకుంది — డ్రాఫ్ట్ మిగతా భాగం అంగీకరించదగినదా? ఆ పని విభజనే ఒక సవరణ రౌండ్ సరిపోయిన కారణం.

వైఫల్య విధానాలు మరియు వాటి నిర్వహణ

వైఫల్యం నిజంగా జరిగేది ఇక్కడ నిర్వహణ ఇంకా ప్రాణాంతకం
సంఖ్య యొక్క నిజమైన పునఃకథనం about 200 ms వర్సెస్ 180 to 240 milliseconds ఎత్తిచూపబడుతుంది, ఒక సవరణ రౌండ్ ఖర్చు రేంజ్-అవగాహన సంఖ్య తనిఖీ లేదు
క్రిటిక్ అంతాకంటా 0.95 ఇస్తుంది ప్రతిబింబణ ఎన్నడూ ప్రేరేపించబడదు జరిమానా + errors == 0 అంగీకార షరతు క్యాలిబ్రేటెడ్ క్రిటిక్‌కు నిజమైన డేటా కావాలి (Part 10)
క్రిటిక్ అవుట్‌పుట్ పార్స్ చేయలేనిది లూప్ క్రాష్ లేదా తిరగవచ్చు critic_unparseable స్టాప్, డ్రాఫ్ట్ తిరిగి ఇవ్వబడుతుంది రీట్రై లేదు — నిరంతర పాడైన క్రిటిక్ ఒక సంఘటన
ప్రతి రౌండ్ అదే సమస్య అనంత సవరణ ఫింగర్‌ప్రింట్ సమానత్వం → oscillation రివైజర్ సూచనలను వర్తింపజేయదు
సాక్ష్య సముదాయం ఖాళీ (శోధన నడవలేదు) ప్రతి వాదన సిటేషన్ లేనిది అన్ని వాదనలపై no_citation “సాక్ష్యం అవసరం లేదు”, “సాక్ష్యం దాటబడింది” మధ్య భేదం లేదు
డ్రాఫ్ట్ విఫల శోధనను ఉదహరిస్తుంది సిటేషన్ ఎన్నడూ సేకరించబడలేదు unknown_citation మోడల్ శోధనను మళ్ళీ ప్రయత్నించి తప్పోగలదు
సవరణ శుభ్ర వాదనను పగులగొడుతుంది సవరణ తర్వాత స్కోర్ పడిపోతుంది no_progress లూప్‌ను ఆపుతుంది సవరణ ప్రాంప్ట్ సిటేషన్లు ఉంచమని అడుగుతుంది, బలవంతం చేయలేదు

మొదటి అడ్డువరుస కఠిన తనిఖీల నిజాయితీ ఖర్చు: number_mismatch పునఃకథనంపై మండుతుంది. మీ కార్పస్ రేంజ్‌లు మరియు సుమార్లతో నిండి ఉంటే, ప్రతి సమాధానానికి ఒక అదనపు సవరణ రౌండ్ అంగీకరించండి, లేదా తనిఖీని సంఖ్యా-సహన పోలికకు వదులుకోండి — రెండు సంఖ్యలను పార్స్ చేసి, 10 శాతం కన్నా ఎక్కువ భేదం ఉన్నప్పుడు మాత్రమే ఎత్తిచూపు. రెండో ఎంపిక check కు పది లైన్ల మార్పు మరియు మంచి వ్యాయామం, గానీ అది ఏం వదలుతుందో గమనించండి: about 200 కు 180 to 240 రేంజ్ సరిపోవడం ఒక తీర్పు, తనిఖీ తీర్పులు చెప్పగానే అదిని వాదించగలరు.

ట్రేడ్-ఆఫ్స్

నిర్ణయం ప్రత్యామ్నాయం ఎందుకు ఎంచుకున్నాం ఖర్చు
ప్రోగ్రామాత్మక తనిఖీలు ముందు క్రిటిక్ అంతా తీర్పు చెబుతుంది నిర్ణయించదగినవి, ఉచితం, వాదించలేం పునఃకథించిన సంఖ్యలు ఎత్తిచూపబడతాయి
తప్పుగా ఏర్పడిన విమర్శ = అంగీకారం క్రిటిక్‌ను మళ్ళీ ప్రయత్నించు పరిమితి లేని వైఫల్య మార్గం లేదు అస్థిర క్రిటిక్ మౌనంగా అంగీకరిస్తుంది
max_rounds=2 5 లేదా పరిమితి లేనిది ఖర్చు రౌండ్లలో రేఖీయం కఠిన సమస్యలు త్వరగా, లేబుల్‌తో ఆగుతాయి
జరిమానా గణితం (0.15 × errors) క్రిటిక్ వెర్డిక్ట్లను టెక్స్ట్‌గా చూస్తుంది క్రిటిక్ తనిఖీలను ఎదురొంచలేదు బరువు Part 10 వరకు మాయిక్ సంఖ్య
సమస్య వాదనల ఫింగర్‌ప్రింట్ పూర్తి విమర్శను హాష్ చేయు పునఃక్రమణ మరియు స్కోర్ తడారికి దృఢం వేరే పదాలతో అదే వాదన తప్పించుకుంటుంది
ట్రేస్ నుండి సాక్ష్యం మోడల్‌ను సాక్ష్యం జోడించమని అడుగు ట్రేసే గ్రౌండ్ ట్రూత్ ట్రేస్ రికార్డ్‌లలో data అవసరం
సమస్యల నుండి సవరణ, శూన్యం నుండి కాదు సమాధానాన్ని మళ్ళీ ఉత్పత్తి చేయు ధృవీకరించిన వాదనలను కాపాడుతుంది డ్రాఫ్ట్ నిర్మాణం వారసత్వంగా వస్తుంది

జరిమానా అడ్డువరుసను డేటాతో తిరిగి చూడాలి. 0.15 అంటే ఒక ప్రోగ్రామాత్మక లోపం ఖర్చు 15 స్కోర్ పాయింట్లు, అది కొలత కాదు క్యాలిబ్రేషన్ ఊహ. Part 10 హార్నెస్ దాన్ని భర్తీ చేస్తుంది: లేబుల్ చేసిన సెట్‌పై ఏజెంట్‌ను నడిపి, ఓపెన్ వెర్డిక్ట్లతో అంగీకరించిన సమాధానాల సంఖ్యను లెక్కించి, ఆ సంఖ్య సున్నా అయ్యేలా బరువు పెట్టండి.

టెస్టింగ్

పదమూడు టెస్ట్‌లు, నెట్‌వర్క్ లేదు, 7 ms. స్థిరాంశాలు:

import json
import unittest
import reflect as rf
from contracts import ScriptedLLM, Tool, ToolResult
EVIDENCE = [
rf.Evidence("latency-budget#0",
"Reranking 20 candidates costs about 200 ms per query at 12 layers. "
"Capping the set at 8 candidates brings the added cost under 100 ms."),
rf.Evidence("chunking#0",
"Chunk sizes between 300 and 500 characters with a fifth of the window "
"as overlap balance precision against index inflation."),
]
def store():
return rf.EvidenceStore(EVIDENCE)
def critique(score, verdict, claims):
return {"type": "critique", "score": score, "verdict": verdict,
"issues": [{"claim": c, "problem": "unsupported", "fix": "cite evidence"}
for c in claims]}
class TestChecks(unittest.TestCase):
def test_uncited_claim_is_flagged(self):
verdicts = store().check(rf.Claim("Reranking costs 200 ms per query.", ()))
self.assertEqual(verdicts[0].code, "no_citation")
def test_invented_citation_is_flagged(self):
verdicts = store().check(rf.Claim("Reranking is slow [ghost-doc#0].", ("ghost-doc#0",)))
self.assertEqual(verdicts[0].code, "unknown_citation")
def test_fabricated_number_is_flagged(self):
claim = rf.Claim("Reranking costs about 340 ms per query [latency-budget#0].",
("latency-budget#0",))
verdicts = store().check(claim)
self.assertEqual(verdicts[0].code, "number_mismatch")
self.assertIn("340", verdicts[0].detail)
def test_unsupported_quote_is_flagged(self):
claim = rf.Claim('The guide says "never rerank above twelve candidates" [latency-budget#0].',
("latency-budget#0",))
self.assertEqual(store().check(claim)[0].code, "quote_missing")
def stub_search_tool() -> Tool:
passages = [
{"citation": "latency-budget#0", "doc": "latency-budget", "text": EVIDENCE[0].text, "score": 0.8},
{"citation": "chunking#0", "doc": "chunking", "text": EVIDENCE[1].text, "score": 0.6},
]
def _run(args: dict) -> ToolResult:
return ToolResult(ok=True, data=json.dumps(passages))
return Tool(name="search", description="Canned passages.",
parameters={"type": "object",
"properties": {"query": {"type": "string", "minLength": 2}},
"required": ["query"], "additionalProperties": False},
_fn=_run)
DRAFT = ("A cross-encoder reranker costs about 340 ms per query for 20 candidates "
"[latency-budget#0]. Chunk windows should sit between 300 and 500 characters [chunking#0].")
REVISED = ("A cross-encoder reranker costs about 200 ms per query for 20 candidates "
"[latency-budget#0]. Chunk windows should sit between 300 and 500 characters [chunking#0].")
class TestLoop(unittest.TestCase):
def test_fabricated_number_survives_one_revision_then_accepts(self):
llm = ScriptedLLM([
{"type": "tool", "name": "search", "arguments": {"query": "reranker latency"}},
{"type": "final", "content": DRAFT},
critique(0.62, "revise", ("A cross-encoder reranker costs about 340 ms",)),
{"type": "final", "content": REVISED},
critique(0.90, "accept", ()),
])
run = rf.ReflectiveAgent(llm, [stub_search_tool()]).run("What does reranking cost?")
self.assertEqual(run.rounds, 2)
self.assertEqual(run.stopped_by, "accepted")
self.assertEqual(run.history[0]["programmatic_errors"], 1)
self.assertIn("340", run.history[0]["verdicts"][0].detail)
def test_same_issue_twice_is_oscillation(self):
llm = ScriptedLLM([
critique(0.55, "revise", ("claim one is thin",)),
{"type": "final", "content": "Claim one, expanded [latency-budget#0]."},
critique(0.75, "revise", ("claim one is thin",)),
])
run = rf.ReflectionLoop(llm, rf.RubricCritic(llm), store(),
rf.ReflectionConfig(max_rounds=4, min_delta=0.01)
).run("goal", "Claim one [latency-budget#0].")
self.assertEqual(run.stopped_by, "oscillation")
def test_no_progress_stops_before_a_second_revision(self):
llm = ScriptedLLM([
critique(0.55, "revise", ("claim one is thin",)),
{"type": "final", "content": "Claim one, expanded [latency-budget#0]."},
critique(0.60, "revise", ("claim one is still thin",)),
])
run = rf.ReflectionLoop(llm, rf.RubricCritic(llm), store(),
rf.ReflectionConfig(max_rounds=4)).run(
"goal", "Claim one [latency-budget#0].")
self.assertEqual(run.stopped_by, "no_progress")
self.assertEqual(len(run.history), 2)
def test_unparseable_critic_never_forces_a_revision(self):
llm = ScriptedLLM([{"type": "critique", "score": "high", "verdict": "maybe"}])
run = rf.ReflectionLoop(llm, rf.RubricCritic(llm), store(),
rf.ReflectionConfig(max_rounds=3)).run("g", "draft")
self.assertEqual(run.stopped_by, "critic_unparseable")
self.assertEqual(run.final_answer, "draft")
def test_reviser_prompt_contains_the_issues(self):
llm = ScriptedLLM([
critique(0.55, "revise", ("claim one is thin",)),
{"type": "final", "content": "Claim one, fixed [latency-budget#0]."},
critique(0.95, "accept", ()),
])
rf.ReflectionLoop(llm, rf.RubricCritic(llm), store()).run("g", "Claim one [latency-budget#0].")
self.assertIn("claim one is thin", llm.calls[1][1].content)
if __name__ == "__main__":
unittest.main()

test_no_progress_stops_before_a_second_revision మరియు test_same_issue_twice_is_oscillation ఉద్దేశపూర్వకంగా దాదాపు ఒకేలా — అదే విమర్శ రూపం, అదే డ్రాఫ్ట్ — ఎందుకంటే రెండు స్టాప్ షరతులను టెస్ట్ సెటప్ కాక స్కోర్ కదలిక ద్వారా వేరు చేయగలగాలి. రీఫ్యాక్టర్ వాటిని ఒక తనిఖీలో కలిపితే, ఈ రెండు టెస్ట్‌లు వేర్వేరు stopped_by విలువలతో విఫలమవుతాయి మరియు విలీనం కనిపిస్తుంది.

test_unparseable_critic_never_forces_a_revision మాల్ఫార్మ్-పై అంగీకార విధానాన్ని పిన్ చేస్తుంది. ఆకర్షణీయ ప్రత్యామ్నాయం — క్రిటిక్‌ను మళ్ళీ ప్రయత్నించడం — అదే పరిమితి లేని మార్గం, ఈ టెస్టే గార్డ్‌రైల్.

వ్యాయామాలు

  1. సహనశీల సంఖ్య తనిఖీ. number_mismatch ను వాదన మరియు సాక్ష్య సంఖ్యలను పార్స్ చేసి, 10 శాతం కన్నా ఎక్కువ భేదం ఉన్నప్పుడు మాత్రమే ఎత్తిచూపేలా మార్చండి. తర్వాత విరోధి కేసు రాయండి: సాక్ష్యం under 100 ms అంటే, డ్రాఫ్ట్ 95 ms అంటుంది. సహనం తప్పు ఖచ్చిత సంఖ్యను వదిలేస్తుందా? గీత ఎక్కడ?
  2. తనిఖీకోసం జరిమానాలు. 0.15 * errors ను కోడ్‌కోసం బరువుతో భర్తీ చేయండి: unknown_citation ఖర్చు quote_missing కంటే ఎక్కువ ఉండాలి. ప్రతి బరువును ఒక వాక్యంలో సమర్థించి, పది డ్రాఫ్ట్‌లను లూప్ ద్వారా నడిపి అంగీకార రేటు మారిందో నివేదించండి.
  3. టాస్క్ లోపల ప్రతిబింబణ. PlannedAgent._run_task కు ప్రతిబింబణ పాస్ ఇవ్వండి: ప్రతి టాస్క్ ఫలితాన్ని తిరిగి ఇచ్చే ముందు దాని సొంత శోధన సాక్ష్యంతో ధృవీకరించండి. పెర్-టాస్క్ ప్రతిబింబణంతో మరియు లేకుండా నాలుగు-టాస్క్ ప్లాన్ కోసం మొత్తం మోడల్ కాల్స్ మరియు వాల్ టైమ్ కొలవండి. పెర్-టాస్క్ ధృవీకరణ రన్-చివర ధృవీకరణను ఎక్కడ మించింది, ఎక్కడ వృథా?

వ్యాయామం 3 ఆర్కిటెక్చరల్ది. టాస్క్ సరిహద్దులో ధృవీకరణ సింథసిస్‌లోకి ప్రవేశించే ముందే లోపాలను పట్టుకుంటుంది, గానీ ప్రతి టాస్క్‌పై ప్రతిబింబణ ఖర్చు చెల్లిస్తుంది — కొలత నిర్ణయిస్తుంది, మరియు గుణాత్మక యంత్రాగం ఎక్కడ నివసించాలో ఎంచుకోవాల్సిన తొలిసారి ఇదే ఈ సీరీస్.

తర్వాత ఏమిటి

ఇప్పటివరకు అంతా ఒక ప్రాసెస్ లోపల నడుస్తుంది: ట్రేస్, ప్లాన్, సాక్ష్య సముదాయం మరియు ప్రతిబింబణ చరిత్ర అంతా అది ఆగిపోగా అదృశ్యమవుతాయి. నాలుగు నిమిషాలు పడే రన్ డిప్లాయ్ ను తట్టుకోలేదు, మరియు 8 లో టాస్క్ 6 పై క్రాష్ టాస్క్ 1 నుండి పునఃప్రారంభమవుతుంది.

Part 8, Checkpointing and recovery, స్థిరమైన స్థితిని జోడిస్తుంది: ప్రతి టాస్క్ మరియు ప్రతి లూప్ స్టెప్ తర్వాత రాసే చెక్‌పాయింట్, పునఃప్రారంభించిన రన్ ఎప్పుడూ సైడ్ ఎఫెక్ట్ పునరావృతం చేయకుండా ఇడింపోటెంట్ టూల్ రీప్లే, మరియు ప్లానర్ కోసం చెక్‌పాయింట్-నుండి-పునఃప్రారంభ ప్రవర్తన. మీరు ఇప్పుడు నిర్మించిన ప్రతిబింబణ చరిత్ర చెక్‌పాయింట్‌లో భాగమవుతుంది — పునఃప్రారంభించిన రన్ ఇప్పటికే పాస్ అయిన సమాధానాన్ని మళ్ళీ విమర్శించకూడదు.

Connect your agents without writing code

Everything above, running in Ball — no code, no install. Try it in your browser.

Try Ball free
Get the free AI agent kit

Only used to send Ball resources. No spam.

Try Ball in your browser — no install, no signup needed.

Try Ball in your browser — no install, no signup needed.

Reading in English? Switch language in the menu.