Логотип Cost Performance Scorer

Cost Performance Scorer

Спільнота
AnthonyAlcaraz
cost-performance-scorer

Score a multi-model routing policy on cost versus quality using the two metrics that actually decide selective intelligence: cost per successful completion (not cost per token) and a per-node quality parity threshold with domain-specific failure weights. Wraps a NodeInvocation log, computes cost-per-success and p95 latency per node, and evaluates a candidate model against a per-node evaluation set drawn from production data. Use to justify or recalibrate a routing decision AFTER you have run traffic. NOT for deciding routing a priori (that is model-routing-selector), NOT for generic benchmarks (MMLU/HumanEval do not capture your alert taxonomy), NOT for latency/KV budgeting (that is kv-cache-latency-budgeter).

Огляд

ВидавецьAnthonyAlcaraz
Репозиторійagentic-graph-rag-skills
Назва навичкиcost-performance-scorer
Зірки
29
Форки
9
Файли в пакеті
3
ЛіцензіяMIT
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Файлів у комплекті: 3

    Скрипти, шаблони й довідкові матеріали, які модель може читати під час роботи. Файли доступні лише для читання й ніколи не виконуються.

  • Відкритий вихідний код

    Видавець на GitHub: AnthonyAlcaraz. Перед установленням перегляньте вихідні файли навички.

Встановлення

Установіть навичку ШІ Cost Performance Scorer у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки на GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до розділу «Плагіни» → «Навички».
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/optimization/cost-performance-scorer
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Додати навичку → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills.git /tmp/agentic-graph-rag-skills
mkdir -p .claude/skills
cp -r /tmp/agentic-graph-rag-skills/skills/optimization/cost-performance-scorer .claude/skills/cost-performance-scorer
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Cost Performance Scorer в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Cost Performance Scorer, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для певного постачальника, тому навичка Cost Performance Scorer не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож поки навичка не потрібна, токени на її інструкції не витрачаються.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

Cost-Performance Scorer

Overview

Routing strategies are only as good as the data that informs them. Selective intelligence works only if you can measure it, and the book names two metrics that matter:

  • Cost per successful completion. Cost per task completed correctly, not cost per token. A cheap model that fails 40% of the time is not cheaper than an expensive model that succeeds on the first attempt — the wasted spend on failures is amortized over the successes.
  • Quality parity threshold. The minimum acceptable quality per node type. The AlertClassifier may need 0.99 (a wrong validation is worse than none); the QueryAnalyst may tolerate 0.90 because downstream nodes recover from misclassification.

The book's harness wraps every node and logs a NodeInvocation per call (Example 8-3). Success is judged per node — matching a human-labeled severity for the AlertClassifier, an SRE accepting the recommendation for PredictionSynthesis. Each candidate model is scored against a per-node evaluation set with domain failure weights (Example 8-4): a P1 alert misclassified as P3 is 10x worse than the reverse, an asymmetry a generic accuracy metric cannot express. Kakao's AI Shopping Mate is the worked anchor: restructuring GPT-4o-everywhere into a workflow graph of fine-tuned 27-32B models moved format adherence from 0.655 to 0.987 and accuracy from 0.578 to 0.890, with the smaller models preferred over GPT-4o in 63% of 2,100 turns.

When to Use

  • You have run production traffic through a routed pipeline and need to know which node is over- or under-provisioned.
  • You are choosing a specialist SLM and must evaluate it on your data, not MMLU.
  • A cheap node looks cheap per token but you suspect its failure rate erases the savings.
  • You need a per-node quality gate before promoting a routing change.

Phrases that should invoke this skill: "cost per successful completion", "is this model actually cheaper", "per-node evaluation set", "quality parity threshold", "score the routing policy", "weighted error rate".

When NOT to Use

  • Deciding routing before you run — that is model-routing-selector (Ch8). This skill measures what happened; that one decides what should happen.
  • Generic capability benchmarking — MMLU/HumanEval scores do not predict performance on your alert taxonomy (Ch8 Common Pitfalls: "benchmarking models on the wrong evaluation set").
  • Latency / KV-cache budgeting — that is kv-cache-latency-budgeter.
  • When you have no ground-truth success signal. Cost-per-success requires a per-node evaluator (gold labels or downstream acceptance). Without it, you can only report cost per call, which is the metric this skill exists to replace.

