Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- xAI (Grok) provider: OpenAI-compatible client at `https://api.x.ai/v1/chat/completions`, default model `grok-4`, `skill-bench init --xai`, env `SKILL_BENCH_XAI_API_KEY` or `XAI_API_KEY`.
- Amazon Bedrock provider: Runtime OpenAI-compatible Chat Completions with a Bedrock API key (`AWS_BEARER_TOKEN_BEDROCK` or `SKILL_BENCH_BEDROCK_API_KEY`), default region `us-east-1`, default model `amazon.nova-lite-v1:0`. IAM SigV4 is not included.
- Judge golden trace fixture (`test/fixtures/judge_traces/canonical.json`) and `Judge::Variance` (sample mean/stddev/spread over repeated totals). Verdict math unchanged.
- Record inter-run judge totals from `.skill-bench-trends.json`: trend output includes `JUDGE n/mean/σ/spread` when the same eval+skill has two or more context totals.

### Documentation
- Align user docs with shipped 1.3.1: OpenRouter and mock in the provider list, Azure env var `SKILL_BENCH_AZURE_OPENAI_API_KEY`, Mistral key via `skill-bench.json` (no env mapping).
Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ Shipped: `Clients::Providers::Bedrock` (Runtime OpenAI-compatible path + Bedrock

## 4. Judge reliability

In progress. Golden parser fixture: `test/fixtures/judge_traces/canonical.json`. Sample variance: `Judge::Variance`. Remaining: record inter-run totals from live evals (no verdict-math change).
Shipped: golden parser fixture `test/fixtures/judge_traces/canonical.json`, `Judge::Variance`, and inter-run stats on the existing trend history (same eval+skill). Verdict math unchanged. IAM SigV4 for Bedrock is still deferred (item 3).
18 changes: 17 additions & 1 deletion lib/skill_bench/services/delta_table_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,23 @@ def self.format(report, result = nil)
context_icon = trend_icon(trend[:context_trend])
baseline_delta = trend[:baseline_delta]
context_delta = trend[:context_delta]
" TREND: baseline #{baseline_icon} (#{delta_str(baseline_delta)}), context #{context_icon} (#{delta_str(context_delta)})"
lines = [
" TREND: baseline #{baseline_icon} (#{delta_str(baseline_delta)}), context #{context_icon} (#{delta_str(context_delta)})"
]
lines << format_judge_variance(trend[:judge_variance])
lines.compact.join("\n")
end

private_class_method def self.format_judge_variance(stats)
return nil unless stats.is_a?(Hash) && stats[:n].to_i >= 2

Kernel.format(
' JUDGE n=%<n>d mean=%<mean>.1f σ=%<stddev>.1f spread=%<spread>.1f',
n: stats[:n],
mean: stats[:mean],
stddev: stats[:stddev],
spread: stats[:spread]
)
end
end
end
Expand Down
11 changes: 10 additions & 1 deletion lib/skill_bench/trend_tracker/trend_calculator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require_relative '../judge/variance'

module SkillBench
class TrendTracker
# Calculates performance trends between evaluation results
Expand All @@ -25,7 +27,8 @@ def self.compute_trend(entries, current_entry)
context_trend: trend_direction(current_context, previous_context),
baseline_delta: current_baseline - previous_baseline,
context_delta: current_context - previous_context,
previous_run: previous[:timestamp]
previous_run: previous[:timestamp],
judge_variance: judge_variance(matching, current_context)
}
end

Expand Down Expand Up @@ -54,6 +57,12 @@ def trend_direction(current, previous)

current > previous ? :improved : :regressed
end

def judge_variance(matching, current_context)
totals = matching.filter_map { |entry| entry[:context_total] } + [current_context]
result = SkillBench::Judge::Variance.call(totals: totals)
result[:success] ? result[:response] : nil
end
end
end
end
Expand Down
16 changes: 16 additions & 0 deletions test/services/delta_table_formatter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ def test_format_includes_trend_when_present
assert_includes output, 'TREND: baseline ↑ (+5), context ↓ (-3)'
end

def test_format_includes_judge_variance_when_present
report = build_delta_report(verdict: true)
result = {
trend: {
baseline_trend: :unchanged,
context_trend: :unchanged,
baseline_delta: 0,
context_delta: 0,
judge_variance: { n: 3, mean: 83.0, stddev: 3.0, spread: 6.0 }
}
}
output = DeltaTableFormatter.format(report, result)

assert_includes output, 'JUDGE n=3 mean=83.0 σ=3.0 spread=6.0'
end

def test_format_omits_trend_when_absent
report = build_delta_report(verdict: true)
output = DeltaTableFormatter.format(report)
Expand Down
12 changes: 12 additions & 0 deletions test/trend_tracker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ def test_only_compares_runs_for_same_eval_and_skill
assert_equal 10, trend[:context_delta]
end

def test_includes_judge_variance_from_matching_history_plus_current
tracker = TrendTracker.new(history_file: @history_file)
tracker.record(build_result(context_total: 80))

trend = tracker.trend_for(build_result(context_total: 86))
stats = trend[:judge_variance]

assert_equal 2, stats[:n]
assert_in_delta 83.0, stats[:mean]
assert_in_delta 6.0, stats[:spread]
end

def test_returns_no_trend_when_no_matching_eval_or_skill
tracker = TrendTracker.new(history_file: @history_file)
tracker.record(build_result(eval_name: 'eval-a', skill_names: ['skill-a'], context_total: 80))
Expand Down
Loading