Buckets:

download
raw
73.3 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;QED Math Environment&quot;,&quot;local&quot;:&quot;qed-math-environment&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Features&quot;,&quot;local&quot;:&quot;features&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Quick Start&quot;,&quot;local&quot;:&quot;quick-start&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Async (default)&quot;,&quot;local&quot;:&quot;async-default&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Sync&quot;,&quot;local&quot;:&quot;sync&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;MCP tool-calling&quot;,&quot;local&quot;:&quot;mcp-tool-calling&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Building &amp; Running&quot;,&quot;local&quot;:&quot;building--running&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Project Structure&quot;,&quot;local&quot;:&quot;project-structure&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Configuration&quot;,&quot;local&quot;:&quot;configuration&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Dataset Format&quot;,&quot;local&quot;:&quot;dataset-format&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Local JSONL/JSON&quot;,&quot;local&quot;:&quot;local-jsonljson&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Hugging Face Hub&quot;,&quot;local&quot;:&quot;hugging-face-hub&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Field Aliases&quot;,&quot;local&quot;:&quot;field-aliases&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Observation Space&quot;,&quot;local&quot;:&quot;observation-space&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;ProblemObservation (from reset / get_problem )&quot;,&quot;local&quot;:&quot;problemobservation-from-reset--getproblem-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;ProofSubmissionObservation (from submit_proof )&quot;,&quot;local&quot;:&quot;proofsubmissionobservation-from-submitproof-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;MCP Tools&quot;,&quot;local&quot;:&quot;mcp-tools&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Reward Shaping&quot;,&quot;local&quot;:&quot;reward-shaping&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Harness-injected token count&quot;,&quot;local&quot;:&quot;harness-injected-token-count&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Verifier Metrics&quot;,&quot;local&quot;:&quot;verifier-metrics&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;TrackIO Integration&quot;,&quot;local&quot;:&quot;trackio-integration&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Deployment&quot;,&quot;local&quot;:&quot;deployment&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/>
<link href="/docs/openenv/main/en/_app/immutable/entry/start.CdJBJ6Jk.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/fQO-QNH5.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/BSuxAqoA.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/entry/app.DMA_b4SN.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/Ds_1Ru_R.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/Cnnc8tms.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/BAUKCucN.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/nodes/0.kbjh0TUT.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/CR5HsSXT.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/nodes/28.z_QSxeyD.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/C07d6Hje.js" rel="modulepreload">
<!--1acgbh5--><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;QED Math Environment&quot;,&quot;local&quot;:&quot;qed-math-environment&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Features&quot;,&quot;local&quot;:&quot;features&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Quick Start&quot;,&quot;local&quot;:&quot;quick-start&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Async (default)&quot;,&quot;local&quot;:&quot;async-default&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Sync&quot;,&quot;local&quot;:&quot;sync&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;MCP tool-calling&quot;,&quot;local&quot;:&quot;mcp-tool-calling&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Building &amp; Running&quot;,&quot;local&quot;:&quot;building--running&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Project Structure&quot;,&quot;local&quot;:&quot;project-structure&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Configuration&quot;,&quot;local&quot;:&quot;configuration&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Dataset Format&quot;,&quot;local&quot;:&quot;dataset-format&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Local JSONL/JSON&quot;,&quot;local&quot;:&quot;local-jsonljson&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Hugging Face Hub&quot;,&quot;local&quot;:&quot;hugging-face-hub&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Field Aliases&quot;,&quot;local&quot;:&quot;field-aliases&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Observation Space&quot;,&quot;local&quot;:&quot;observation-space&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;ProblemObservation (from reset / get_problem )&quot;,&quot;local&quot;:&quot;problemobservation-from-reset--getproblem-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;ProofSubmissionObservation (from submit_proof )&quot;,&quot;local&quot;:&quot;proofsubmissionobservation-from-submitproof-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;MCP Tools&quot;,&quot;local&quot;:&quot;mcp-tools&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Reward Shaping&quot;,&quot;local&quot;:&quot;reward-shaping&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Harness-injected token count&quot;,&quot;local&quot;:&quot;harness-injected-token-count&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Verifier Metrics&quot;,&quot;local&quot;:&quot;verifier-metrics&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;TrackIO Integration&quot;,&quot;local&quot;:&quot;trackio-integration&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Deployment&quot;,&quot;local&quot;:&quot;deployment&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/><!---->
<link href="/docs/openenv/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="qed-math-environment" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#qed-math-environment"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>QED Math Environment</span></h1><!--]--><!----> <p>Mathematical proof generation and evaluation environment for OpenEnv, ported from <a href="https://github.com/CMU-AIRe/QED-Nano" rel="nofollow">QED-Nano</a>. Agents receive math problems, submit proofs, and receive LLM-based rubric grading on a 0–7 scale with normalized rewards.</p> <!--[1--><h2 class="relative group"><a id="features" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#features"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Features</span></h2><!--]--><!----> <ul><li><strong>LLM-based rubric grading</strong> (0–7 scale) via any OpenAI-compatible endpoint</li> <li><strong>Process-based answer verification service</strong> (<code>math_verify</code> in worker processes)</li> <li><strong>Backpressure + retries + worker restart</strong> for robust concurrent rollout operation</li> <li><strong>Gold-answer cache</strong> keyed by <code>problem_id</code> and verifier normalization settings</li> <li><strong>Flexible dataset loading</strong>: local JSONL/JSON, Hugging Face Hub, or built-in bootstrap problems</li> <li><strong>Reward shaping</strong>: discount factor, length penalty, and optional score thresholding</li> <li><strong>Reasoning stripping</strong>: configurable delimiters (e.g. <code>&lt;think>...&lt;/think></code>) removed before grading</li> <li><strong>Multi-step problems</strong>: configurable max attempts with per-attempt feedback</li> <li><strong>Verifier metrics</strong>: rollout/staging counters and health signals surfaced in observation metadata, ready for TrackIO / WandB</li> <li><strong>MCP tool interface</strong>: <code>get_problem</code>, <code>submit_proof</code>, <code>get_grading_guidelines</code></li></ul> <!--[1--><h2 class="relative group"><a id="quick-start" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#quick-start"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Quick Start</span></h2><!--]--><!----> <!--[2--><h3 class="relative group"><a id="async-default" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#async-default"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Async (default)</span></h3><!--]--><!----> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> asyncio
<span class="hljs-keyword">from</span> qed_math_env <span class="hljs-keyword">import</span> QEDMathEnv
<span class="hljs-keyword">async</span> <span class="hljs-keyword">def</span> <span class="hljs-title function_">main</span>():
<span class="hljs-keyword">async</span> <span class="hljs-keyword">with</span> QEDMathEnv(base_url=<span class="hljs-string">&quot;http://localhost:8000&quot;</span>) <span class="hljs-keyword">as</span> env:
<span class="hljs-comment"># Reset to load a problem</span>
result = <span class="hljs-keyword">await</span> env.reset()
obs = result.observation
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Problem: <span class="hljs-subst">{obs.problem[:<span class="hljs-number">100</span>]}</span>...&quot;</span>)
<span class="hljs-comment"># Submit a proof</span>
submission = <span class="hljs-keyword">await</span> env.submit_proof(proof=<span class="hljs-string">&quot;By induction on n...&quot;</span>)
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Score: <span class="hljs-subst">{submission.score}</span>/7, Reward: <span class="hljs-subst">{submission.reward:<span class="hljs-number">.2</span>f}</span>&quot;</span>)
asyncio.run(main())<!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="sync" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#sync"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Sync</span></h3><!--]--><!----> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> qed_math_env <span class="hljs-keyword">import</span> QEDMathEnv
<span class="hljs-keyword">with</span> QEDMathEnv(base_url=<span class="hljs-string">&quot;http://localhost:8000&quot;</span>).sync() <span class="hljs-keyword">as</span> env:
result = env.reset()
submission = env.call_tool(<span class="hljs-string">&quot;submit_proof&quot;</span>, proof=<span class="hljs-string">&quot;By induction on n...&quot;</span>)<!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="mcp-tool-calling" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#mcp-tool-calling"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>MCP tool-calling</span></h3><!--]--><!----> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">async</span> <span class="hljs-keyword">with</span> QEDMathEnv(base_url=<span class="hljs-string">&quot;http://localhost:8000&quot;</span>) <span class="hljs-keyword">as</span> env:
<span class="hljs-keyword">await</span> env.reset()
<span class="hljs-comment"># Discover tools</span>
tools = <span class="hljs-keyword">await</span> env.list_tools()
<span class="hljs-built_in">print</span>([t.name <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> tools])
<span class="hljs-comment"># [&#x27;get_problem&#x27;, &#x27;submit_proof&#x27;, &#x27;get_grading_guidelines&#x27;]</span>
<span class="hljs-comment"># Call tools by name</span>
problem = <span class="hljs-keyword">await</span> env.call_tool(<span class="hljs-string">&quot;get_problem&quot;</span>)
guidelines = <span class="hljs-keyword">await</span> env.call_tool(<span class="hljs-string">&quot;get_grading_guidelines&quot;</span>)
result = <span class="hljs-keyword">await</span> env.call_tool(<span class="hljs-string">&quot;submit_proof&quot;</span>, proof=<span class="hljs-string">&quot;...&quot;</span>)<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="building--running" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#building--running"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Building &amp; Running</span></h2><!--]--><!----> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!----><span class="hljs-comment"># Build Docker image (from project root)</span>
docker build -t qed-math-env:latest -f envs/qed_math_env/server/Dockerfile .
<span class="hljs-comment"># Run the server</span>
docker run -p 8000:8000 -e OPENAI_API_KEY=<span class="hljs-variable">$OPENAI_API_KEY</span> qed-math-env:latest
<span class="hljs-comment"># Or run locally with uvicorn</span>
PYTHONPATH=src:envs uvicorn qed_math_env.server.app:app --port 8000
<span class="hljs-comment"># Or install and run via uv</span>
<span class="hljs-built_in">cd</span> envs/qed_math_env
uv <span class="hljs-built_in">sync</span>
uv run server<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="project-structure" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#project-structure"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Project Structure</span></h2><!--]--><!----> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class=" "><!---->qed_math_env<span class="hljs-symbol">/</span>
├── __init__.py <span class="hljs-comment"># Module exports (QEDMathEnv, models)</span>
├── models.py <span class="hljs-comment"># ProblemObservation, ProofSubmissionObservation</span>
├── client.py <span class="hljs-comment"># QEDMathEnv client (MCPToolClient subclass)</span>
├── openenv.yaml <span class="hljs-comment"># OpenEnv manifest with metrics declarations</span>
├── pyproject.toml <span class="hljs-comment"># Dependencies</span>
├── uv.lock <span class="hljs-comment"># Locked dependencies</span>
├── README.md
├── prompts<span class="hljs-symbol">/</span>
│ └── evaluator_prompts<span class="hljs-symbol">/</span>
│ ├── v0.md <span class="hljs-comment"># Evaluator prompt (QED-Nano v0, uses reference solution)</span>
│ ├── v1.md <span class="hljs-comment"># Evaluator prompt (QED-Nano v1, default, full 0–7 range)</span>
│ └── v2.md <span class="hljs-comment"># Evaluator prompt (QED-Nano v2, scores constrained to {0,1,6,7})</span>
└── server<span class="hljs-symbol">/</span>
├── __init__.py
├── app.py <span class="hljs-comment"># FastAPI server (create_app factory)</span>
├── qed_math_environment.py <span class="hljs-comment"># QEDMathEnvironment (MCPEnvironment)</span>
├── math_verify_service.py <span class="hljs-comment"># Process-pool verifier service + health/metrics</span>
├── mcp_server.py <span class="hljs-comment"># MCP tool registration</span>
├── rubric.py <span class="hljs-comment"># MathProofRubric + GradingResult</span>
└── Dockerfile<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="configuration" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#configuration"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Configuration</span></h2><!--]--><!----> <p>The environment is configured via <code>QEDMathConfig</code>:</p> <table><thead><tr><th>Parameter</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>dataset_path</code></td><td><code>None</code></td><td>Dataset source: local path, Hub ID, or list of specs. <code>None</code> uses bootstrap problems.</td></tr><tr><td><code>grader_model</code></td><td><code>"gemini-3-pro"</code></td><td>Model identifier for the LLM grader (any OpenAI-compatible endpoint)</td></tr><tr><td><code>prompt_name</code></td><td><code>"v1"</code></td><td>Evaluator prompt template name (<code>v0</code>, <code>v1</code>, or <code>v2</code> in <code>prompts/evaluator_prompts/</code>). <code>v1</code> matches the QED-Nano default (full 0–7 range); <code>v2</code> constrains scores to <code>{0,1,6,7}</code></td></tr><tr><td><code>grader_temperature</code></td><td><code>1.0</code></td><td>Sampling temperature forwarded to the grader (matches QED-Nano)</td></tr><tr><td><code>grader_max_output_tokens</code></td><td><code>None</code></td><td>Optional output-token cap for the grader. <code>None</code> uses the provider default to avoid truncating the trailing <code>&lt;score></code> tag</td></tr><tr><td><code>custom_reward_threshold</code></td><td><code>False</code></td><td>When <code>True</code>, collapses partial-credit scores 1–5 → 1</td></tr><tr><td><code>answer_reward_preset</code></td><td><code>"pure_success"</code></td><td>Answer-mode reward table: <code>pure_success</code> (correct→1, else 0) or <code>base</code> (adds penalties: wrong −0.5, no_answer/unparsable −1)</td></tr><tr><td><code>max_attempts</code></td><td><code>1</code></td><td>Max proof attempts per problem (>1 for multi-step)</td></tr><tr><td><code>discount_factor</code></td><td><code>1.0</code></td><td>Exponential discount: <code>reward *= discount_factor ** output_length_tokens</code></td></tr><tr><td><code>buffer_tokens</code></td><td><code>0</code></td><td>Length penalty zone width. <code>0</code> disables the penalty.</td></tr><tr><td><code>max_tokens</code></td><td><code>0</code></td><td>Max token limit for length penalty computation</td></tr><tr><td><code>reasoning_delimiters</code></td><td><code>["&lt;/think>"]</code></td><td>Delimiter strings to strip reasoning before grading (matches QED-Nano). Set to <code>None</code> to grade the full completion.</td></tr><tr><td><code>verifier_workers</code></td><td><code>max(2, min(8, cpu_count//2))</code></td><td>Number of process workers used for answer-mode verification</td></tr><tr><td><code>verifier_queue_size</code></td><td><code>verifier_workers * 32</code></td><td>Max in-flight verifier requests before backpressure</td></tr><tr><td><code>verifier_request_timeout_seconds</code></td><td><code>5.0</code></td><td>Per-request client-side timeout when awaiting worker response</td></tr><tr><td><code>verifier_max_retries</code></td><td><code>1</code></td><td>Retry budget for transient verifier infra failures</td></tr><tr><td><code>verifier_strict</code></td><td><code>True</code></td><td>Strict <code>math_verify</code> equivalence mode</td></tr><tr><td><code>verifier_numeric_precision</code></td><td><code>5</code></td><td>Numeric precision setting used in verifier request contract</td></tr><tr><td><code>verifier_float_rounding</code></td><td><code>10</code></td><td>Float rounding setting used in verifier request contract</td></tr></tbody></table> <p>Environment variables:</p> <ul><li><code>OPENAI_API_KEY</code> — API key for the grader LLM</li> <li><code>OPENAI_BASE_URL</code> — Base URL override (for non-OpenAI providers)</li></ul> <!--[1--><h2 class="relative group"><a id="dataset-format" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#dataset-format"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Dataset Format</span></h2><!--]--><!----> <!--[2--><h3 class="relative group"><a id="local-jsonljson" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#local-jsonljson"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Local JSONL/JSON</span></h3><!--]--><!----> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-json "><!----><span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;problem&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Prove that the sum of two even integers is even.&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;solution&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Let a=2m and b=2n. Then a+b=2(m+n), which is even.&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;rubrics&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
<span class="hljs-punctuation">{</span><span class="hljs-attr">&quot;title&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Definitions&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-attr">&quot;points&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">2</span><span class="hljs-punctuation">,</span> <span class="hljs-attr">&quot;desc&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Correctly defines even integers.&quot;</span><span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span>
<span class="hljs-punctuation">{</span><span class="hljs-attr">&quot;title&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Algebra&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-attr">&quot;points&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">3</span><span class="hljs-punctuation">,</span> <span class="hljs-attr">&quot;desc&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Valid algebraic manipulation.&quot;</span><span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span>
<span class="hljs-punctuation">{</span><span class="hljs-attr">&quot;title&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Conclusion&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-attr">&quot;points&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">2</span><span class="hljs-punctuation">,</span> <span class="hljs-attr">&quot;desc&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Correctly concludes evenness.&quot;</span><span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;dataset&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;FineProofs-RL&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;problem_id&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;fp_001&quot;</span>
<span class="hljs-punctuation">}</span><!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="hugging-face-hub" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#hugging-face-hub"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Hugging Face Hub</span></h3><!--]--><!----> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!---->QEDMathConfig(dataset_path=<span class="hljs-string">&quot;meta-math/MetaMathQA&quot;</span>)
<span class="hljs-comment"># or with config</span>
QEDMathConfig(dataset_path={<span class="hljs-string">&quot;hub_id&quot;</span>: <span class="hljs-string">&quot;meta-math/MetaMathQA&quot;</span>, <span class="hljs-string">&quot;split&quot;</span>: <span class="hljs-string">&quot;train&quot;</span>, <span class="hljs-string">&quot;config&quot;</span>: <span class="hljs-string">&quot;default&quot;</span>})<!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="field-aliases" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#field-aliases"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Field Aliases</span></h3><!--]--><!----> <p>The environment normalizes many dataset formats automatically:</p> <table><thead><tr><th>Canonical Field</th><th>Accepted Aliases</th></tr></thead><tbody><tr><td><code>problem</code></td><td><code>task</code>, <code>Problem</code></td></tr><tr><td><code>reference_solution</code></td><td><code>solution</code>, <code>answer</code>, <code>Solution</code></td></tr><tr><td><code>grading_guidelines</code></td><td><code>rubrics</code>, <code>schema</code>, <code>schema_0</code>, <code>Grading guidelines</code>, <code>details</code></td></tr><tr><td><code>problem_id</code></td><td><code>id</code></td></tr><tr><td><code>original_problem</code></td><td>Used for RC-stream problems where the actor prompt differs from grading prompt</td></tr></tbody></table> <!--[1--><h2 class="relative group"><a id="observation-space" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#observation-space"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Observation Space</span></h2><!--]--><!----> <!--[2--><h3 class="relative group"><a id="problemobservation-from-reset--getproblem-" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#problemobservation-from-reset--getproblem-"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>ProblemObservation (from reset / get_problem )</span></h3><!--]--><!----> <table><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>problem</code></td><td><code>str</code></td><td>Math problem statement</td></tr><tr><td><code>reference_solution</code></td><td><code>str</code></td><td>Ground-truth solution</td></tr><tr><td><code>grading_guidelines</code></td><td><code>str</code></td><td>Rubric / marking scheme</td></tr><tr><td><code>problem_id</code></td><td><code>str</code></td><td>Unique identifier</td></tr><tr><td><code>problem_type</code></td><td><code>str</code></td><td><code>"proof"</code>, <code>"answer"</code>, or <code>"multi_step"</code></td></tr><tr><td><code>dataset_source</code></td><td><code>str</code></td><td>Source dataset name</td></tr><tr><td><code>metadata</code></td><td><code>dict</code></td><td>Additional context (e.g. <code>original_problem</code>)</td></tr></tbody></table> <!--[2--><h3 class="relative group"><a id="proofsubmissionobservation-from-submitproof-" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#proofsubmissionobservation-from-submitproof-"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>ProofSubmissionObservation (from submit_proof )</span></h3><!--]--><!----> <table><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>proof</code></td><td><code>str</code></td><td>Submitted proof text</td></tr><tr><td><code>score</code></td><td><code>int</code></td><td>Raw grade (0–7)</td></tr><tr><td><code>feedback</code></td><td><code>str</code></td><td>Full grader response</td></tr><tr><td><code>reward</code></td><td><code>float</code></td><td>Shaped reward in [0, 1]</td></tr><tr><td><code>done</code></td><td><code>bool</code></td><td>Whether the episode is over</td></tr><tr><td><code>is_correct</code></td><td><code>bool</code></td><td>Whether score >= success threshold (default 7, matching QED-Nano’s <code>score == 7</code>)</td></tr><tr><td><code>attempt_number</code></td><td><code>int</code></td><td>Current attempt count</td></tr><tr><td><code>attempts_remaining</code></td><td><code>int</code></td><td>Remaining attempts</td></tr><tr><td><code>problem_type</code></td><td><code>str</code></td><td>Problem type</td></tr><tr><td><code>metadata</code></td><td><code>dict</code></td><td>Contains <code>verifier_metrics</code>, <code>base_reward</code>, <code>shaped_reward</code></td></tr></tbody></table> <!--[1--><h2 class="relative group"><a id="mcp-tools" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#mcp-tools"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>MCP Tools</span></h2><!--]--><!----> <table><thead><tr><th>Tool</th><th>Description</th><th>Parameters</th></tr></thead><tbody><tr><td><code>get_problem</code></td><td>Return current problem statement and metadata</td><td></td></tr><tr><td><code>submit_proof</code></td><td>Submit a proof for LLM-based rubric grading</td><td><code>proof</code> (str, required)</td></tr><tr><td><code>get_grading_guidelines</code></td><td>Return the rubric/marking scheme</td><td></td></tr></tbody></table> <blockquote><p><strong>Note:</strong> <code>output_length_tokens</code> is <strong>not</strong> an agent-supplied parameter. Token counts are
injected by the training harness via the HTTP step request body (see <a href="#reward-shaping">Reward Shaping</a>)
to preserve reward integrity — the agent cannot influence its own discount factor.</p></blockquote> <!--[1--><h2 class="relative group"><a id="reward-shaping" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#reward-shaping"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Reward Shaping</span></h2><!--]--><!----> <p>The reward pipeline follows QED-Nano conventions:</p> <ol><li><strong>LLM grading</strong>: Score 0–7 via evaluator prompt with <code>&lt;score>N&lt;/score></code> parsing</li> <li><strong>Optional thresholding</strong>: Collapses 1–5 → 1 (when <code>custom_reward_threshold=True</code>)</li> <li><strong>Normalization</strong>: <code>reward = score / 7.0</code></li> <li><strong>Discount factor</strong>: <code>reward *= discount_factor ** output_length_tokens</code></li> <li><strong>Length penalty</strong>: Linear penalty when output approaches <code>max_tokens</code></li></ol> <p>For answer-mode problems (<code>evaluation_mode: "answer"</code>), grading is routed through the process-based verifier service: <code>\boxed{}</code> answers are extracted and verified against cached gold answers, with timeout/retry/backpressure handling for concurrent rollouts. The answer-mode reward is selected from <code>answer_reward_preset</code> keyed on the verifier status (<code>correct</code>, <code>wrong</code>, <code>no_answer</code>, <code>unparsable</code>); transient <code>timeout</code>/<code>internal_error</code> statuses stay neutral (0).</p> <p><strong>Proof vs. answer routing:</strong> when a dataset row does not set an explicit <code>problem_type</code>/<code>evaluation_mode</code>, the mode is auto-detected like QED-Nano’s <code>if "schema" in problem</code> — a row carrying a grading rubric/schema is graded as a <strong>proof</strong> (LLM judge), while a row with no rubric is treated as an <strong>answer</strong> problem (boxed gold + <code>math_verify</code>). Set <code>problem_type</code>/<code>evaluation_mode</code> explicitly to override.</p> <!--[2--><h3 class="relative group"><a id="harness-injected-token-count" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#harness-injected-token-count"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Harness-injected token count</span></h3><!--]--><!----> <p>Steps 4 and 5 require the full generation length (including any reasoning trace that is stripped before grading). This value cannot come from the agent — it is supplied by the training harness as an out-of-band field in the HTTP step request body, mirroring the <a href="https://github.com/PrimeIntellect-ai/verifiers/blob/main/verifiers/utils/usage_utils.py" rel="nofollow"><code>StateUsageTracker</code></a> pattern from PrimeIntellect/verifiers:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-comment"># Training harness (pseudocode)</span>
completion_tokens = llm_call.usage.completion_tokens <span class="hljs-comment"># from inference API</span>
step_response = <span class="hljs-keyword">await</span> openenv_client.step(
action=CallToolAction(tool_name=<span class="hljs-string">&quot;submit_proof&quot;</span>, arguments={<span class="hljs-string">&quot;proof&quot;</span>: proof_text}),
output_length_tokens=completion_tokens, <span class="hljs-comment"># injected here, not via MCP tool</span>
)<!----></pre></div><!----> <p>When <code>output_length_tokens</code> is absent (local testing, eval without a training loop) shaping is skipped entirely — no estimation is attempted, consistent with verifiers’ behaviour of returning <code>None</code> from <code>StateUsageTracker.snapshot()</code> when no usage was recorded.</p> <!--[1--><h2 class="relative group"><a id="verifier-metrics" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#verifier-metrics"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Verifier Metrics</span></h2><!--]--><!----> <p>Every <code>submit_proof</code> call emits verifier metrics in <code>metadata["verifier_metrics"]</code>, compatible with TrackIO and WandB:</p> <table><thead><tr><th>Metric</th><th>Description</th></tr></thead><tbody><tr><td><code>verifier/rollouts/success</code></td><td>1 if grading succeeded</td></tr><tr><td><code>verifier/rollouts/failure</code></td><td>1 if grading failed</td></tr><tr><td><code>verifier/failures/timeout</code></td><td>Count of timeout errors</td></tr><tr><td><code>verifier/failures/rate_limit</code></td><td>Count of rate-limit errors</td></tr><tr><td><code>verifier/failures/no_input</code></td><td>1 if proof was empty</td></tr><tr><td><code>verifier/failures/no_score_tag</code></td><td>1 if LLM response had no <code>&lt;score></code> tag</td></tr><tr><td><code>verifier/failures/all_attempts_failed</code></td><td>1 if all retries exhausted</td></tr><tr><td><code>verifier/failures/num_retries</code></td><td>Number of retries used</td></tr><tr><td><code>verifier/runtime/latency_per_request</code></td><td>Grading wall-clock time (seconds)</td></tr><tr><td><code>verifier/requests/count</code></td><td>Total verifier requests processed by the service</td></tr><tr><td><code>verifier/requests/latency_ms</code></td><td>Service-level average request latency</td></tr><tr><td><code>verifier/requests/timeout_count</code></td><td>Service-level timeout counter</td></tr><tr><td><code>verifier/requests/error_count</code></td><td>Service-level internal error counter</td></tr><tr><td><code>verifier/queue/depth</code></td><td>Current in-flight verifier queue depth</td></tr><tr><td><code>verifier/cache/hit_rate</code></td><td>Gold-answer cache hit rate</td></tr><tr><td><code>verifier/workers/restart_count</code></td><td>Worker-pool restart count</td></tr><tr><td><code>verifier/workers/worker_restarted</code></td><td>1 if current request required worker restart</td></tr><tr><td><code>verifier/workers/heartbeat_lag_ms</code></td><td>Time since last verifier activity</td></tr><tr><td><code>verifier/runtime/input_tokens</code></td><td>Grader input tokens (real provider usage when reported, else ~chars/4 estimate)</td></tr><tr><td><code>verifier/runtime/output_tokens</code></td><td>Grader output tokens (real provider usage when reported, else ~chars/4 estimate)</td></tr><tr><td><code>reward/base</code></td><td>Pre-shaping reward</td></tr><tr><td><code>reward/shaped</code></td><td>Post-shaping reward</td></tr><tr><td><code>reward/score_raw</code></td><td>Raw integer score (0–7)</td></tr><tr><td><code>reward/overlong_penalty</code></td><td>Length penalty applied</td></tr><tr><td><code>episode/attempt_number</code></td><td>Current attempt</td></tr><tr><td><code>episode/is_correct</code></td><td>1 if correct</td></tr><tr><td><code>episode/problem_type</code></td><td>proof / answer / multi_step</td></tr><tr><td><code>episode/dataset_source</code></td><td>Source dataset name</td></tr></tbody></table> <!--[2--><h3 class="relative group"><a id="trackio-integration" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#trackio-integration"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>TrackIO Integration</span></h3><!--]--><!----> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> trackio
run = trackio.init(project=<span class="hljs-string">&quot;qed-math-training&quot;</span>)
<span class="hljs-comment"># After each submit_proof call:</span>
verifier_metrics = result[<span class="hljs-string">&quot;metadata&quot;</span>][<span class="hljs-string">&quot;verifier_metrics&quot;</span>]
numeric = {k: v <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> verifier_metrics.items() <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(v, (<span class="hljs-built_in">int</span>, <span class="hljs-built_in">float</span>))}
run.log(numeric, step=global_step)<!----></pre></div><!----> <p>Or with TRL’s GRPOTrainer:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> trl <span class="hljs-keyword">import</span> GRPOConfig
config = GRPOConfig(
report_to=<span class="hljs-string">&quot;trackio&quot;</span>,
trackio_space_id=<span class="hljs-string">&quot;your-org/qed-math-grpo&quot;</span>,
<span class="hljs-comment"># ...</span>
)<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="deployment" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#deployment"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Deployment</span></h2><!--]--><!----> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!----><span class="hljs-comment"># Optional: run rollout/staging verifier validation first</span>
PYTHONPATH=src:envs uv run python scripts/qed_math_verifier_staging_validation.py \
--workers 4 --queue-size 128 --concurrency 64 --requests 2000 \
--max-timeout-rate 0.05 --max-error-rate 0.02
openenv push<!----></pre></div><!----> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/openenv/blob/main/docs/source/environments/qed_math.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]-->
<script>
{
__sveltekit_13d627l = {
base: "/docs/openenv/main/en",
assets: "/docs/openenv/main/en"
};
const element = document.currentScript.parentElement;
Promise.all([
import("/docs/openenv/main/en/_app/immutable/entry/start.CdJBJ6Jk.js"),
import("/docs/openenv/main/en/_app/immutable/entry/app.DMA_b4SN.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 28],
data: [null,null],
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
73.3 kB
·
Xet hash:
f0138825294b4d3a8fc1d35fdebf9914a7f44889ede17e8245299a9e70b5e19a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.