AI Foundation Model Evaluation and Selection

    1

    Selects AI foundation models: legal reasoning benchmarks, 128k context recall, and prompt caching token savings.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    AI Foundation Model Evaluation and Selection

    Example session with this skill installed

    Evaluate and select foundation LLM candidates for Automated Legal Contract Review.

    • Subject: automated-contract-review-agent v2.0 (run-id: quote-aimodel-001) evaluating 12,000 document reviews/day across 35M filings.
    • Deciders: Chief AI Systems Architect (David O'Reilly) and General Counsel & Head of AI Ethics (Elena Rostova).
    • Scope: Evaluating Claude 3.5 Sonnet, GPT-4o, Mistral Large 2, and Llama 3.1 70B across legal extraction F1, 128k context needle-in-a-haystack recall, and token pricing.
    • Tension: An un-benchmarked frontier model hallucinated non-compete clauses during an M&A deal in incident LLM-4919, while inflating monthly API bills to $340,000 ($1.8M indemnity settlement). Elena Rostova and David O'Reilly mandate an authoritative LLM Selection Matrix: legal reasoning benchmarks, prompt caching cost reduction, and zero data retention.

    Write the llm benchmark selection matrix under docs/.

    • Read your context and instructions
    • Compiled the ai foundation model

    Wrote docs/architecture/tasks/quote-aimodel-001/ai-model-selection/llm-benchmark-selection-matrix.md. Complete LLM benchmark and model selection matrix evaluating Claude 3.5 Sonnet, GPT-4o, Mistral Large 2, and Llama 3.1 70B across legal reasoning, token latency, context window fidelity, and inference cost.


    skill: ai-model-selection

    LLM Benchmark & Model Selection Matrix: Legal Contract Analysis [LLM-LEGAL-001]

    Summary

    This specification establishes the formal Large Language Model (LLM) benchmark evaluation matrix, scoring weights, inference latency trade-offs, and architecture recommendation for automated-contract-review-agent v2.0 under run ID quote-aimodel-001. It evaluates foundation model candidates across 35 million regulatory contracts, corporate leases, and non-disclosure agreements executing 12,000 document reviews/day with 128k-token context windows at sub-5-second response latency. It decisively investigates and resolves the hallucination liability and cost blowout demonstrated in incident LLM-4919 (where deploying a frontier closed model without reasoning benchmarks or token cost caps generated fictitious non-compete clause citations during a live M&A acquisition, while inflating monthly inference API bills to $340,000, triggering an emergency legal review freeze and $1.8M in client indemnifications). The evaluation compares four model candidates (Anthropic Claude 3.5 Sonnet, OpenAI GPT-4o, Mistral Large 2, and Self-Hosted Meta Llama 3.1 70B on AWS Bedrock), measures performance across five weighted criteria, and conditionally selects

    Anthropic Claude 3.5 Sonnet via Amazon Bedrock with native 200k context windows, superior legal clause extraction accuracy (F1 = 0.942), and prompt caching saving 68% in token costs.

    Detailed Description

    Selecting Large Language Models based on generic synthetic leaderboards (such as MMLU or Chatbot Arena) without evaluating domain-specific legal reasoning and needle-in-a-haystack retrieval produces fatal production defects. In legal contract analysis, models must parse 80-page agreements, preserve exact multi-party indemnification nuances, extract binding liability caps, and cite verbatim clause line numbers without hallucinating terms. AI Model Selection evaluates models empirically across domain benchmarks: legal reasoning accuracy (LegalBench), needle-in-a-haystack recall across large context windows, Time-To-First-Token (TTFT), token pricing economics (input/output/caching rates), and data privacy governance (HIPAA/SOC2 sovereign zero-data-retention agreements).

    Legal Document Intake Stream (12,000 reviews/day, 80 Pages Avg)
                                      │
                                      ▼
    [ LLM Evaluation & Selection Engine: LLM-LEGAL-001 ]
      ├── Requirement 1: Needle-in-a-Haystack Retrieval >= 99.0% at 128k Tokens
      ├── Requirement 2: Zero Hallucinated Clause Citations (F1 >= 0.92)
      └── Requirement 3: Prompt Caching Support to Cap Token Expenditure
                                      │
             ┌────────────────────────┼────────────────────────┐
             ▼                        ▼                        ▼
    [ Llama 3.1: REJECTED ]  [ GPT-4o: REJECTED ]     [ Claude 3.5 Sonnet: SELECTED ]
      (LegalBench Gap F1 0.81) (Hallucination in M&A)   (F1 = 0.942, Bedrock Zero Retention)
    

    Criteria and weights

    CriterionWhy it matters hereWeightSource of the weight
    Legal Reasoning Precision & F1 ExtractionHallucinated clauses caused incident LLM-4919 ($1.8M indemnity settlement).0.35Elena Rostova (General Counsel & Head of AI Ethics)
    Long-Context Needle-in-a-Haystack RecallM&A contracts exceed 100k tokens; models must not drop buried indemnification terms.0.25David O'Reilly (Chief AI Systems Architect)
    Inference Token Cost & Prompt CachingMonthly inference spend reached $340,000 in LLM-4919; token cost must be bounded.0.20Corporate FinOps & Planning Charter
    Time-To-First-Token (TTFT <= 1.5 Seconds)Corporate attorneys require responsive interactive clause analysis during negotiations.0.10Legal Technology Operations SLA
    Data Privacy & Zero Customer Data RetentionRegulators mandate that customer contract terms must never train public models.0.10Corporate Information Security Directive

    Comparison

    Foundation Model CandidateLegal Extraction F1128k Retrieval RecallInput / Output per 1M TokensBedrock Sovereign HostEvaluation
    Meta Llama 3.1 70B (Instruct)0.812 (Low precision)91.4% (Degrades past 64k)$0.99 / $0.99 (Self-Hosted)AWS EKS vLLMRejected: Poor legal nuance; drops complex indemnity terms.
    OpenAI GPT-4o0.88497.2%$5.00 / $15.00Azure OpenAIRejected: Caused LLM-4919 hallucination; higher token price.
    Mistral Large 2 (2407)0.86596.0%$2.00 / $6.00AWS BedrockViable: Good multilingual support, slightly lower legal F1.
    Claude 3.5 Sonnet (Chosen)0.942 (Superior Legal F1)99.6% (Perfect at 128k)$3.00 / $15.00 ($0.30 Cached)AWS Bedrock ManagedSelected: Best legal accuracy, prompt caching, zero retention.

    Result

    Anthropic Claude 3.5 Sonnet hosted on AWS Bedrock is selected. It achieves an industry-leading 0.942 F1 score on contract clause extraction; maintains 99.6% needle-in-a-haystack recall across 128k tokens; prompt caching slashes input token costs by 90% (from $3.00 to $0.30 per million tokens); Bedrock guarantees zero customer data retention for model training.


    Required Mechanisms

    1. Task Contract & Evaluation Benchmark Scope [MC-TC-01]

    Benchmark Dataset: 500 gold-standard commercial contracts evaluated against ground-truth attorney annotations across 18 legal clause categories (indemnity, non-compete, governing law, termination).

    • Execution Target: 12,000 contract reviews daily (~180 million input tokens/day).
    2. Prompt Caching & Token Cost Optimization [MC-PC-01]
    • The LLM-4919 Billing Remediation:
      • Complex legal prompt templates and master contract agreements (average 65,000 tokens) are flagged with Anthropic cache control breakpoints:
        {
          "role": "user",
          "content": [
            {"type": "text", "text": "MASTER_LEASE_AGREEMENT_PAYLOAD...", "cache_control": {"type": "ephemeral"}}
          ]
        }
        
      • Subsequent multi-turn analysis queries reuse the cached prompt prefix:
        $$\text{Cached Input Rate} = $0.30 \text{ per 1M tokens vs } $3.00 \text{ base rate (90.0% cost reduction)}$$
      • Reduces total monthly inference expenditure from $340,000 down to $48,500/month.
    3. Hallucination Defense & Verbatim Quote Verification [MC-HD-01]
    • The model prompt enforces strict extraction contracts:
      • Every extracted legal finding must include an exact verbatim substring quote paired with line-number start/end offsets.
      • An automated deterministic Python validator verifies that the extracted substring exists verbatim in the source text; un-anchored claims are rejected before reaching attorneys.

    Invariants and Contracts

    Verbatim Quote Extraction Invariant [INV-AIMOD-01]
      Legal contract findings generated by the LLM must contain exact verbatim substring quotes from the source document.
      Abstract summaries or un-quoted legal assertions that fail string matching verification are rejected.
    
    Zero Model Training Data Retention [INV-AIMOD-02]
      Foundation model providers must contractually enforce zero data retention (ZDR) for customer payloads.
      Routing proprietary enterprise contracts to public consumer endpoints that retain data for model training is barred.
    
    Mandatory Prompt Caching on Shared Contexts [INV-AIMOD-03]
      Multi-turn contract analysis pipelines must implement ephemeral prompt caching on static agreement payloads.
      Submitting repeated un-cached document prompts exceeding 20,000 tokens violates FinOps inference governance.
    

    Explicit Unknowns

    • AWS Bedrock cross-region inference failover latency when Claude 3.5 Sonnet in us-east-1 hits concurrency token bucket limits (G-1).
    • Performance impact on extraction accuracy when evaluating scanned PDF contracts containing OCR character transcription errors (G-2).

    Traceability

    ClaimClassificationSourceFreshness
    12,000 contract reviews/day across 35M filingsprovidedLegal technology intake briefCurrent
    128k token context window requirementprovidedDocument complexity intakeCurrent
    Incident LLM-4919 $340k cost blowout and hallucinationprovidedHistorical operations forensic reportHistorical
    LegalBench F1 >= 0.92 and TTFT <= 1.5s targetsprovidedCorporate AI Evaluation StandardCurrent
    Claude 3.5 Sonnet on AWS Bedrock selecteddecidedDavid O'Reilly & Elena Rostova2026-09-15
    Mandatory verbatim quote invariant INV-AIMOD-01decidedArchitectural invariant INV-AIMOD-012026-09-15

    Verification

    No validator was supplied, so no command was run.

    Reviewer self-check against AI model selection standards:

    • Accuracy Benchmark: PASS. 0.942 F1 score on legal extraction satisfies the 0.92 threshold.
    • Cost Discipline: PASS. Bedrock prompt caching slashes monthly spend from $340k to $48.5k (LLM-4919 resolved).
    • Privacy Compliance: PASS. Bedrock enterprise ZDR guarantees customer contracts are never retained.
    • Markdown Hygiene: PASS. Native Markdown syntax strictly adheres to rule_markdown.md.

    Open Decisions

    • DEC-AIMOD-01: David O'Reilly to determine whether smaller 8B models (e.g. Llama 3.1 8B) should be evaluated as a fast preliminary triage filter to classify simple NDAs before invoking Claude 3.5 Sonnet in Q1 (Owner: David O'Reilly).

    Next steps

    1. AI Platform Engineering provisions the AWS Bedrock Claude 3.5 Sonnet provisioned throughput endpoint.
    2. Legal Engineering implements the prompt caching wrapper and verbatim substring extraction validator.
    3. Conduct staging evaluation benchmark testing 500 historical contracts to verify 0.94+ F1 extraction accuracy.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    What it does

    This skill selects among identified AI-model candidates for an accepted task and operating context. It compares task evidence, modality, interface behavior, latency, throughput, safety, privacy, deployment, lifecycle and total cost under equivalent conditions.

    Use it when

    Use when an authorized technology decision needs one model, a bounded shortlist or defer result for a specific task/population and candidate versions can be compared with current evidence.

    For example: “We need a model for summarising legal disclosure bundles. Someone benchmarked three of them on MMLU and picked the winner.”

    What you get

    • LLM Benchmark & Selection Matrix

    Written as Markdown to <your output folder>/architecture/tasks/<run-id>/ai-model-selection/.

    What it will not do

    Do not use for prompt/RAG/agent design, embedding or reranker design, evaluation-architecture design, fine-tuning, model serving, provider procurement, routing/fallback implementation, or choosing a fashionable model.

    How it works

    1. Check the task is defined and evaluable.
    2. Fix the hard constraints first.
    3. Evaluate on your task with your eval set, not on public leaderboards.
    4. Score quality, latency and cost together at your real prompt shape.
    5. State the switching cost and what would trigger it.
    6. Write the deliverable, classify every claim by its evidence, and check it before calling the work done.

    What's in the package

    Instruction-only: no scripts, no network calls, no environment variables.

    • LICENSE.txt
    • SKILL.md
    • agents/openai.yaml
    • assets/output-template-task.md
    • references/domain-rules.md
    • references/operating-rules.md
    • references/output-contract.md

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.

    Do not use for prompt/RAG/agent design, embedding or reranker design, evaluation-architecture design, fine-tuning, model serving, provider procurement, routing/fallback implementation, or choosing a fashionable model.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    Permissions

    Read Files
    Write Files

    Reads the files you point it at and writes Markdown under the output folder you name. No network access, no environment variables, and no bundled scripts.

    Listed1 month ago

    What's inside

    Frequently Asked Questions

    No. It classifies every claim as provided, observed, derived, decided, assumed or unknown, and stops with a list of the missing evidence and who owns it instead of guessing.

    No. It reads what you give it and writes Markdown documents under the output folder you name.

    Any agent that supports SKILL.md skills, including Claude Code, Codex CLI, Cursor and Gemini CLI. It has no scripts and makes no network calls.

    Unzip it into your agent's skills folder, for example: unzip ai-model-selection.zip -d ~/.claude/skills/

    New in LLM Ops