Process

StepInputActionOutputVerification
1Invocation log JSON_load_tracker(path)CostTracker of NodeInvocationsEach row has node_name, cost_usd, success
2Node nametracker.cost_per_success(node)$/successful completionFinite, > 0; higher than $/call by the failure ratio
3Node nametracker.node_report(node)success_rate + p95 latency + $/successsuccess_rate in [0,1]
4(gold, pred) pairs + eval setlib.evaluate_candidate(preds, set)accuracy + meets_threshold + weighted_error_rateweighted_error applies the domain failure weights
5Full trackerlib.score_policy(tracker)Pipeline total + blended $/successSums per-node; blended ≥ max single-node $/success/pipeline-len
6Two model profileslib.compare_cost_per_success(...)Which is cheaper per call vs per successCheaper-per-call and cheaper-per-success can disagree

Rationalizations

Agent rationalizationDocumented rebuttal
"This model is 10x cheaper per token, ship it."Cost per token is not cost per success. If it fails 40% of the time and each failure triggers a retry or a downstream error, the true cost per completed task can exceed the reliable model (Ch8). Measure cost-per-success.
"It scores 85% on MMLU, that's good enough."MMLU does not contain your alert-classification taxonomy. The book's pitfall is exactly this: build a per-node eval set from production data and re-evaluate when the task distribution shifts.
"Accuracy is 0.985, close enough to the 0.99 bar."For the AlertClassifier a missed P1 is catastrophic; the bar is 0.99 and 0.985 fails it. The weighted_error_rate exists to price that asymmetry (P1_as_P3 = 10x).
"One eval set for the whole pipeline is simpler."Nodes have different stakes: 0.99 for the AlertClassifier, 0.90 for the QueryAnalyst. A shared set over- or under-gates half the pipeline (Example 8-4).
"Smaller models always cost quality."Kakao's fine-tuned 27-32B models beat GPT-4o on their task (0.987 vs 0.655 format adherence) and were preferred in 63% of 2,100 turns. Specialization can improve quality because the training signal is focused.

Red Flags

  • Cost per success reported as cost per call. If success is not evaluated, the headline metric is missing; wire a per-node evaluator first.
  • A node's success_rate is 1.0 across thousands of calls. Either the evaluator is a no-op or the eval set is trivial — real production nodes fail.
  • weighted_error_rate equals the raw error rate. The failure weights are not being applied; check the <gold>_as_<pred> keys.
  • Blended $/success unchanged after a routing change. The change moved cost between nodes without improving completions; re-inspect per-node reports.
  • CLI --help exits non-zero. SKILL.md / CLI mismatch.

Non-Negotiable Verification

Before trusting a policy score:

  1. Run the benchmark battery.

    python cli.py benchmark

    Confirms cost-per-success is computed, the domain failure weights apply (P1_as_P3 = 10.0), the 0.99 threshold gate is honoured, and the cost-per-success inversion holds (cheaper-per-call ≠ cheaper-per-success).

  2. Score the sample policy and read the per-node table.

    python cli.py score

    Confirm the SLM nodes are far cheaper per success than the frontier synthesis node, and that a node with seeded failures shows success_rate < 1.0.

  3. Evaluate a candidate against a real per-node set.

    python cli.py evaluate AlertClassifier

    Confirm a single P1-as-P3 miss produces a weighted_error_rate of 10.0, not 1.0.

  4. Domain test in the notebook. Run notebooks/ch8-optimization.ipynb; confirm the cost-performance section reads moto-mocked CloudWatch cost and latency signals into the tracker and computes cost-per-success per node.

Security Posture

  • Read-only over the invocation log. lib.py makes no network calls and writes nothing; it consumes a log the caller supplies.
  • Cost figures are inputs, not authority. The log's cost_usd values come from the caller's pricing; verify them against live pricing before acting.
  • Untrusted logs. If the invocation log is machine-generated from an external system, validate the schema (numeric costs, boolean success) before scoring — a poisoned log could hide a failing node behind fabricated successes.

