Add Harbor sandbox integration for on-demand PhantomWiki eval - #309
Open
anmolkabra wants to merge 1 commit into
Open
Add Harbor sandbox integration for on-demand PhantomWiki eval#309anmolkabra wants to merge 1 commit into
anmolkabra wants to merge 1 commit into
Conversation
Ship PhantomWiki as a one-command, Dockerized LLM evaluation via the Harbor framework, so the community can run fresh, contamination-resistant evals without installing SWI-Prolog, phantom-wiki, or phantom_eval locally. - adapters/phantom-wiki: a pure-Python Harbor adapter that stamps N tasks (one per question) for a freshly-seeded universe. Generation is deferred into each task's Docker build, so the host only needs Docker + Harbor. - Agent (environment/) image exposes only the article corpus + the question; the Prolog DB and gold answers are stripped so the agent cannot cheat. - A separate verifier image (environment_mode = "separate", built from tests/) regenerates the same universe to hold the gold, reads the agent's /logs/artifacts/answer.txt, and scores set-based F1 (mean F1 across tasks), emitting per-question difficulty to /logs/verifier/result.json. - diagnostics/plot_difficulty.py turns those results into F1-vs-difficulty and F1-by-type plots. - tests/harbor: unit tests for the selector, scorer, and adapter, plus a determinism self-test (gated on Prolog) guaranteeing the two generations produce the identical universe. https://claude.ai/code/session_019t4Xt48jUEATKWG9A17UTa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
PhantomWiki's whole argument is on-demand, contamination-resistant evaluation — yet adopting it today means installing SWI-Prolog, the
phantom-wikipackage, running the CLI, then learningphantom_eval. The friction pushes people toward the static HuggingFace splits (which defeats the purpose).This PR ships PhantomWiki as a one-command, fully-Dockerized evaluation via the Harbor framework. A researcher needs only Docker +
pip install harbor; every run generates a fresh universe inside the containers and evaluates a frontier model on it.How it works
environment/andtests/Dockerfiles install Prolog +phantom-wikiand runpw-generate.[verifier] environment_mode = "separate"): a second image, built fromtests/, regenerates the same universe to hold the gold. Harbor forwards the agent's/logs/artifacts/into it for scoring.phantom-wiki+ seed (single-threaded), so the corpus the agent sees and the gold the verifier scores match. Covered by a determinism self-test.Usage
Once registered (
adapters/phantom-wiki/dataset.toml), this collapses to a singleharbor run -d phantom-wiki@1 -a terminus-2 -m <model>.What's included
harbor/adapters/phantom-wiki/— adapter (adapter.py/run_adapter.py), tasktemplate/, shared in-containerselect_question.py+score_answer.py,dataset.toml.harbor/diagnostics/plot_difficulty.py— F1-vs-difficulty + F1-by-type plots from the run logs.tests/harbor/— unit tests for the selector, scorer, and adapter (18 passing), plus a determinism self-test (auto-skipped where Prolog isn't installed). Lint-clean under the repo's black/isort/flake8 config.I authored this against the public Harbor docs but could not run Harbor/Docker end-to-end in the build sandbox, so please confirm during review:
environment_mode = "separate"builds the grading image from the task'stests/dir. If your Harbor expects a prebuilt[verifier.environment].docker_image, the adapter candocker build --tagit instead./logs/artifacts/into the separate verifier container. If the path/declaration differs, adjustinstruction.md+tests/test.sh.A no-code-change fallback exists if separate-verifier plumbing isn't available:
environment_mode = "shared"withtest.shitself re-runningpw-generate --seed $SEEDto recover the gold after the agent finishes (the determinism test guarantees it matches). Documented inharbor/README.md.https://claude.ai/code/session_019t4Xt48jUEATKWG9A17UTa
Generated by Claude Code