Skip to main content
Glama

evaluate

Measure quantized model quality using perplexity scoring to assess performance after compression. Provides quality ratings and evaluation metadata for GGUF, GPTQ, or AWQ formats.

Instructions

Run perplexity evaluation on a quantized model.

Measures model quality after quantization using perplexity scoring. Lower perplexity = better quality. Includes a quality assessment (EXCELLENT/GOOD/FAIR/DEGRADED/POOR).

Args: model_path: Path to the quantized model file (GGUF) or directory (GPTQ/AWQ). format: Format of the quantized model. One of 'gguf', 'gptq', 'awq'. bits: Bit width used during quantization (for quality context).

Returns: Perplexity score, quality assessment, and evaluation metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_pathYes
formatNogguf
bitsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool registration for 'evaluate' in the MCP server.
    def evaluate(
        model_path: str,
        format: str = "gguf",
        bits: int = 4,
    ) -> dict[str, Any]:
        """Run perplexity evaluation on a quantized model.
    
        Measures model quality after quantization using perplexity scoring.
        Lower perplexity = better quality. Includes a quality assessment
        (EXCELLENT/GOOD/FAIR/DEGRADED/POOR).
    
        Args:
            model_path: Path to the quantized model file (GGUF) or directory
                        (GPTQ/AWQ).
            format: Format of the quantized model. One of 'gguf', 'gptq', 'awq'.
            bits: Bit width used during quantization (for quality context).
    
        Returns:
            Perplexity score, quality assessment, and evaluation metadata.
        """
        if not os.path.exists(model_path):
            return {
                "success": False,
                "error": f"Model path does not exist: {model_path}",
            }
    
        return evaluate_model(model_path, format.lower(), bits)
  • Core logic for evaluating model perplexity, delegating to evaluate_gguf or evaluate_transformers.
    def evaluate_model(
        model_path: str, fmt: str, bits: int
    ) -> dict[str, Any]:
        """Run perplexity evaluation on a quantized model.
    
        Args:
            model_path: Path to the quantized model file or directory.
            fmt: Format of the model ('gguf', 'gptq', or 'awq').
            bits: Bit width used for quantization.
    
        Returns:
            Result dict with perplexity score and quality assessment.
        """
        if fmt == "gguf":
            result = evaluate_gguf(model_path)
        elif fmt in ("gptq", "awq"):
            result = evaluate_transformers(model_path, fmt)
        else:
            return {
                "success": False,
                "error": f"Evaluation not supported for format '{fmt}'.",
            }
    
        # Add quality assessment if we got a perplexity score
        if result.get("success") and result.get("perplexity"):
            ppl = result["perplexity"]
            if ppl < 10:
                result["quality"] = "EXCELLENT"
                result["assessment"] = "Minimal quality loss from quantization."
            elif ppl < 20:
                result["quality"] = "GOOD"
                result["assessment"] = "Acceptable quality for most use cases."
            elif ppl < 50:
                result["quality"] = "FAIR"
                result["assessment"] = (
                    f"Some quality degradation at {bits}-bit. "
                    f"Consider using higher bits."
                )
            elif ppl < 100:
                result["quality"] = "DEGRADED"
                result["assessment"] = (
                    f"Significant quality loss at {bits}-bit. "
                    f"Recommend {min(bits + 1, 8)}-bit or higher."
                )
            else:
                result["quality"] = "POOR"
                result["assessment"] = (
                    "Severe quality loss. Model may produce incoherent output. "
                    "Use higher bit quantization."
                )
    
        result["format"] = fmt
        result["bits"] = bits
        return result
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the quality assessment categories (EXCELLENT/GOOD/FAIR/DEGRADED/POOR) and that it returns evaluation metadata, but does not explicitly state whether this is a read-only operation, if it modifies the model, or performance characteristics like evaluation duration.

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 well-structured with a clear summary sentence followed by explanatory context, then organized Args and Returns sections. Every sentence adds value—either explaining perplexity concepts or documenting parameters. It appropriately uses docstring formatting for clarity.

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?

Given the tool has 3 simple parameters (no nested objects) and an output schema exists, the description provides sufficient context. It summarizes the return values (perplexity score, quality assessment, metadata) without needing to replicate the full output schema, making it complete for the complexity level.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. The Args section successfully documents all three parameters: model_path specifies expected file types (GGUF) or directories (GPTQ/AWQ), format lists valid enum values ('gguf', 'gptq', 'awq'), and bits provides context ('for quality context'). This significantly aids agent invocation.

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

Purpose4/5

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

The description clearly states the tool runs 'perplexity evaluation on a quantized model' and measures 'model quality after quantization using perplexity scoring.' It specifies the verb (run/evaluate) and resource (quantized model/perplexity), though it does not explicitly differentiate from siblings like 'check' or 'quantize'.

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

Usage Guidelines3/5

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

The description implies usage context (use after quantization to measure quality) and explains perplexity interpretation ('Lower perplexity = better quality'), but lacks explicit guidance on when to use this versus 'check', 'recommend', or other siblings, and mentions no prerequisites or exclusions.

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/ShipItAndPray/mcp-turboquant'

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