Skip to main content
Glama

verify_optimization

Verify an optimized code candidate against the original: checks output equivalence and measures speedup, accepting only if both pass. Rejects incorrect or insufficiently faster code.

Instructions

PROVE an optimisation: same outputs, and measurably faster.

You write the optimised version. This runs both against the same inputs to confirm they still agree, then TIMES both at increasing sizes and compares. Accepted only if equivalent AND at least min_speedup faster.

A rejection tells you which gate failed and by how much — "correct but only 1.09x" is the answer an optimiser that fabricates wins cannot give. A candidate that is faster but wrong fails the first gate, and its speed is never measured, because a faster wrong answer is not an optimisation.

An accepted result is graded cross_checked (see grade_basis for the runtime and the measured speedup). A rejection — wrong OR merely not faster enough — is graded ungraded: correctness alone does not earn a grade for the optimisation claim this tool exists to answer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sizesNo
languageYes
originalYes
candidateYes
min_speedupNo
test_inputsNo
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full behavioral disclosure. It thoroughly explains the process: runs both versions against same inputs, times at increasing sizes, and reveals that a rejection indicates which gate failed and by how much. It also clarifies grading (cross_checked vs ungraded) and the semantic implication that correctness alone doesn't earn a grade for the optimization claim.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is moderately lengthy but each sentence contributes: it states the purpose, explains the process, defines acceptance, and describes outcomes. It is well-structured and front-loaded with the core purpose, avoiding redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is quite complete for a complex tool with no annotations or output schema. It explains the process, acceptance gates, rejection feedback, and grading outcomes. It references 'grade_basis' without detailing it, but overall it provides sufficient context for an agent to understand the tool's function and likely outcomes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate. It explicitly mentions min_speedup (with default) and implies test_inputs and sizes ('same inputs', 'increasing sizes'), but does not define original, candidate, or language beyond context. The parameters are self-explanatory from the tool's purpose, but the description doesn't add detail for all six parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'PROVE an optimisation: same outputs, and measurably faster.' It specifies the acceptance criteria (equivalent AND at least min_speedup faster) and distinguishes it from sibling tools like benchmark or compare_execution by tying correctness and performance verification together.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use the tool ('You write the optimised version') and details the rejection criteria, including that speed is never measured if correctness fails. It does not explicitly name alternatives, but the context implies this is for proving optimizations rather than general benchmarking or comparison.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/The-40-Thieves/codecalc'

If you have feedback or need assistance with the MCP directory API, please join our Discord server