Composition

  • Closes the loop with model-routing-selector (Ch8): the cost-per-success numbers here recalibrate the cascade thresholds and per-node bars there.
  • Feeds the Ch7 self-evolution loop: cost-per-success and weighted-error are evaluation signals the diagnostic engine can act on.
  • Pairs with kv-cache-latency-budgeter (Ch8): this scores cost/quality; that scores latency/concurrency. Both gate a production routing change.

Source Attribution

Distilled from Agentic GraphRAG (O'Reilly, by Anthony Alcaraz and Sam Julien), Chapter 8 — Optimization, "Measuring Cost-Performance Tradeoffs". Key references:

  • Example 8-3 CostTracker / NodeInvocation (cost per successful completion)
  • Example 8-4 per-node evaluation sets with domain failure weights
  • Kakao AI Shopping Mate (0.655 -> 0.987 format adherence, 0.578 -> 0.890 accuracy, 63% preference over GPT-4o across 2,100 turns)

Файли в пакеті

Модель читає ці файли за потреби, поки навичку завантажено. Вони доступні для читання й ніколи не виконуються.

Поширені запитання

Що робить навичка ШІ Cost Performance Scorer?

Score a multi-model routing policy on cost versus quality using the two metrics that actually decide selective intelligence: cost per successful completion (not cost per token) and a per-node quality parity threshold with domain-specific failure weights. Wraps a NodeInvocation log, computes cost-per-success and p95 latency per node, and evaluates a candidate model against a per-node evaluation set drawn from production data. Use to justify or recalibrate a routing decision AFTER you have run traffic. NOT for deciding routing a priori (that is model-routing-selector), NOT for generic benchma...

Навіщо використовувати Cost Performance Scorer у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Cost Performance Scorer — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Cost Performance Scorer у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/optimization/cost-performance-scorer. TypingMind прочитає файл SKILL.md, додасть супровідні файли та встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Cost Performance Scorer?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Cost Performance Scorer?

Зі скількома забажаєте. У TypingMind ви можете використовувати Cost Performance Scorer із будь-якою моделлю, яка підтримує навички, зокрема з GPT, Claude, Gemini, Grok, DeepSeek, Mistral чи Llama. Для цього ви використовуєте власні ключі API.

Чи безкоштовна навичка ШІ Cost Performance Scorer?

Так. На GitHub цю навичку публікує AnthonyAlcaraz за ліцензією MIT. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це набір інструкцій для повторного використання, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти, які вона може викликати, — код, який десь виконується й повертає результат. Натомість навичка ШІ дає моделі знання й пояснює порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі
Логотип openclaw

Telegram E2e Userbot

openclaw
ОрганізаціяПопулярне

Перевіряйте поведінку OpenClaw Telegram, яку бачать користувачі, на Test Server Telegram із командними обліковими даними, отриманими через Convex; проходьте сценарії від імені реального користувача та фіксуйте повідомлення, редагування, видалення, реакції, індикатор набору тексту й розширений…

82.2K
391K
Файлів: 45
Відкрити
Логотип affaan-m

Module Regression

affaan-m
СпільнотаПопулярне

Govern cross-module regression in large repositories with a REGRESSION.md ledger that records each module's downstream consumers and executable acceptance command. After a change, run the changed…

41.4K
277.3K
Файлів: 2
Відкрити
Логотип affaan-m

Test Collaboration

affaan-m
СпільнотаПопулярне

Inventory and govern a project's test assets. Connect requirements, business rules, risks, bugs, and cross-boundary contracts to stable TEST-IDs and executable evidence in the repository's existing…

41.4K
277.3K
Файлів: 2
Відкрити
Логотип affaan-m

Competitive Report Structure

affaan-m
СпільнотаПопулярне

Use after benchmark-methodology has produced scored competitor profile cards. Assembles findings into a decision-grade report: landscape map, competitor profiles, benchmarking matrix, white-space…

40.4K
270.2K
Файлів: 1
Відкрити

Створіть власний робочий простір зі ШІ вже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