Skip to content

Giskard - ML & LLM Testing Framework Cheatsheet

Giskard - ML & LLM Testing Framework Cheatsheet

Giskard is an open-source testing framework for ML and LLM applications. Its signature feature is an automated scan that probes a model for vulnerabilities — hallucination, prompt injection, harmful content, robustness failures, bias, and data leakage — and produces a report you can convert directly into a reusable test suite. That scan-then-testify workflow is what distinguishes it: you do not have to know what to test for in advance.

Installation

MethodCommand
pippip install giskard
LLM extraspip install "giskard[llm]"
Model keyexport OPENAI_API_KEY=... (used for LLM-based detectors)
Verifypython -c "import giskard; print(giskard.__version__)"

Wrapping an LLM App

import giskard
import pandas as pd

def predict(df: pd.DataFrame):
    return [my_llm_app(q) for q in df["question"]]

model = giskard.Model(
    model=predict,
    model_type="text_generation",
    name="Support Assistant",
    description="Answers customer questions using our docs",
    feature_names=["question"],
)

dataset = giskard.Dataset(
    pd.DataFrame({"question": ["How do I reset my password?"]}),
    target=None,
)
FieldWhy it matters
descriptionGiskard uses it to generate relevant probes
model_typetext_generation, classification, regression
feature_namesInput columns

The description is not cosmetic — the scanner generates domain-specific adversarial inputs from it.

Scanning

report = giskard.scan(model, dataset)
report.to_html("scan_report.html")
DetectorFinds
HallucinationUnsupported or incoherent claims
Prompt injectionInstruction override
HarmfulnessUnsafe content generation
RobustnessSensitivity to trivial input changes
Sensitive disclosureLeaking secrets/PII
StereotypesBias in outputs
Performance biasUneven accuracy across slices (tabular/NLP)
# Scan only specific detector groups
report = giskard.scan(model, dataset, only=["hallucination", "jailbreak"])

Scan → Test Suite

suite = report.generate_test_suite("Support Assistant tests")
suite.run()

This is the key workflow: findings become regression tests, so a fixed issue stays fixed and can be gated in CI.

Custom Tests

from giskard import test, TestResult

@test(name="No refund promises")
def no_refund_promise(model, dataset):
    outputs = model.predict(dataset).prediction
    bad = [o for o in outputs if "guaranteed refund" in o.lower()]
    return TestResult(passed=len(bad) == 0, metric=len(bad))

suite.add_test(no_refund_promise).run()

RAG Evaluation (RAGET)

Giskard includes a RAG evaluation toolkit that generates a question set from your knowledge base and scores each pipeline component.

Component scoredTells you
GeneratorIs the LLM’s answer good given context?
RetrieverDid retrieval surface the right chunks?
RewriterIs query rewriting helping?
RouterWas the query routed correctly?
Knowledge baseIs the source material adequate?

Component-level scoring is more actionable than a single end-to-end number — it tells you which stage to fix.

AspectGiskardDeepEvalgarak
Core ideaAuto-scan → test suiteUnit-test style metricsModel probe scanner
ScopeML + LLM + RAGLLM app evalsLLM model vulnerabilities
ReportRich HTML scan reportCI output/dashboardCLI report
Best forDiscovering unknown issuesGating known metricsBroad model probing

Pairs with DeepEval for metric gating and Ragas for RAG scoring; Giskard’s edge is finding issues you did not think to test.

Resources