MCPcopy Index your code
hub / github.com/Kaggle/kaggle-benchmarks

github.com/Kaggle/kaggle-benchmarks @v0.6.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.6.1 ↗ · + Follow
1,549 symbols 5,547 edges 155 files 544 documented · 35%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Kaggle Benchmarks

Ask DeepWiki

kaggle-benchmarks is a Python library designed to help you rigorously evaluate AI models on tasks that matter to you. It provides a structured framework for defining tasks, interacting with models, and asserting the correctness of their outputs.

This is especially useful for:

Features

  • Define Custom Tasks: Easily define evaluation tasks using a simple @kbench.task decorator.
  • Interact with Multiple LLMs: Programmatically interact with and compare various large language models.
  • Structured & Multimodal I/O: Go beyond plain text. Get structured dataclass or pydantic objects from models and provide image, audio, and video inputs.
  • Tool Use: Empower models with tools, including a built-in Python interpreter to execute code.
  • Robust Assertions: Use a rich set of built-in assertions or create your own to validate model outputs.
  • Dataset Evaluation: Run benchmarks over entire datasets (e.g., pandas DataFrames) to get aggregate performance metrics.

Getting Started

On Kaggle

The easiest way to use kaggle-benchmarks is directly within a Kaggle notebook.

Prerequisites: A Kaggle account.

Installation: No installation is needed! For early access, simply navigate to https://www.kaggle.com/benchmarks/tasks/new. This will create a new Kaggle notebook with the library and its dependencies pre-installed and ready to use.

Data Usage and Leaderboard Generation: When running in Kaggle notebook, each benchmark task outputs a task file and associated run files. These files are used to build the benchmark entity and display its results on a Kaggle leaderboard. An example can be seen on the ICML 2025 Experts Leaderboard.

Usage

Here is a simple example of a benchmark that asks a model a riddle and checks its answer.

import kaggle_benchmarks as kbench

@kbench.task(name="simple_riddle")
def solve_riddle(llm, riddle: str, answer: str):
    """Asks a riddle and checks for a keyword in the answer."""
    response = llm.prompt(riddle)

    # Assert that the model's response contains the answer, ignoring case.
    kbench.assertions.assert_contains_regex(
        f"(?i){answer}", response, expectation="LLM should give the right answer."
    )

# Execute the task
solve_riddle.run(
    llm=kbench.llm, # Uses the default LLM
    riddle="What gets wetter as it dries?",
    answer="Towel",
)

For a detailed walkthrough of the library's features, check out our documentation: - Quick Start Guide - User Guide - Cookbook

Supported Models

This library supports a wide range of models available through Kaggle's backend. The exact models available to you depend on your environment (Kaggle Notebook vs. local proxy token).

Contributing

Contributions are welcome! Please refer to our Contribution Guidelines for more details.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

Core symbols most depended-on inside this repo

prompt
called by 248
src/kaggle_benchmarks/actors/llms.py
run
called by 144
src/kaggle_benchmarks/tasks.py
append
called by 130
src/kaggle_benchmarks/chats.py
add_participant
called by 82
src/kaggle_benchmarks/rooms.py
send
called by 67
documentation/examples/play_doom.py
reply
called by 59
src/kaggle_benchmarks/rooms.py
post
called by 59
src/kaggle_benchmarks/rooms.py
evaluate
called by 48
src/kaggle_benchmarks/tasks.py

Shape

Function 824
Method 527
Class 189
Route 9

Languages

Python100%

Modules by API surface

tests/test_benchmarks.py65 symbols
golden_tests/test_cookbook_examples.py65 symbols
tests/test_console_ui.py64 symbols
tests/test_openai_client.py49 symbols
tests/test_chatroom.py42 symbols
src/kaggle_benchmarks/ui/panel.py41 symbols
tests/test_llm_chats.py33 symbols
tests/test_tool_loop.py31 symbols
tests/kaggle/test_serialization.py31 symbols
tests/test_user_secrets.py28 symbols
tests/kaggle/test_integration.py28 symbols
src/kaggle_benchmarks/content_types/images.py27 symbols

For agents

$ claude mcp add kaggle-benchmarks \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact