はじめに
七尾百合子さん、お誕生日 27日目 おめでとうございます! nikkieです。
皆さん、AISIのInspectって聞いたことありますか?
目次
OpenAI PaperBenchの実装を見ていて知る
We’re releasing PaperBench, a benchmark evaluating the ability of AI agents to replicate state-of-the-art AI research, as part of our Preparedness Framework.
— OpenAI (@OpenAI) 2025年4月2日
Agents must replicate top ICML 2024 papers, including understanding the paper, writing code, and executing experiments. pic.twitter.com/CvYcDdk0nI
F.1. BasicAgent より
Our agent scaffold is a basic ReAct (Yao et al., 2023) agent architecture that runs a tool use loop until the agent runs out of steps or time.
It is based on Inspect AI’s basic agent (UK AI Safety Institute, 2025) with the following changes:
いきなりInspectのReAct Agentを理解できなかったので、地歩を固めることにしました。
Inspect AIのHello World
やっていることは以下と同じです

環境構築
https://inspect.aisi.org.uk/#getting-started
仮想環境を人力で作り、そこに必要なライブラリを入れています。
% python3.12 -m venv .venv % source .venv/bin/activate (.venv) % python -m pip install inspect-ai openai
- Python 3.12.8
- inspect_ai 0.3.88
- openai 1.73.0
環境変数OPENAI_API_KEYを設定して
(.venv) % inspect eval hello_world.py --model openai/gpt-4o ╭─ hello_world (1 sample): openai/gpt-4o ────────────────────────────────────────────────────────╮ │ dataset: (samples) │ │ │ │ total time: 0:00:02 │ │ openai/gpt-4o 15 tokens [I: 12, CW: 0, CR: 0, O: 3, R: 0] │ │ │ │ mean: 1.0 stderr: 0 │ │ │ │ Log: logs/2025-04-13T17-13-08+09-00_hello-world_FGZezVoQKLrJj42XdUj2Jw.eval │ ╰────────────────────────────────────────────────────────────────────────────────────────────────╯
Taskという概念
Taskでdataset, solver, scorerを束ねます。
https://inspect.aisi.org.uk/#sec-hello-inspect
@task def hello_world(): return Task( dataset=[ Sample( input="Just reply with Hello World", target="Hello World", ) ], solver=[generate()], scorer=exact(), )
- Hello Worldでは、datasetは1件
- SampleのinputがLLMへの入力
- Sampleのtargetが理想の出力
- ref: https://inspect.aisi.org.uk/datasets.html#dataset-samples
- solverはLLMの部分で、うまく抽象化されていると思います
generate()は、LLMで出力を生成します- ref: https://inspect.aisi.org.uk/solvers.html#solver-function
- scorerは、solver(LLM)の出力を評価します
exact()は文字列が完全一致するかどうかを評価します- ref: https://inspect.aisi.org.uk/scorers.html#built-in-scorers
上の実行結果は、GPT-4o(solver)はinput「Just reply with Hello World」に対して「Hello World」と返して、targetと完全一致したということですね。
実行時のログが見られる
(.venv) % inspect view
http://127.0.0.1:7575 をブラウザで開くと

トレースが見られて便利です。
GPT-4oはちゃんと「Hello World」と返していました(ASSISTANTのところ)
落穂拾い
VS Code拡張
インストールするとinspect viewしなくてもlogファイルをviewerで見れたり、VS CodeのUI操作でinspect evalできます。
ただし、「Python: Select Interpreter」でinspect-aiがインストールされた環境を指定する必要があります。
Taskを別のLLMで実行できる
再び https://inspect.aisi.org.uk/#getting-started によると
- anthropicをインストールすれば、TaskをClaudeで実行でき
- google-genaiをインストールすれば、TaskをGeminiで実行できます
Taskを一度定義したら、それを任意のLLMで実行して結果を比較できるわけですね!
ここでuvを投入します。
% uvx --from inspect-ai --with anthropic inspect eval hello_world.py --model anthropic/claude-3-5-sonnet-latest % uvx --from inspect-ai --with google-genai inspect eval hello_world.py --model google/gemini-2.0-flash
Pythonスクリプトにもできる
https://inspect.aisi.org.uk/#eval-from-python より
examples/hello_world.pyの末尾に追加してもよいです
if __name__ == "__main__": from inspect_ai import eval eval(hello_world(), model="openai/gpt-4o")
この場合、PEP 723 inline script metadataを使って、uv(など)で実行できますね
https://gist.github.com/ftnext/3d3877329e1df2b8d3ed8198b7036846
% uv run hello_world.py
終わりに
英国のAISIによるinspect-aiのHello Worldをしました。
Task, dataset, solver, scorerという概念に最初の学習コストが必要ですが、そこを越えた身からするとこれはなかなかよいライブラリではないかと思います(OpenAIでも採用実績ありますし)。
さすが、エミリーちゃんの国👏
エミリーちゃんの国のAI Security Institute (AISI)が作ったInspect AIというライブラリを触ってみています。
— nikkie(にっきー) / にっP (@ftnext) 2025年4月13日
>An open-source framework for large language model evaluationshttps://t.co/3LUo9grikF
task, dataset, solver, scorerを押さえると、なかなかいい感じでは(さすがエミリーちゃんの国