Manuscript Offprint
arXiv:2610.22511AuditKIT: A Unified Evaluation Spine for Benchmarking, Judging, and Comparing Large Language Models and Agentic Systems
Q AuditKIT
Zera Lyngkhoi, Hem Gosalia, Ram Mohan Rao Kadiyala,
Vinay Kumar Sankarapu, Pratinav Seth
Lexsi Labs
Abstract
Evaluating language models and agents requires combining benchmark accuracy, judge-based assessment, runtime performance, tool-use behavior, and retrieval quality. Differences in interfaces, metric semantics, and trace formats complicate these comparisons and can hide failures in agentic workflows. We present AuditKIT, a source-available evaluation library that records these measurements in one result representation, with direction-aware metric contracts, configuration fingerprints, and extensible metrics and backends. For agents, it provides turn-aware tool-call matching, separates parallel from sequential execution, and distinguishes verified task outcomes from trajectory-level diagnostics. Missing or unobservable evidence is marked unscored rather than counted as failure. For retrieval-augmented generation, it combines ranked retrieval metrics, judged grounding, and deterministic evidence checks. Seven case studies spanning model comparison, serving runtimes, retrieval, tool calling, and interoperability show how answer extraction, runtime behavior, and metric selection change evaluation outcomes.
Keywords: LLM Evaluation, Agent Evaluation, Tool Use, Retrieval-Augmented Generation, LLM-as-Judge, Model Comparison, Reproducibility
Lexsi.ai
1 Introduction
Evaluating a language model involves more than a score on one benchmark. Different applications call for task accuracy, generation quality, runtime efficiency, or safety, and each uses its own measurements. Agents add further requirements [48, 38, 20]. Their behavior depends on tool selection, argument correctness, execution order, retrieved contexts, and changes to the external environment, not only on generated text. A model can write a plausible final answer while the underlying task fails, and an agent can reach the correct outcome by a path that differs from a predefined reference.
Existing frameworks address many of these needs, but their interfaces, metric definitions, and result formats differ. lm-evaluation-harness [13] and HELM [22] standardize benchmark evaluation; LangSmith [18], DeepEval [7], and Braintrust [3] support application-level evaluation and experiment workflows; Promptfoo [33] and PyRIT [26]
Equal contribution
Work done while at Lexsi Labs.
support red teaming. Combining their outputs requires attention to how each metric is computed, what evidence is available, and whether results from different configurations are comparable.
Several practical problems follow. Metrics differ in optimization direction, so a higher value is better for some and worse for others. Several tools store direction for some metrics (Table 1), but among the tools reviewed (versions in Section 2.3) we found none that declares it in the metric definition and applies it in every model comparison, which matters once accuracy, latency, error rate, and cost are ranked together. Tool calls scored apart from the turns that issued them hide the difference between sequential and parallel execution. A judge’s “looks complete” can stand in for task completion when the final state is missing or contradicts it. Trace fields the recorder never captured can be read as empty, which turns missing evidence into a measured zero.
We present AuditKIT, a source-available evaluation library for language models and agents. It provides one interface for benchmark evaluation, model-based judging, performance measurement, tool-use assessment, and retrieval-augmented generation, and it marks unavailable evidence as unscored so that measurements that could not be made are not counted as failures. The contributions below list the components.
The paper describes the architecture, metric interfaces, agent evaluation methodology, and interoperability with external artifacts. Seven case studies show how answer extraction, serving behavior, retrieval metrics, and trace structure change the interpretation of evaluation results. They do not establish model rankings; they show the distinctions AuditKIT is designed to preserve.
Contributions
• Evaluation interface. evaluate() turns a dataset, adapter, model, optional annotator, and metrics into one RunResult, consumed by compare_models() for pairwise and N-model comparison (Section 4).
• Direction-aware comparison and provenance. Every metric declares MAXIMIZE or MINIMIZE, enforced at class definition and used by every comparison (Section 3); a SHA-256 fingerprint over model, data, adapter, metrics, and settings serves as cache key and comparison key.
• Extensible metrics and backends. Built-in and custom metrics and model backends share one evaluation contract (Section 6).
• Agent and RAG evaluation. Turn-aware tool-call metrics with bipartite matching, parallel-call scoring, multi-route references, an episode layer with verified outcomes and trial reliability, ranked retrieval, judged grounding, and deterministic RAG evidence checks (Section 7).
• Interoperability. Read-only importers for AgentTune [28], AlignTune [27], SafeTune [40], CuratorKIT [2], and CircuitKIT [39]; zero required dependencies in the core.
2 Background and Related Work
2.1 Evaluation frameworks
Benchmark harnesses such as lm-eval-harness [13], HELM [22], and OpenAI Evals [29] give standardized task coverage. LLM-as-judge evaluation is served by code-first libraries (DeepEval [7], RAGAS [9], TruLens [42], Inspect [43]) and hosted platforms (LangSmith [18], Braintrust [3], Arize Phoenix [1], W&B Weave [45], MLflow [49]). Red-teaming suites such as Promptfoo [33], PyRIT [26], DeepTeam [8], and Giskard [14] probe for vulnerabilities. Performance is usually measured by separate instrumentation. Existing frameworks cover substantial parts of this workflow but differ in how they represent metrics, traces, execution configurations, and comparison results. AuditKIT addresses red teaming only at a basic level (Section 9).
2.2 Agent and retrieval evaluation
Tool-use evaluation is mostly benchmark-specific. BFCL [31] checks calls against accepted-value lists, including parallel and irrelevance categories; API-Bank [21] and ToolLLM [34] evaluate API selection over large inventories; AgentBench [24] covers interactive environments; and -bench [47] compares the final database state to a goal state and introduces the pass reliability measure. Libraries add evaluators on top: DeepEval, Inspect, LangChain's agentevals [19], and Promptfoo's trajectory assertions for agents; RAGAS, TruLens, ARES [37], and RAGBench [12] for RAG, mostly through judged faithfulness and context metrics; ARES and RAGBench propose judges and study judge-human agreement, documenting cases where judged scores diverge from human labels.
Table 1 Feature coverage of AuditKIT and selected evaluation tools.
| Capability | AuditKIT | Im-eval | HELM | LangSmith | DeepEval | Braintree | OAI Evals | Inspect | Phoenix | Promptfoo | PyRIT |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Evaluation pipeline | |||||||||||
| Academic benchmarks | ✓ | ✓ (rich) | ✓ (rich) | ✕ | ~ | ✕ | ✓ (reg.) | ✓ (200+) | ✕ | ~ | ~ (safety) |
| LLM-as-judge | ✓ | ✕ | ✕ | ✓ | ✓ | ✓ | ✓ (m-graded) | ✓ | ✓ | ✓ | ✓ |
| Judge over logged data | ✓ | ✕ | ✕ | ✓ | ~ | ✓ | ~ | ~ | ✓ | ~ | ~ |
| Performance profiling | ✓ | ✕ | ✓ | ✓ (traces) | ✕ | ✓ (traces) | ✕ | ~ | ~ (traces) | ~ (assert.) | ✕ |
| Common API (bench+judge+perf) | ✓ | ✕ | ✕ | ✕ | ~ | ~ | ~ | ~ | ~ | ~ | ✕ |
| Direction-aware comparison | ✓ | ~ | ~ | ~ | ~ | ~ | ✕ | ✕ | ✕ | ✕ | ✕ |
| Provenance / fingerprint | ✓ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ~ | ✕ | ~ | ✕ |
| Zero required deps (core) | ✓ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ |
| Standalone, non-SaaS | ✓ | ✓ | ✓ | ✕ (SaaS) | ✓ | ✕ (SaaS) | ~ | ✓ | ~ (platform) | ✓ | ✓ |
| Agents, RAG, and red teaming | |||||||||||
| Tool-call / trajectory metrics | ✓ | ✕ | ✕ | ✓ | ✓ | ~ | ✕ | ✓ | ~ | ✓ | ✕ |
| Turn-aware parallel-call scoring | ✓ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ |
| Verified (state-based) outcome | ✓ | ✕ | ✕ | ~ | ~ | ~ | ✕ | ✓ | ✕ | ~ | ✕ |
| RAG retrieval + grounding metrics | ✓ | ✕ | ✕ | ✓ | ✓ | ✓ | ✕ | ~ | ✓ | ✓ | ✕ |
| Red teaming / adversarial probing | ~ | ✕ | ~ | ✕ | ~ | ✕ | ✕ | ~ | ✕ | ✓ | ✓ |
Reviewing the scoring code of RAGAS, DeepEval, TruLens, Phoenix, BFCL, agentevals, Inspect, and -bench, we found three recurring choices that AuditKIT departs from: calls are paired greedily (BFCL, agentevals, DeepEval) or sorted and compared as sets (RAGAS), where AuditKIT uses a maximum bipartite matching [16]; calls are flattened across turns, and none separates serialized from batched calls with the same call-level score (BFCL's parallel categories test parallel calling, but as an all-or-nothing set); and RAG average precision often divides by the relevant items retrieved, hiding misses. Benchmarks are complementary: BFCL loads directly as an AuditKIT dataset, and -bench's state-based success and pass are the model for AuditKIT's oracles and reliability report. The structural scores diagnose adherence to a reference execution structure; they do not independently establish task success.
2.3 AuditKIT in relation to existing frameworks
Table 1 compares AuditKIT with ten tools across benchmarks, judging, performance, comparison semantics, provenance, deployment, agents, RAG, and red teaming. Versions checked: lm-evaluation-harness v0.4.12, HELM (crfm-helm) v0.5.16, DeepEval v4.2.0, Inspect AI v0.3.260, Arize Phoenix v17.2.0, and Promptfoo v0.122.0 on 2026-08-27, and PyRIT v1.1.0 on 2026-10-06; LangSmith and Braintree are hosted platforms without public versions, and OpenAI Evals is an unversioned reference repository. We checked direction-awareness and provenance against public documentation; other feature entries summarize public product descriptions and are intended as positioning. A mark means we did not find the capability in that version's documentation, not that it cannot be built from other features.
Several marks in Table 1 need qualification. lm-eval-harness stores per-metric higher_is_better metadata, but we found no N-model leaderboard API that uses it for winner selection. HELM's Mean Win Rate is direction-correct but a fixed aggregate, not a per-metric contract for custom metrics. LangSmith lets users mark a feedback key higher-is-better in experiment comparison, outside a metric-definition contract. DeepEval supports higher- and lower-is-better metrics, but not as a general contract for cross-model ranking. Braintree compares latency, cost, errors, and load with fixed semantics, not for arbitrary custom scorers. We found no direction-aware N-model winner selection in OpenAI Evals, and Inspect has structured, reproducible logs but no metric-direction contract tied to winner selection. Phoenix evaluates traced data but has no direction-aware winner selection or run fingerprint. Promptfoo compares providers and caches individual responses, but its latency and cost assertions are thresholds, not direction-aware winner selection; its tool-call-f1 compares tool names, and its trajectory:* assertions check tools used, arguments, order, and an LLM-judged goal. PyRIT [26] scores attack success (true/false or float scales) and stores every prompt and score in a SQL memory, but has no cross-model winner selection or run-level fingerprint.
Beyond the table, AuditKIT treats a deployed agent as another backend and a recorded trajectory as another precomputed sample, so an agent and its base model go through the same pipeline. Against red-teaming tools such as Promptfoo and PyRIT, AuditKIT is narrower: its probes are basic, and it targets measurement and comparison, not attack generation.
3 Design Principles
Interface design. Adapter, Model, Annotator, and Metric each expose a minimal interface; custom components use the same mechanism as built-ins. A plain list[str] → list[str] callable is a valid model. SCENARIOS, ADAPTERS, METRICS, and ANNOTATORS accept a subclass plus one decorator. Model backends are dispatched by a prefix table in AutoModel.resolve(). The core declares dependencies = []; optional extras add backends and heavy metrics, imported lazily. The agent layer, agent: backend, tool-call parser, retrieval and deterministic RAG metrics, and all Lexsi importers are stdlib-only.
Score semantics. Every Metric subclass must declare MAXIMIZE or MINIMIZE; omitting it raises TypeError at class definition (Metric.init_subclass). Grading, diffing, and leaderboards share that declaration, so lower latency is ranked as better. This picks the right winner per metric. It does not make two runs comparable, which also needs matching data, prompts, judge and decoding settings, and metric versions, and trading off heterogeneous metrics remains a separate problem. A SHA-256 hash covers model identity (including the resolved checkpoint), data, adapter and annotator configuration, metrics, and run settings; a matching fingerprint lets the runner skip re-execution. Closures are hashed by their immutable captured values, agent and RAG fields enter only when set, and an agent: run records the resolved endpoint and digests request headers. The fingerprint identifies a configuration: identical fingerprints are necessary but not sufficient for identical results. It is a configuration identifier, not a reproducibility certificate.
Evidence handling. A metric with nothing to measure returns no score; an unparseable judge verdict is an error, not a zero; unknown and not_tested results are excluded from means and counted in RunResult.unscored. Imported agent episodes carry per-field coverage, an ineligible metric names the missing field, and an oracle with no state to check returns unknown, not failure. Tool schemas sent to a backend without Capability.TOOLS, or images sent to a text-only model, raise instead of being dropped. When a remote server may have ignored a request field (chat_template_kwargs, parallel_tool_calls), the run records it, prints it, and caps the affected scores.
4 System Architecture
AuditKIT is organized around an evaluation pipeline (Figure 1), a comparison layer that consumes its output, and an agent episode layer on top (Figure 2, Section 7). Alongside each prediction, the pipeline carries a structured trace (tool-call turns, messages, retrieved contexts) from backend to metrics through context ["trace"]; for text-only evaluation it is empty.
4.1 Evaluation pipeline
Dataset → Samples. Built-in scenarios (mmlu, gsm8k, arc, hellaswag, truthfulqa, humaneval), in-memory samples, CSV, JSONL, Hugging Face datasets or local folders (ak.load_dataset(), including CuratorKIT exports), Croissant, AgentTune files (ak.load_agenttune()), and BFCL (ak.load_bfcl()) all become Sample objects: input, optional target, choices or retrieval context, metadata, and for agents and RAG the offered tools, reference expected_tool_calls, gold reference_contexts, a recorded actual_trace, and optional images.
Adapter → Requests. An adapter (Table 2) turns each sample into requests, keeping the prompting strategy separate from data and model.
Model → Results. AutoModel.resolve("prefix:name") dispatches to a registered backend or any callable. The backends cover local and hosted models, including vLLM [17] and SGLang [52], OpenAI-compatible endpoints, and deployed agents. The runner retries transient failures, times every call, and copies the backend's trace (or a recorded actual_trace) into the scoring context.
Annotator (optional). Extracts a scoreable value from raw text without altering it (Listing 9).
Metric → Scores. Each Metric.score(sample, output, context) returns Score objects stamped with the metric's direction.
Aggregate → RunResult. Scores roll up into mean, standard deviation, standard error, and count; RunResult also holds predictions, fingerprint, configuration, errors, unscored counts, and measured performance, size, tokens, and cost.
model="precomputed": replay stored outputs or a recorded agent trace instead of calling a model

Figure 1 Evaluation flow through the shared result object, including replay, harness, agent, and fingerprint paths. Solid, dotted, and dashed arrows denote standard execution, replay, and harness execution, respectively.
Listing 1 Basic evaluation: any dataset, any metric.
import auditkit as ak
samples = [ ak.Sample(input="What is 2+2?", target="4"), ak.Sample(input="Capital of France?", target="Paris"), ]
The test double echo needs no keys or downloads: zero-cost first contact.
result = ak.evaluate(samples, model="echo") print(result.summary()) print(result.headline) # {'exact_match': 0.0}
4.2 Adapters and annotators
An adapter changes only how a sample becomes a request; Table 2 lists the built-in adapters and Listing 8 selects them. Annotators provide regex, reasoning-span, and model-based extraction; extract_with= routes one annotator's output into scoring while raw_output is kept.
4.3 Model comparison and profiling
Comparison consumes stored RunResult objects, so it works for every technique and custom metric. compare_models() evaluates several models through the same pipeline and selects winners per metric by direction (Listing 2); RunComparison adds retention(), tradeoff(), regressed(), and paired-bootstrap significance() (Listing 12). Models need not share one RunConfig: configs and model_options override generation and backend settings per model (Listing 14), and local models are loaded and freed one at a time.
Each RunResult records latency, throughput, model size, token usage, and, given prices, cost (Listing 13). Latency is sampled per generate() call, so a local hf:/v1lm: run at concurrency=1 that answers the whole dataset in one call records one sample: the run's wall-clock time, not per-request latency. API backends populate token usage; the local hf: backend does not.
Table 2 Eight built-in adapters and their roles.
| Name | Class | Purpose | Representative parameters |
| generation_mcq | GenerationAdapterMCQAdapter | Free-form generation (the default)Multiple choice, using a sample’s choices | nonemethod="mcq_joint" or "mcq_loglikelihood" |
| chat | ChatAdapter | Chat-style prompting with a system prompt | system_prompt="You are a helpful assistant." |
| fewshot | FewShotAdapter | In-context few-shot examples | |
| instruction | InstructionAdapter | Instruction-prefixed prompting | instruction="Answer the following question:" |
| rag | RAGAdapter | Retrieval-augmented generation using a sample’s retrieval_context | |
| template_tools | TemplateAdapterToolCallAdapter | Fully custom prompt templateTool-use evaluation: sends a sample’s tools as native schemas, or writes them into the prompt for text-only backends | template="{{input}}"mode="native" or "prompt", tool_choice, parallel_tool_calls |
Listing 2 Comparing multiple models on the same metric set.
import auditkit as ak
results = ak.compare_models( ["openai:gpt-4o-mini", "anthropic:claude-haiku-4-5", "hf:Qwen/Qwen2.5-7B"], dataset=samples, scorers=["exact_match", "f1_score"], )
print(results.summary()) # per-metric leaderboard, direction-correct winners print(results.winner("exact_match"))
4.4 Model backends
Native tool calling is available on api: (schemas, tool_choice, and parallel_tool_calls forwarded; returned calls become one turn), agent:, and the local hf: and vllm: backends, which pass schemas to the chat template and parse calls from the reply. Any other backend is evaluated with ToolCallAdapter(mode="prompt"); the text parser reads Hermes/Qwen <tool_call> blocks, JSON, and Cohere action formats in linear time. RunConfig.chat_template_kwargs (e.g. disabling a reasoning model’s thinking) applies on hf:, vllm:, and api: and enters the fingerprint; Sample.images reach the model on hf: and api::; hf: also loads PEFT adapter folders. Study 4 reports measured coverage across runtimes; the versions are stated with Study 4.
5 Using AuditKIT
The same evaluate() call serves every technique: changing the technique changes the components passed in, not the execution path. Listings 7 and 10 swap the backend and add an LLM judge; custom metrics (Listing 4) use the same path as built-in metrics.
5.1 Academic benchmarks through lm-evaluation-harness
ak.run_lmeval() invokes the real lm-evaluation-harness [13] and maps its results into the same RunResult, reusing the harness’s task definitions while gaining AuditKIT’s provenance, caching, and comparison.
5.2 Experiment management
evaluate_many() evaluates one model on several datasets (Listing 11); YAML and the CLI expose the same operations (Appendix A). ak.generate() stores outputs once so that model="precomputed" can re-score them under other
Listing 3 Academic benchmarks via the real lm-evaluation-harness.
import auditkit as ak
r = ak.run_lmeval( ["arc_easy", "hellaswag", "gsm8k"], model="hf:meta-llama/Llama-3.2-1B", limit=100, device="cpu", )
print(r.headline)
{'arc_easy:acc': 0.61, 'hellaswag:acc_norm': 0.58, 'gsm8k:exact_match': 0.34, ...}
metrics, each scoring configuration receiving its own fingerprint. ExperimentDB keeps a queryable history, optionally mirrored to MLflow [49]. When a model or dataset folder carries lexsi_provenance.json, AuditKIT records it in RunResult.metadata["inputs"], writes it next to saved results, and uploads it with push_to_hub, so a result traces back to its checkpoint and data.
6 Metric Library, Custom Metrics, and Direction-Aware Comparison
6.1 The metric contract and custom metrics
Every metric implements score(sample, output, context) -> Score and declares a direction; omitting it raises TypeError. A function decorated with @ak.scorer(direction=...) (Listing 4) or a full Metric subclass (Listing 15) is scored, aggregated, and compared exactly like a built-in.
6.2 Supported metrics
Table 3 summarizes the built-in families. The generation family implements BLEU [30], ROUGE [23], and BERTScore [50]; GEval implements G-Eval [25]. The four lexical RAG metrics are named for the signals they compute, not after RAGAS [9]; the judged RAG family does claim-level judging and is kept separate so the two methodologies are never averaged under one name. The agent, retrieval, and deterministic RAG families are detailed in Section 7 and Table 4.
Listing 4 A custom metric, registered and used identically to a built-in metric.
import auditkit as ak
direction= is required: omitting it raises TypeError at class-definition
time (Section 4.1), so a winner is never picked from an undeclared metric.
@ak.scorer(direction=ak.Direction.MAXIMIZE) def mentions_price(sample, output) -> float: return 1.0 if "$" in output else 0.0
result = ak.evaluate( samples, model="openai:gpt-4o-mini", # Custom scorer and a built-in metric name side by side: same list, same code path. scorers=[mentions_price, "exact_match"], )
Table 3 Built-in metric families, representative metrics, and registry counts (registered implementations, not independently validated metrics).
| Family | Representative metrics | What it measures | # |
|---|---|---|---|
| Built-in | ExactMatch, QuasiExactMatch, Acc, AccNorm | Exact / normalized correctness against a target | 4 |
| Code / deterministic | Contains, Regex, IsJson, F1Score, Levenshtein, Equals, StartsWith, EndsWith, WordCount | Structural or exact string/JSON correctness | 9 |
| Generation quality | Bleu, RogueL (registry name rouge_l), ChrF [32], WordErrorRate, Perplexity, BertScore | N-gram overlap, fluency, LM confidence | 6 |
| Embedding similarity | CosineSimilarity, TokenOverlap, BM25Similarity | Semantic and lexical similarity | 3 |
| Retrieval-augmented generation (RAG) | LexicalGroundedness, ContextOverlap, ContextCoverage, AnswerOverlap | Groundedness and retrieval quality (lexical-overlap heuristic) | 4 |
| Hallucination | FactualConsistency | Groundedness of generated claims against source text | 1 |
| Toxicity / bias | ToxicityScore, RepresentationSkew, HateSpeechScore | Content-safety signals | 3 |
| Pairwise / preference | WinRate, EloScore, PreferenceAccuracy | Model-vs-model preference comparison | 3 |
| Security | KeywordDetector | Presence of unsafe keywords/patterns | 1 |
| LLM-as-judge | LLMJudge, GEval (weighted rubric), Factuality, ClosedQA, Relevance, BiasJudge | Rubric- or criteria-based judging by another LLM | 6 |
| Encoder-judge | EncoderJudge, FactualityEncoderJudge, SentimentEncoderJudge | Rubric-style judging by a lightweight encoder classifier, not a generative LLM | 3 |
| Guardrail | GuardJudge | Content-moderation verdict from a dedicated guard model | 1 |
| Agent / tool use | ToolCallF1, TrajectoryMatch, ParallelToolCalls, ToolCallValidity, RedundantToolCalls, AgentLoopDetection, ToolPermission, TaskCompletion, ToolSelectionJudge | Call correctness, turn structure, parallel-call behavior, schema validity, redundancy, loops, least privilege, judged completion | 9 |
| Retrieval & judged RAG | RetrievalMetrics, Faithfulness, ContextPrecision, ContextRecall, AnswerRelevancy, ResponseGroundedness, Hallucination, ContextRelevance | Ranked retrieval quality; claim- and sentence-level grounding judged by an LLM, with and without a reference | 8 |
| Deterministic RAG checks | EvidenceSetRecall, Freshness, AclCompliance, CitationSupport, Abstention, NumericAccuracy, ContextRetention | Model-free checks of evidence completeness, freshness, access control, citations, numbers, and abstention against a versioned corpus | 7 |
| Total | 68 |
Performance measurements attach to every RunResult automatically. Some metrics emit more than one score, so registry size describes the available metrics rather than the number of result fields.
Table 4 Agent and RAG metrics with their required inputs.
| Metric | Needs | Measures |
|---|---|---|
| Agent / tool use | ||
| tool_call_f1 | reference calls | precision, recall, F1, exact set; maximum bipartite matching |
| trajectory_match | reference turns | agreement between the predicted and reference tool-call sequences |
| parallel_tool_calls | reference turns | independent calls batched (recall), dependent calls not (precision), when to batch (detection) |
| tool_call_validity | offered schemas | calls valid against the schemas |
| redundant_tool_calls | trace | exact repeats of an earlier call |
| agent_loop_detection | trace | repeated calls, stagnating messages, call-graph cycles |
| tool_permission | allow / deny list | calls within a least-privilege policy |
| task_completion, tool_selection | judge model | judged completion; judged justification of each call |
| Retrieval and judged RAG | ||
| retrieval() | gold contexts, ranked retrieval | hit rate, precision, recall, MRR, AP, nDCG |
| faithfulness, context_precision, context_recall | contexts (+ reference) | claims supported; relevant chunks ranked first; reference covered |
| answer_relevancy, response_groundedness, hallucination , context_relevance | question, contexts, answer; no reference | reference-free relevance and grounding |
| Deterministic RAG checks (model-free) | ||
| evidence_set_recall, context_retention | case evidence sets, trace | a complete sufficient evidence set retrieved; still present in the final context |
| freshness, acl_compliance | corpus snapshot, case date and identity | no superseded documents; no unauthorized or cross-tenant documents |
| citation_support, numeric_accuracy, abstention | gold citations, gold answer, answerability | cited spans exist and support; numbers correct; abstains exactly when it should |
7 Evaluating Agentic and Retrieval-Augmented Systems
AuditKIT evaluates agents at two levels that share one set of metric classes. At the metric level, tool-calling models, deployed agents, and RAG pipelines go through evaluate() like any other task. At the episode level, auditkit.agent_eval evaluates a whole task with a verified outcome as the headline. Table 4 lists the metrics; the whole layer is stdlib-only and never imports AgentTune, torch, or transformers.
7.1 Trace representation
A reference is a list of turns, each the set of calls made in one response: [[a, b], [c]] says a and b are independent and belong together, while c depends on them; [] means no tool should be called. Calls may be {name, arguments} records, OpenAI tool_calls, or BFCL's form; arguments that do not decode mark the call as unmatched. The trace comes from native tool calls, a deployed agent: endpoint, a recorded run under precomputed, or, failing those, the parsed text (Listing 16). When a trace marks tool coverage unavailable, the reference metrics are ineligible rather than scored as “no call”.
7.2 Tool-call and trajectory metrics
Let the reference be turns and the run , and the multiset of all calls. A predicate requires equal tool names and, for arguments, equality ("exact"), reference-containment ("subset": every reference argument must appear in the call, with extra call arguments allowed), or no argument check ("name"), or a custom arg_match. Calls are paired by a maximum bipartite matching (Hungarian-style augmenting paths [16]), so a greedy first fit never rejects a correct run. Precision is and recall . With
Listing 5 Parallel-call scoring: three runs with identical call-level F1 are separated by turn structure. Real output.
import auditkit as ak
W = lambda city: {"name": "get_weather", "arguments": {"city": city}} BOOK = {"name": "book_flight", "arguments": {"flight_id": "AZ-61"}} REF = [[W("Paris"), W("Rome")], [BOOK]] # a parallel group, then a dependent call
runs = {"correct": [[W("Paris"), W("Rome")], [BOOK]], "serialized": [[W("Paris")], [W("Rome")], [BOOK]], "batched": [[W("Paris"), W("Rome"), BOOK]]}
for name, turns in runs.items(): s = ak.Sample(input="Which is warmer, Paris or Rome? Book AZ-61 if it's Rome.", expected_tool_calls=REF, actual_output="", actual_trace={"tool_calls": turns}) h = ak.evaluate([s], model="precomputed", scorers=[ak.ToolCallF1(), ak.ParallelToolCalls()]).headline print(name, h["tool_call_f1"], h["parallel_recall"], h.get("parallel_precision"))
correct 1.0 1.0 1.0
serialized 1.0 0.0 None <- independent calls split across turns
batched 1.0 1.0 0.0 <- booked before the weather result existed
the parallel groups and Q the predicted turns holding at least two matched calls,
and detection is . Low recall means independent calls were serialized; low precision means dependent calls were batched before their inputs existed (Listing 5). These scores measure adherence to the reference’s turn structure, not task success: serializing independent calls can be functionally correct, and a trace of calls does not show that their results were used. Scores without a denominator are omitted, not zeroed.
A reference may list several valid routes, {"any_of": [...]} . One route is chosen per sample by the key (F1, recall, exact turn structure, in-order coverage, listing order), and every reference metric scores that same route, so a row never describes two different runs; scores record the chosen route and per-route F1, and RunResult.route_distribution() reports which rule decided. Because the route is chosen with the prediction in view, these scores measure best-route reference compatibility, an optimistic measure, not independent evidence of task success. Reference-free checks need only the trace, and ak.load_bfcl() with bfcl_arg_match reimplements BFCL's accepted-value rules. A non-default argument mode or custom matcher suffixes the score name, so differently configured instances are never averaged together.
7.3 Task outcomes and reliability
An AgentCase states the task, allowed tools, budgets, and an outcome oracle; an AgentEpisode is one run as ordered events (with call and turn ids) plus final answer, state, and artifacts (Figure 2). Every imported episode reports, for nine fields, whether each was observed, inferred, or unavailable, and a scorer runs only when its fields were observed; otherwise the report names the missing field.
Oracles. Oracles return success, failure, unknown, or error: FinalStateAssertion and ArtifactAssertion check a real effect, in the spirit of -bench; AnswerAssertion checks the answer; CustomPredicate runs versioned caller code; and AssertionOracle turns a natural-language criterion into a verdict via a held-out judge, after an optional state check. Judges are useful but imperfect [51], so TaskCompletion is a diagnostic that never overrides a verified oracle, and disagreements between judge and oracle are recorded. A verdict is relative to the specified oracle and the observed state, so its reliability depends on the oracle's correctness and coverage. A producer's own reward is kept as provenance only.
Execution modes. Runs are recorded (no calls), deployed (an agent: endpoint under a wall-clock deadline), or harness (AuditKIT drives a policy against caller-supplied tool doubles). Each case ends in one of seven statuses; the summary gives success over all cases and over decided cases.
Listing 6 Episode evaluation: a final-state oracle is the headline; tool scores are diagnostics; nothing is called.
from auditkit.agent_eval import (AgentCase, AgentEvalRunner, AgentEvalSpec, FinalStateAssertion, episode_from_openai_messages) episode = episode_from_openai_messages(messages, case_id="inventory-001", final_answer="Shipment for A is ready.") episode.final_state = {"shipment_decision": "ready"} # the verified effect case = AgentCase(id="inventory-001", task="Ship item A if it is in stock.", allowed_tools=["lookup_inventory"], outcome=FinalStateAssertion("shipment_decision", equals="ready")) result = AgentEvalRunner().run(AgentEvalSpec( cases=[case], mode="recorded", episodes=[episode], trials=1, scorers=["tool_call_f1", "tool_call_validity"])) # add judge=... for task_completion
Verified success: 1/1 (1/1 decided) Failure: 0 Unknown outcome: 0 ...
Reliability. With N trials, the headline is the majority of decided trials (a tie is unknown). The report also gives
where pass@k follows Chen et al. [4] and all-k is the pass of -bench, flagged unless the caller confirms a reset between trials. rescore() replays saved episodes under new scorers without endpoint calls (Listing 6).
1

Figure 2 Episode-level agent evaluation separates verified outcomes from trace diagnostics. Dashed arrows mark caller-supplied artifact links.
7.4 Retrieval-augmented generation
A RAG pipeline is scored on what it actually retrieved: the trace’s contexts when returned, the dataset’s otherwise. RetrievalMetrics(k) is deterministic; its average precision divides by all relevant items, so an unretrieved gold chunk lowers the score, and its ideal DCG [15] comes from the gold grades. Judged metrics work with any text judge and treat an unparseable verdict as an error; faithfulness fails unsupported claims, not only contradicted ones (Listing 18).
In regulated settings such as banking, a grounded answer can still rest on a stale, unauthorized, or misattributed source. Seven model-free checks read a versioned CorpusSnapshot, a RAGCase (sufficient evidence sets, citations, tenant, decision date), and a RAGTrace, and each returns a score or an explicit unknown: a complete evidence set was retrieved and kept in the final context, the documents were current at the decision date, retrieval stayed within the caller's access rights, citations exist and support the answer, the numbers are right, and the system abstained exactly when the question was unanswerable.
7.5 Integration with external artifacts
AuditKIT reads AgentTune [28] artifacts by record shape, never by import, and sets coverage from what each artifact contains (Table 5); a serialized EventLog's turn boundaries become parallel groups, and AgentTune's healing-audit records, a per-call projection rather than a trajectory, are not imported. Several AgentTune metrics map onto AuditKIT in stricter form: argument correctness to tool_call_validity, redundancy ratio to redundant_tool_calls, loop frequency to agent_loop_detection, tool-chain order to trajectory_in_order, and message-id recall to retrieval recall; self-correction, tool efficacy, plan adherence, and path edit distance have no counterpart yet. AuditKIT never writes into AgentTune's data: write_sidecar() emits verdicts, coverage, and reliability keyed by trajectory id (Listing 19).
Table 5 AgentTune artifact fields and the diagnostics available from them.
| AgentTune artifact | AuditKIT entry point | What is observed | Eligible without annotation |
|---|---|---|---|
| Evaluation / RL dataset rows (prompt, gold answer, gold chunk ids) | load_agenttune | a task to run: input, target, gold contexts, and the original system prompt; no events yet | answer metrics; retrieval once a live run returns ids; task_completion |
| Trajectory JSONL (steps) | load_agenttune, episodes_from_agenttune | tool calls per step with arguments when recorded; conversation; retrieved chunk ids; reward as provenance | redundancy, loop detection, task_completion; reference metrics once a reference is attached |
| Training trace (trace.jsonl) | same | final answer and retrieved ids; calls carry no tool names | answer metrics, retrieval, task_completion |
| Evaluation report JSON | same | answers plus flattened tool names only (tool_names_only); report metadata kept | tool_call_f1_name, tool_call_validity, task_completion |
| Serialized EventLog | episode_from_eventlog | ordered events, turn grouping (full tier), call ids, reward as provenance | all trajectory metrics the recorded tier supports |
| Healing audit records | refused (named error) | a lossy per-call projection | none |
The same read-only pattern covers AlignTune [27] (scorecards and regression reports), SafeTune [40] (policy events and benchmark rows), CuratorKIT [2] (samples with provenance, manifests, trainer exports), and CircuitKIT [39] (circuit faithfulness reports). Each artifact is wrapped in a SourceEvidence envelope listing the join keys present and missing, and join_evidence() attaches it to an episode only through ids the caller names, refusing to pin aggregate evidence to one case.
8 Empirical Studies
Each study is a single run or a small or controlled sample (the sample size , from 6 to 100, is stated with each). They illustrate what the library reports and distinguishes rather than general model rankings. Studies 1 to 3 ran on the earlier auditkit 0.3.0 line (44 metrics, 7 adapters, no agent layer, not published on PyPI); Studies 4 to 7 used the 1.1.2 release, Study 4 through its vLLM and SGLang integration code. All runs use greedy decoding, with output budgets (max_tokens) of 8 for Study 1, 300 for Study 2, 100 for Study 3 (200 for its judge), 64 for Study 5, and 512 for Study 7. Studies 1 to 3 cover arbitrary metrics, direction-correct multi-model comparison, and performance measurement. Study 4 serves one model family through four runtimes. Studies 5 to 7 apply the RAG, interoperability, and tool-calling layers: a multi-hop question-answering assistant, artifacts from the Lexsi Labs stack, and the choice of a tool-calling model. Studies 5 and 6 are the smallest and illustrate what each layer reports.
8.1 Study 1: Evaluating pruned models
We evaluate three community-pruned MLP-neuron variants of Llama-3.2-3B [10] (the third-party oopere/pruned{20,40,60}-llama-3.2-3b checkpoints, whose pruning method and any post-pruning recovery are the checkpoint author's, not ours) against the unpruned base model on 100 BoolQ [5] questions, one run per severity and without repeated seeds. The baseline is the base (not instruct) model with a one-shot prompt, and the answer is a RegexAnnotator match on ^\s*(yes|no). Each variant is compared with the baseline through RunComparison.retention() (candidate ÷ baseline) on three metrics: boolq_answer_match (exact-match answer scoring), not_degenerate_output (flags only three identical consecutive words; it does not detect empty output), and factual_correctness_judge (LLMJudge-based).
Table 6 Relative metric retention by pruning severity. Baseline absolute scores were not retained, so the ratios are reported as relative retention only.
| Pruning severity | boolq_answer_match (↑) | not_degenerate_output (↑) | factual_correctness_judge (↑) |
|---|---|---|---|
| 20% | 0.411 | 1.000 | 0.385 |
| 40% | 0.726 | 1.000 | 0.788 |
| 60% | 0.630 | 1.000 | 0.673 |
Retention is non-monotonic across severities, and every variant fails the predefined threshold. The flat non-degeneracy score is a coarse signal, because the output budget is short and the heuristic misses empty outputs. The baseline's absolute scores were not retained and may be near chance, so the ratios describe relative retention rather than a pruning effect. Model size falls with severity, which confirms the pruning took effect.
8.2 Study 2: Comparing language models
We run compare_models() over three local Hugging Face checkpoints (Llama-3.1-8B-Instruct [10], Llama-2-13b-chat-hf [11], Qwen/Qwen2.5-14B-Instruct [35]; via HFGenModel) on 100 SST-2 [41] sentiment samples with QuasiExactMatch, reporting per-model accuracy, latency, throughput, and model size (Table 7).
Table 7 Model scores and whole-run time on SST-2; run time is a whole-run measurement, not per-request latency.
| Model | quasi_exact_match (↑) | Params | Size (MiB) | Run time (ms, ↓) |
|---|---|---|---|---|
| llama-8b (Llama-3.1-8B-Instruct) | 0.930 | 8.03B | 15,316.5 | 6,601 |
| llama-13b (Llama-2-13b-chat-hf) | 0.580 | 13.02B | 24,825.8 | 32,388 |
| qwen-14b (Qwen2.5-14B-Instruct) | 0.900 | 14.77B | 28,171.6 | 106,512 |
Adding regex extraction changes the apparent ranking even though the generated outputs are unchanged: the model that scores lowest without extraction becomes competitive after its labels are parsed. This shows how answer formatting can masquerade as a model-quality difference.
Whole-run wall time is not per-request latency and varied substantially between runs, so it is not used for a speed ranking. Per-sample scores were not retained, so we reconstructed confidence intervals and significance tests from aggregate accuracies; the paired test that suits these repeated examples is unavailable. The post-extraction differences are not statistically significant on these aggregates, and equivalence of the models is not tested. The study shows that generation, annotation, scoring, and performance measurement can be varied independently under one common RunResult.
Table 8 Scores after regex extraction; timings are whole-run measurements from a separate run.
| Model | quasi_exact_match (↑) | Std. dev. | n | Run time (ms, ↓, this run) |
|---|---|---|---|---|
| llama-8b (Llama-3.1-8B-Instruct) | 0.930 (unchanged) | 0.2551 | 100 | 64,861 |
| llama-13b (Llama-2-13b-chat-hf) | 0.910 (was 0.580) | 0.2862 | 100 | 112,349 |
| qwen-14b (Qwen2.5-14B-Instruct) | 0.960 (was 0.900) | 0.1960 | 100 | 107,349 |
8.3 Study 3: Financial question answering
Financial-filing question answering needs the right number, not a plausible sentence, so numeric correctness and semantic grounding fail differently. We run compare_models() on 100 question/answer/context triplets from virattt/financial-qa-10K [44]; the first 100 rows are all NVIDIA (NVDA), so this is a single-company case study. It compares Llama-3.1-8B-Instruct [10] (fp16) with Llama-2-13b-chat-hf [11], judged by an independent Meta-Llama-3-8B-Instruct [10]. Four scorers run per sample: NumericFactMatch (a notebook-defined heuristic that checks whether the first extracted number equals the first reference number, and breaks on unit changes such as "$26.97 billion" vs "26,974 million"), LexicalGroundedness and BertScore (grounding and semantic similarity against the filing excerpt), and factual_correctness_judge.
The judge is in the same family as llama-8b, so a self-preference effect is possible. Llama-2-13b-chat-hf and the judge were loaded 4-bit quantized to fit beside the unquantized 8B model on one GPU. This confounds the 8B-vs-
13B comparison, because quantization can affect accuracy and run time as well as size: 11ama-13b's reported size, 6,675.8 MiB, is smaller than 11ama-8b's fp16 15,316.5 MiB despite more parameters.
Table 9 Metric scores on questions from NVIDIA's 2023 10-K filing. The 13B model and the judge ran 4-bit quantized, and numeric_fact_match compares only the first extracted number.
| Model | numeric_fact_match (↑) | lexical_groundedness (↑) | bert_score (↑) | factual_correctness_judge (↑) |
|---|---|---|---|---|
| llama-8b (fp16) | 0.3800 | 0.6659 | 0.8685 | 0.8300 |
| llama-13b (4-bit) | 0.4100 | 0.5812 | 0.7936 | 0.8700 |
The metrics disagree: one model leads on grounding, while the quantized larger model leads on numeric matching and the judge score. The latter gaps overlap their uncertainty intervals, so they are not used for a ranking. The case shows why metric disagreement and evaluation setup, including quantization and judge family, should be reported together.
8.4 Study 4: Evaluation across serving runtimes
We run nine Cohere models [6] through four routes: hf:, offline v1lm:, SGLang via api:, and the Hugging Face router via api:. Each model answers one factual question in five languages (PASS ≥ 4/5), on a 40 GB A100 or 95 GB RTX PRO 6000. The v1lm: column ran vLLM 0.30.0 with transformers 5.16.1, the SGLang column SGLang 0.5.20, and the hf: column transformers 5.17, measured between 2026-09-30 and 2026-10-01; all use greedy decoding. Image tests in the v1lm: column use v1lm serve through api:: offline v1lm: does not accept images. Superscripts mark Transformers backends, SGLang threshold reporting, or matching answers across routes.
Table 10 Correct answers out of five language probes by model and serving route. These are compatibility probes, not estimates of multilingual performance.
| Model | Architecture | hf: | v1lm: | SGLang via api: | HF router via api: |
|---|---|---|---|---|---|
| Tiny Aya Global | cohere2 | 4/5 | 4/5 | text | |
| Tiny Aya Fire | cohere2 | 3/5 | 4/5 | text | |
| Tiny Aya Water | cohere2 | 4/5 | 4/5 | text | |
| Tiny Aya Earth | cohere2 | 3/5 | 4/5 | text | |
| North Micro Vision Instruct | cohere_compass | 3/5 | 5/5, image | , image | text only |
| Aya Expanse 8B | cohere | 5/5 | 5/5 | 5/5 | text |
| Aya Expanse 32B | cohere | 5/5 | 5/5 | 5/5 | text |
| Aya Vision 8B | aya_vision | 5/5 | , image | , image | text only |
| Aya Vision 32B | aya_vision | 4/5 | , image | , image | text only |
A model can load across serving routes yet produce different evaluation outcomes. In one route, a special token left in the response causes an exact-match failure; another route strips it. This small probe checks runtime compatibility, not comparative model quality.
8.5 Study 5: Retrieval and answer quality
A RAG assistant can fail in its retriever or in its generator, and the two need separate measurements. We answer six HotpotQA [46] distractor questions, each with ten candidate paragraphs of which two hold the supporting facts, using two retrievers, BM25 [36] and TF-IDF, that pass their top three paragraphs to the same generator (Qwen2.5-0.5B-Instruct). Each sample carries the retrieved paragraphs as retrieval_context and the gold paragraphs as reference_contexts; RetrievalMetrics(k=3) scores what was retrieved, and quasi-exact match and token F1 score the answer. The prompt places the passages before the question.
Table 11 Retriever and answer metrics for HotpotQA (, , one shared generator).
| Retriever | Hit@3 | P@3 | R@3 | MRR | nDCG@3 | QEM | F1 |
|---|---|---|---|---|---|---|---|
| BM25 | 0.833 | 0.500 | 0.750 | 0.750 | 0.704 | 0.333 | 0.370 |
| TF-IDF | 0.833 | 0.389 | 0.583 | 0.750 | 0.602 | 0.333 | 0.333 |
The retrievers tie on hit rate, but ranking-sensitive measures reveal differences in the retrieved evidence. Answer scores also change when the prompt places the question before rather than after the passages, while retrieval scores stay fixed. Six questions illustrate the measures rather than rank the retrievers; the case shows why retrieval and generation need separate measures.
8.6 Study 6: Evaluating artifacts from the Lexsi Labs stack
We test interoperability using sample artifacts from AgentTune (two trajectories), CuratorKIT, AlignTune, SafeTune, and CircuitKIT. The records are placeholders, so this study evaluates parsing and linking behavior, not model quality. An artifact-based link is checked against an identifier it contains; a caller-based link uses an identifier supplied externally.
Table 12 Evidence-linking outcomes for a sample AgentTune episode (constructed placeholder artifacts).
| Evidence | Granularity | Ids given | Result |
|---|---|---|---|
| AlignTune regression report | aggregate | artifact name, format | joined (artifact) |
| AlignTune audit report | aggregate | checkpoint digest | joined (caller) |
| CircuitKIT faithfulness report | aggregate | model digest | joined (caller) |
| SafeTune audit event | per event | episode id, call id | joined (caller) |
| SafeTune audit event | per event | decision only | refused: describes, does not identify |
| CuratorKIT manifest | aggregate | row id | refused: aggregate cannot pin one row |
Final-state assertions verify the recorded episodes, while missing tool arguments and rewards remain unscored rather than inferred. Evidence records are joined only when their identifiers support the link; descriptive labels and aggregate manifests are refused when they cannot identify an episode.
8.7 Study 7: Choosing a tool-calling model
An assistant that books, ships, or refunds must pick the right tool, fill its arguments, issue independent calls together, and recognize when no tool applies. A larger model costs more to serve, so we ask what the extra parameters buy. We compare Qwen2.5-7B-Instruct and Qwen2.5-14B-Instruct [35] on the first 100 questions of five single-turn BFCL [31] categories: one call (simple), choosing among tools (multiple), independent calls in one response (parallel, parallel_multiple), and questions no tool answers (irrelevance). Both models run through vllm: with native tool schemas via ToolCallAdapter, and every call is scored with BFCL's accepted-value rules (bfcl_arg_match). Call F1 uses maximum bipartite matching; exact set requires every call and argument to match. Parallel precision and recall apply to categories with independent reference calls. Validity is averaged over questions with a tool call, redundancy is lower-is-better, and in irrelevance F1/exact-set measure correctly making no call.
Table 13 Tool-calling metrics across BFCL categories. Validity is averaged over questions with a tool call; parallel precision and recall apply only to categories with independent reference calls (n/a otherwise).
| Category | Model | Call F1 | Exact set | Par. recall | Par. precision | Validity | Redundant |
|---|---|---|---|---|---|---|---|
| simple | 7B | 0.980 | 0.98 | n/a | n/a | 1.000 | 0.000 |
| 14B | 0.980 | 0.98 | n/a | n/a | 1.000 | 0.000 | |
| multiple | 7B | 0.937 | 0.93 | n/a | n/a | 1.000 | 0.000 |
| 14B | 0.948 | 0.93 | n/a | n/a | 1.000 | 0.000 | |
| parallel | 7B | 0.912 | 0.89 | 0.89 | 1.00 | 1.000 | 0.000 |
| 14B | 0.919 | 0.89 | 0.89 | 1.00 | 0.993 | 0.000 | |
| parallel_multiple | 7B | 0.905 | 0.80 | 0.83 | 1.00 | 0.989 | 0.000 |
| 14B | 0.897 | 0.81 | 0.84 | 1.00 | 0.989 | 0.012 | |
| irrelevance | 7B | 0.590 | 0.59 | n/a | n/a | 0.732 | 0.000 |
| 14B | 0.710 | 0.71 | n/a | n/a | 0.828 | 0.017 |
The models perform similarly on categories that require a tool call, while the larger model more often declines irrelevant requests; uncertainty intervals overlap, so this difference is suggestive. On parallel calls, call-level F1 preserves partial credit that exact-set scoring hides, whereas parallel precision is uninformative with single-turn references. These results describe this benchmark slice.
9 Limitations and Ethics Statement
AuditKIT is a measurement library, and several parts of it are deliberately modest in scope. Image inputs are supported without image-specific metrics, and simulated-user conversation, perturbation, and tabular evaluation are planned extensions. Agent evaluation scores a single-response model one turn at a time, relies on the caller to declare trial independence, treats alternative routes as whole routes, and validates tool calls against the common subset of JSON.
Schema. Latency is sampled per generate() call, so a single-call local run reports one whole-run wall-clock sample rather than per-request latency (Section 4.3); time-to-first-token and inter-token latency are outside the current scope, and the local hf: backend does not record token usage. Red-teaming support is intentionally basic compared with Promptfoo [33], PyRIT [26], and DeepTeam [8], and its probes are dual-use and intended for authorized evaluation of models the user may test (Section 2).
The case studies show what the library reports, and a few of their features are worth keeping in mind. They are small. They use a single judge (Meta-Llama-3-8B-Instruct, greedy-decoded). The library can use other supported backends as judges, but each study ran one judge configuration, so judged verdicts have not been validated against human annotation and may favor a candidate from the judge's own model family (Study 3); the judge prompt is in Appendix A.6. Significance statements in Study 2 use the reported accuracies (95% Wilson intervals and a two-proportion test) because per-sample paired scores were not retained.
This paper contains no harmful content, adversarial prompts, or personally identifiable information, and the agent harness runs tools only through caller-supplied doubles. AuditKIT is released under the Lexsi Labs Source Available License v1.2, which is not an OSI-approved open-source licence and conditions commercial use; see the licence for its terms.
10 Conclusion
We presented AuditKIT, a source-available library that evaluates language models and agents through one run and comparison interface. It combines direction-aware metrics, configuration tracking, and extensible components with structured assessment of tool use, retrieval, and task outcomes. For agents, it keeps turn-level execution information, separates trajectory diagnostics from oracle-based outcomes, and reports when the available evidence is insufficient for scoring.
The seven case studies illustrate how evaluation choices shape reported results. Answer extraction changed the apparent model ranking while the generated responses stayed the same, serving-runtime differences changed exact-match outcomes, and retrieval metrics separated retrievers that hit rate treated as tied. These observations show why evaluation context should be retained and why each metric should be read together with the evidence it was computed from.
Availability. AuditKIT is available with documentation, a CLI, and examples (https://github.com/Lexsi-Labs/AuditKIT) under the Lexsi Labs Source Available License (LSAL) v1.2.
References
[1] Arize AI. Phoenix: Ai observability and evaluation, 2024.
[2] Soham Bhattacharjee, Karun Sharma, Vinay Kumar Sankarapu, and Pratinav Seth. CuratorKIT: Data curation and synthetic data generation for LLM post-training, 2026.
[3] Braintrust Data, Inc. Braintrust, 2024.
[4] Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
[5] Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. BoolQ: Exploring the surprising difficulty of natural yes/no questions. In Jill Burstein, Christy Doran, and Thamar Solorio, editors, Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2924–2936, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics.
[6] Cohere Labs. Tiny aya (global, fire, water, earth), Aya Expanse 8b/32b, Aya Vision 8b/32b, and North Micro Vision Instruct: model cards, 2026.
[7] Confident AI. Deepeval: The open-source llm evaluation framework, 2024.
[8] Confident AI. Deepteam: The llm red teaming framework, 2024.
[9] Shahul Es, Jithin James, Luis Espinosa Anke, and Steven Schockaert. RAGAs: Automated evaluation of retrieval augmented generation. In Nikolaos Aletras and Orphee De Clercq, editors, Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations, pages 150–158, St. Julians, Malta, March 2024. Association for Computational Linguistics.
[10] Aaron Grattafiori et al. The llama 3 herd of models, 2024.
[11] Hugo Touvron et al. Llama 2: Open foundation and fine-tuned chat models, 2023.
[12] Robert Friel, Masha Belyi, and Atindriyo Sanyal. RAGBench: Explainable benchmark for retrieval-augmented generation systems. arXiv preprint arXiv:2407.11005, 2024.
[13] Leo Gao, Jonathan Tow, Baber Abbasi, et al. A framework for few-shot language model evaluation, 2024.
[14] Giskard AI. Giskard: Testing framework for ml models and llm applications, 2024.
[15] Kalervo Järvelin and Jaana Kekäläinen. Cumulated gain-based evaluation of IR techniques. ACM Transactions on Information Systems, 20(4):422–446, 2002.
[16] Harold W. Kuhn. The Hungarian method for the assignment problem. Naval Research Logistics Quarterly, 2(1–2):83–97, 1955.
[17] Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, and Ion Stoica. Efficient memory management for large language model serving with PagedAttention. In Proceedings of the 29th Symposium on Operating Systems Principles (SOSP), 2023.
[18] LangChain. Langsmith, 2024.
[19] LangChain. agentevals: Readymade evaluators for agent trajectories, 2025.
[20] Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
[21] Minghao Li, Yingxiu Zhao, Bowen Yu, Feifan Song, Hangyu Li, Haiyang Yu, Zhoujun Li, Fei Huang, and Yongbin Li. API-Bank: A comprehensive benchmark for tool-augmented LLMs. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2023.
[22] Percy Liang et al. Holistic evaluation of language models. Transactions on Machine Learning Research, 2023. Featured Certification, Expert Certification, Outstanding Certification.
[23] Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Text Summarization Branches Out, pages 74–81, Barcelona, Spain, July 2004. Association for Computational Linguistics.
[24] Xiao Liu, Hao Yu, Hanchen Zhang, Yifan Xu, Xuanyu Lei, Hanyu Lai, Yu Gu, Hangliang Ding, Kaiwen Men, Kejuan Yang, et al. AgentBench: Evaluating LLMs as agents. In International Conference on Learning Representations (ICLR), 2024.
[25] Yang Liu, Dan Iter, Yichong Xu, Shuohang Wang, Ruochen Xu, and Chenguang Zhu. G-eval: NLG evaluation using gpt-4 with better human alignment. In Houda Bouamor, Juan Pino, and Kalika Bali, editors, Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 2511–2522, Singapore, December 2023. Association for Computational Linguistics.
[26] Gary D. Lopez Munoz, Amanda J. Minnich, Roman Lutz, Richard Lundeen, Raja Sekhar Rao Dheekonda, Nina Chikanov, Bolor-Erdene Jagdagdorj, Martin Pouliot, Shiven Chawla, Whitney Maxwell, et al. PyRIT: A framework for security risk identification and red teaming in generative AI systems. arXiv preprint arXiv:2410.02828, 2024.
[27] R. E. Zera Marveen Lyngkhoi, Chirag Chawla, Pratinav Seth, Utsav Avaiya, Soham Bhattacharjee, Mykola Khandoga, Rui Yuan, and Vinay Kumar Sankarapu. AlignTune: Modular toolkit for post-training alignment of large language models, 2026. Lexsi Labs. arXiv:2602.09621.
[28] R. E. Zera Marveen Lyngkhoi, Abhivansh Gupta, Vidushee Vats, Ram Mohan Rao Kadiyala, Vinay Kumar Sankarapu, and Pratinav Seth. AgentTune: A unified training lifecycle for tool-using LLM agents, 2026.
[29] OpenAI. Evals: A framework for evaluating llms and llm systems, 2023.
[30] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Pierre Isabelle, Eugene Charniak, and Dekang Lin, editors, Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pages 311–318, Philadelphia, Pennsylvania, USA, July 2002. Association for Computational Linguistics.
[31] Shishir G. Patil, Huanzhi Mao, Fanjia Yan, Charlie Cheng-Jie Ji, Vishnu Suresh, Ion Stoica, and Joseph E. Gonzalez. The Berkeley function calling leaderboard (BFCL): From tool use to agentic evaluation of large language models. In International Conference on Machine Learning (ICML), 2025.
[32] Maja Popović. chrF: character n-gram F-score for automatic MT evaluation. In Ondřej Bojar, Rajan Chatterjee, Christian Federmann, Barry Haddow, Chris Hokamp, Matthias Huck, Varvara Logacheva, and Pavel Pecina, editors, Proceedings of the Tenth Workshop on Statistical Machine Translation, pages 392–395, Lisbon, Portugal, September 2015. Association for Computational Linguistics.
[33] Promptfoo. Promptfoo: Test and secure llm apps, 2024.
[34] Yujia Qin, Shihao Liang, Yining Ye, Kunlun Zhu, Lan Yan, Yaxi Lu, Yankai Lin, Xin Cong, Xiangru Tang, Bill Qian, et al. ToolLLM: Facilitating large language models to master 16000+ real-world APIs. In International Conference on Learning Representations (ICLR), 2024.
[35] Qwen Team, An Yang, et al. Qwen2.5 technical report, 2024.
[36] Stephen Robertson and Hugo Zaragoza. The probabilistic relevance framework: BM25 and beyond. Foundations and Trends in Information Retrieval, 3(4):333–389, 2009.
[37] Jon Saad-Falcon, Omar Khattab, Christopher Potts, and Matei Zaharia. ARES: An automated evaluation framework for retrieval-augmented generation systems. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics (NAACL), 2024.
[38] Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools. In Advances in Neural Information Processing Systems (NeurIPS), 2023.
[39] Pratinav Seth, Hem Gosalia, Aditya Kasliwal, and Vinay Kumar Sankarapu. CircuitKIT: Circuit discovery, evaluation, and application toolkit for mechanistic interpretability, 2026.
[40] Pratinav Seth, Saisab Sadhu, Anshul Kaushal, and Vinay Kumar Sankarapu. SafeTune: A unified, faithful library for auditing and repairing safety drift in fine-tuned LLMs, 2026.
[41] Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In David Yarowsky, Timothy Baldwin, Anna Korhonen, Karen Livescu, and Steven Bethard, editors, Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1631–1642, Seattle, Washington, USA, October 2013. Association for Computational Linguistics.
[42] TruEra. Trulens: Evaluation and tracking for llm experiments, 2024.
[43] UK AI Security Institute. Inspect ai: Framework for large language model evaluations, 2024.
[44] virattt. financial-qa-10k: A question-answering dataset derived from real sec 10-k filings, 2024.
[45] Weights & Biases. Weave: A framework for tracking and evaluating llm applications, 2024.
[46] Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William W. Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. HotpotQA: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 2369–2380, 2018.
[47] Shunyu Yao, Noah Shinn, Pedram Razavi, and Karthik Narasimhan. -bench: A benchmark for tool-agent-user interaction in real-world domains. arXiv preprint arXiv:2406.12045, 2024.
[48] Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. ReAct: Synergizing reasoning and acting in language models. In International Conference on Learning Representations (ICLR), 2023.
[49] Matei Zaharia, Andrew Chen, Aaron Davidson, Ali Ghodsi, Sue Ann Hong, Andy Konwinski, Siddharth Murching, Tomas Nykodym, Paul Ogilvie, Mani Parkhe, et al. Accelerating the machine learning lifecycle with mlflow. IEEE Data Engineering Bulletin, 41(4):39–45, 2018.
[50] Tianyi Zhang*, Varsha Kishore*, Felix Wu*, Kilian Q. Weinberger, and Yoav Artzi. Bertscore: Evaluating text generation with bert. In International Conference on Learning Representations, 2020.
[51] Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric P. Xing, Hao Zhang, Joseph E. Gonzalez, and Ion Stoica. Judging LLM-as-a-judge with MT-Bench and Chatbot Arena. In Advances in Neural Information Processing Systems (NeurIPS), Datasets and Benchmarks Track, 2023.
[52] Lianmin Zheng, Liangsheng Yin, Zhiqiang Xie, Chuyue Sun, Jeff Huang, Cody Hao Yu, Shiyi Cao, Christos Kozyrakis, Ion Stoica, Joseph E. Gonzalez, Clark Barrett, and Ying Sheng. SGLang: Efficient execution of structured language model programs. In Advances in Neural Information Processing Systems (NeurIPS), 2024.
A Appendix: Code Listings for Library API and Usage (Section 5)
The body keeps six short listings; the remaining examples it refers to are collected here, grouped as the core API (Appendix A.1), agents and RAG (Appendix A.3), the command line, YAML configuration, and the judge prompt used in Studies 1 and 3.
A.1 Core API
Listing 7 Swapping the model backend: nothing else changes.
ak.evaluate(samples, model="hf:meta-llama/Llama-3.1-8B-Instruct", hf_token="hf_...", device="cuda") # local, gated: needs an accepted-license HF token ak.evaluate(samples, model="hf:gpt2", device="cpu") # local, ungated HuggingFace ak.evaluate(samples, model=lambda prompts: [call_my_app(p) for p in prompts]) # any callable
Listing 8 Selecting different adapters for different prompting strategies.
import auditkit as ak
Chat-style prompting with a system prompt
ak.evaluate(samples, model="openai:gpt-4o-mini", adapter=ak.ChatAdapter(system_prompt="You are a helpful assistant."))
Few-shot, drawing examples from a pool
ak.evaluate(samples, model="openai:gpt-4o-mini", adapter=ak.FewShotAdapter(num_shots=3, pool=fewshot_pool))
Retrieval-augmented generation: adapter="auto" routes on sample shape:
a sample carrying retrieval_context is routed to RAGAdapter automatically
(and one carrying tools to ToolCallAdapter).
rag_data = [ak.Sample( input="When was the Eiffel Tower completed?", target="1889", retrieval_context=["The Eiffel Tower was completed in 1889 for the World's Fair.”], )]
ak.evaluate(rag_data, model="openai:gpt-4o-mini", adapter="auto", scorers=["lexical_groundedness", "context_coverage", "context_overlap"])
Listing 9 A regex annotator extracts a clean answer before scoring.
import auditkit as ak from auditkit.annotator import RegexAnnotator
A model that reasons before answering:
"Reasoning... \nFINAL ANSWER: 42"
answer = RegexAnnotator(r"FINAL ANSWER:\s*(.+)", group=1, name="answer")
result = ak.evaluate( samples, model=reasoning_model, scorers="exact_match", annotators=answer, extract_with="answer", )
print(result.predictions[0].raw_output) # unchanged: the full reasoning + answer print(result.predictions[0].parsed_answer) # "42": what was actually scored
Listing 10 LLM-as-judge scoring with a custom weighted rubric.
import auditkit as ak
No target needed: GEval judges the output against the rubric, not a gold answer.
qa = [ ak.Sample(input="What is the derivative of x^2?"), ak.Sample(input="Explain gradient descent."), ]
Each RubricItem is one scored dimension; weight controls its share of the rubric total.
rubric = [ak.RubricItem("Correctness", weight=2.0, description="factually right"), ak.RubricItem("Clarity", weight=1.0)]
result = ak.evaluate( qa, model="hf:meta-llama/Llama-3.1-8B-Instruct", hf_token="hf_...", # judge_model is a second, independent model call per sample: distinct # from the model under evaluation above, so it never grades itself. scorers=[ak.GEval(rubric, judge_model="hf:meta-llama/Meta-Llama-3-8B-Instruct", judge_model_args={"hf_token": "hf_..."}), )
Listing 11 One model, several datasets, one call.
import auditkit as ak
results = ak.evaluate_many( { "refusal_bench": (refusal_samples, [refusal_judge]), "over_refusal": (over_ref_samples, [over_refusal_judge]), "gsm8k_local": (gsm_samples, ["exact_match"]), }, model="hf:meta-llama/Llama-3.1-8B-Instruct", hf_token="hf_...", on_error="skip", # one bad dataset load doesn't lose the rest )
for name, r in results.items(): print(name, r.headline)
Listing 12 Two-run comparison (before/after a model change).
import auditkit as ak
base = ak.evaluate(data, model="hf:my-base-model", scorers=["exact_match"]) pruned = ak.evaluate(data, model="hf:my-pruned-model", scorers=["exact_match"])
cmp = ak.compare(base, pruned) printcmp.summary())
exact_match: 0.8200 -> 0.7900 delta=-0.0300 (-3.7% rel) (n=500->500, std=...)
cmp.retention("exact_match") # fraction of baseline quality kept cmp.significance() # paired bootstrap, aligned by sample_id cmp.tradeoff(metric="exact_match") # quality vs. measured size/latency cmp.regressed() # the exact samples that got worse
Listing 13 Accessing automatically measured performance and model size: real output, Llama-3.1-8B-Instruct, 100 samples.
import auditkit as ak
r = ak.evaluate(qa, model="hf:meta-llama/Llama-3.1-8B-Instruct", hf_token="hf_...", config=RunConfig(track_performance=True), scorers=[quality])
r.perf["latency_ms"]
{"count": 1, "mean": 65174.78, "min": 65174.78, "max": 65174.78,
"p50": 65174.78, "p95": 65174.78, "p99": 65174.78, "std": 0.0}
r.perf["throughput"]
{"rps": 1.534, "total_requests": 100, "total_time_ms": 65174.78,
"output_tokens_per_sec": 0.0, "total_tokens_per_sec": 0.0}
r.model_size
{"is_local": True, "total_params": 8030261248, "nonzero_params": 8030259962,
"sparsity": 1.6e-07, "size_mb": 15316.51}
Listing 14 Per-model configuration overrides in a single compare_models() call.
import auditkit as ak from auditkit.runspec import RunConfig
results = ak.compare_models( ["hf:base-model", "hf:pruned-model", "hf:meta-llama/Llama-3.1-8B-Instruct"], dataset=samples, scorers=["exact_match", "f1_score"], model_names=["base", "pruned", "prod"],
Applied to any model without its own entry below:
config=RunConfig(temperature=0.0, max_tokens=256),
Per-model generation-level overrides (RunConfig), keyed by model_names:
configs={
"pruned": RunConfig(temperature=0.0, max_tokens=256, seed=7),
"prod": RunConfig(temperature=0.2, max_tokens=512),
},
Per-model backend-construction-level overrides, keyed by model_names:
model_opts={
"base": {"device": "cuda"},
"pruned": {"device": "cuda"},
"prod": {"device": "cuda", "hf_token": "hf_..."}}, # gated model
},
print(results.summary()) # leaderboard + per-task tables + pairwise significance print(results.winner("exact_match")) cmp = results.pairwise("base", "pruned") # zoom into any two -> RunComparison
A.2 The full Metric-subclass form
For scoring logic that needs constructor parameters or internal state, a metric can be a full Metric subclass; the registry treats both forms identically.
Listing 15 A configurable custom metric, registered as a full Metric subclass.
from auditkit.metric import Metric from auditkit.score import Score from auditkit.types import Direction, ScoreKind from auditkitregistry import METRICS
@METRICS.register("under_limit") # registers the class under this string name class UnderLimit(Metric): direction = Direction.MAXIMIZE # class-level; still mandatory as with the decorator form
def init(self, max_len=280): self.max_len = max_len self.name = f"under_limit({max_len})" # per-instance name: distinguishes configs in results/fingerprint
def score(self, sample, output, context=None): return Score( name=self.name, value=float(len(output) <= self.max_len), # 1.0/0.0, not a raw length: direction stays meaningful kind=ScoreKind.CODE, )
Used exactly like a built-in metric, by its registered name:
import auditkit as ak result = ak.evaluate(samples, model="openai:gpt-4o-mini", scorers=["under_limit"])
A.3 Agents and RAG
Listing 16 One tool-use sample through three trace sources: native tool calls from an OpenAI-compatible server, a deployed agent, and a recorded run.
import auditkit as ak
TOOLS = [...] # OpenAI-format schemas: get_weather, book_flight, compare_weather W = lambda city: {"name": "get_weather", "arguments": {"city": city}} BOOK = {"name": "book_flight", "arguments": {"flight_id": "AZ-61"}} Q = "Which is warmer, Paris or Rome? Book AZ-61 if it's Rome."
sample = ak.Sample(input=Q, tools=TOOLS, expected_tool_calls=[[W("Paris"), W("Rome")], [BOOK]]) scorers = [ak.ToolCallF1(), ak.TrajectoryMatch(), ak.ParallelToolCalls()]
(i) vLLM / SGLang / OpenAI-compatible server; one request shows one turn
ak.evaluate([ak.Sample(input=Q, tools=TOOLS, expected_tool_calls=[[W("Paris"), W("Rome")]]]), model="api:Qwen/Qwen2.5-7B-Instruct", api_base="http://localhost:8000/v1", adapter=ak.ToolCallAdapter(), scorers=scorers)
(ii) a deployed agent that runs its own loop and returns its transcript
ak.evaluate([sample], model="agent:http://localhost:8000/run", adapter=ak.ToolCallAdapter(), scorers=scorers)
(iii) a recorded run: no model is called
sample.actual_trace = {"tool_calls": [[W("Paris"), W("Rome")], [BOOK]]} ak.evaluate([sample], model="precomputed", scorers=scorers)
Listing 17 Alternative routes, reference-free trajectory checks, and BFCL data. Real output except the BFCL line, which needs the dataset download.
CMP = {"name": "compare_weather", "arguments": {"cities": ["Paris", "Rome"]}} s = ak.Sample(input="Which is warmer, Paris or Rome?", tools=TOOLS, expected_tool_calls={"any_of": [[W("Paris"), W("Rome")]], # route 0 [[CMP]]], # route 1 actual_output="", actual_trace={"tool_calls": [[CMP]]}) r = ak.evaluate([s], model="precomputed", scorers=[ak.ToolCallF1()])
tool_call_f1 = 1.0, matched_path = 1, path_f1 = [0.0, 1.0]
No reference needed: validity, redundancy, loops, least privilege
looping = ak.Sample(input=Q, tools=TOOLS, metadata={"allowed_tools": ["get_weather"]}, actual_output="", actual_trace={"tool_calls": [[W("Paris")], [W("Paris")], [W("Paris")], [BOOK]]}) ak.evaluate([looping], model="precomputed", scorers=[ ak.ToolCallValidity(), ak.RedundantToolCalls(), ak.AgentLoopDetection(), ak.ToolPermission(denied_tools=["book_flight"]]).headline
{'tool_call_validity': 1.0, 'redundant_tool_calls': 0.5,
'agent_loop_detection': 0.0, 'tool_permission': 0.75}
BFCL, scored with BFCL's own accepted-value rules
bfcl = ak.load_bfcl("BFCL_v3_simple.json", limit=100) ak.evaluate(bfcl, model="api:Qwen/Qwen2.5-7B-Instruct", adapter=ak.ToolCallAdapter(), scorers=[ak.ToolCallF1(arg_match=ak.bfcl_arg_match)])
Listing 18 RAG: ranked retrieval (real output), LLM-judged grounding, and deterministic evidence checks (real output).
s = ak.Sample(input="How often are laptops replaced?", target="Every 3 years.", reference_contexts=["it-04"], actual_output="Every 3 years.", actual_trace={"retrieved_contexts": ["it-09", "it-04", "hr-31"]}) ak.evaluate([s], model="precomputed", scorers=[ak.RetrievalMetrics(k=3)]).headline
hit_rate@3 1.0 precision@3 0.333 recall@3 1.0 mrr@3 0.5 ap@3 0.5 ndcg@3 0.631
judge = dict(judge_model="api:Qwen/Qwen2.5-7B-Instruct", # any text-in/text-out model judge_model_args={"api_base": "http://localhost:8000/v1", "api_key": "EMPTY"} ak.evaluate(rag_samples, model="agent:http://localhost:8000/rag", # scored on what it retrieved scorers=[ak.Faithfulness(**judge), ak.ContextRecall(**judge), ak.Hallucination(**judge)]) # hallucination: lower is better
Deterministic checks: snapshot is a versioned policy corpus, case a question with its gold
evidence trace = ak.RAGTrace(query=case.question, retrieved=[{"id": "LP-CURRENT", "score": 0.9}, {"id": "FIN-TABLE", "score": 0.8}]) s = ak.Sample(input=case.question, actual_output="LTV cap is 80 percent; Q1 NII 1200.", actual_trace=trace.to_dict(), metadata={"rag_case": case.to_dict(), "corpus": snapshot.to_dict()} ak.evaluate([s], model="precomputed", scorers=["evidence_set_recall", "freshness", "acl_compliance"]).headline
{'evidence_set_recall': 1.0, 'freshness': 1.0, 'stale_hit_rate': 0.0,
'acl_compliance': 1.0, 'unauthorized_hit_rate': 0.0}
Listing 19 A constructed AgentTune evaluation report (report_constructed.json), re-scored as episodes and returned as a sidecar. Output on that constructed fixture.
import auditkit as ak from auditkit.agent_eval import AgentEvalRunner, AgentEvalSpec, inspect_agenttune, write_sidecar
inspect_agenttune("report.json")["coverage_labels"]
{'tool_names_only': 1, 'none': 1} <- the report kept tool names, not arguments
episodes = ak.episodes_from_agenttune("report.json") result = AgentEvalRunner().run(AgentEvalSpec( mode="recorded", episodes=episodes, scorers=["tool_call_f1_name", "tool_call_validity"]))
print(result.summary())
Verified success: 1/2 (1/2 decided) Failure: 1 Unknown outcome: 0 ...
result.rows[0].ineligible
{'tool_call_f1_name': 'case.reference_turns', 'tool_call_validity': 'case.allowed_tools'}
write_sidecar(result, "auditkit_sidecar.jsonl") # one record per trajectory id
A.4 Command-line interface
Listing 20 CLI: zero-configuration smoke test.
pip install auditkit auditkit eval --model echo <<> "What is 2+2?" # zero-cost test double, no API key needed
Listing 21 CLI: evaluating a built-in benchmark.
auditkit eval --dataset mmlu --model openai:gpt-4o --output results.json auditkit eval --dataset gsm8k --model openai:gpt-4o --output results.json
Listing 22 CLI: evaluating against a CSV dataset: any tabular data, any column names.
export HF_TOKEN=hf_... # gated model: CLI has no --hf-token flag, reads the env var
auditkit eval --model hf:meta-llama/Llama-3.1-8B-Instruct --csv data.csv
--input-col question --target-col answer -o results.json
Listing 23 CLI: comparing models from the command line.
--baseline picks which of --models is the reference for retention()/tradeoff().
auditkit compare --models "hf:base,hf:pruned" --dataset gsm8k --baseline hf:base
Listing 24 CLI: listing every registered resource, or a single category.
auditkit list metrics auditkit list all
Listing 25 CLI: red-teaming a model with adversarial probes.
auditkit redteam --model echo --probes prompt_injection,jailbreak --detectors keyword
Listing 26 CLI: agent evaluation. --inspect and --dry-run are local and read-only: they load no model and call no endpoint.
What an AgentTune file records, and which metrics it can feed
auditkit agent import-agenttune trajectories.jsonl --inspect
Detected format(s): {'agenttune_trajectory': 1}
Coverage labels: {'full': 1}
Eligible metrics (trace-supported): answer, parallel_tool_calls, ...
Validate the cases, oracles, trials and judge, and print the call plan
auditkit agent eval --config agent-suite.json --dry-run
Run it, redacting a secret by the value of an environment variable
auditkit agent eval --config agent-suite.json --output agent-run.json
--redact-env AGENT_API_KEY
Rescore the saved episodes with other scorers: no agent call
auditkit agent rescore --run agent-run.json --scorers tool_call_f1,task_completion
A.5 Configuration via YAML
Listing 27 A YAML configuration file, adapted from the library's own example configuration, run with auditkit eval --config auditkit.yaml.
auditkit.yaml
model: openai:gpt-4o-mini temperature: 0.0 max_tokens: 256 seed: 42 concurrency: 8
prompts:
- "What is the capital of France?"
- "Explain quantum computing in one paragraph."
- "Write a haiku about programming."
adapter: generation output: results.json format: json
experiment: my-eval tags:
- test
- v1
A.6 Judge prompt
The factual_correctness_judge prompt is identical in structure across Studies 1 and 3, differing only in the field naming the retrieved text (Passage for Study 1's BoolQ context, Filing excerpt for Study 3's 10-K excerpt):
{Passage/Filing excerpt}: {context} Question: {input} Real answer: {expected} Model answer: {output} Does the model answer {match/state the same fact as} the real answer? Reply CHOICE: yes or CHOICE: no.