ruby56/Citation-Benchmark
Citation-Agent: OpenEnv Peer Review Benchmark
Citation-Agent is an OpenEnv-compliant environment for evaluating LLM agents as Academic Peer Reviewers.
Given a Target Paper Abstract, the agent must parse the text, navigate the SQLite research database to traverse its citation graph, and read contextual intents from citing papers. If the citations validate the abstract conceptually, the agent must ACCEPT the paper. If the citations contradict the abstract (indicating a hallucination or decoy task), the agent must REJECT it.
The Challenge
Most agent benchmarks focus on web scraping or bash terminal navigation. This environment tests an agent's ability to reason over complex scholarly graphs. The agent must:
- Differentiate between ArXiv IDs and Semantic Scholar Corpus IDs.
- Follow citation intents.
- Run SQL-backed queries to find core papers.
- Avoid getting stuck in infinite search loops.
How to Run
Option 1: Running Locally (Recommended)
- Install Dependencies: Requires Python 3.10+.
pip install -r requirements.txt- Set Environment Variables: We use the Hugging Face Router with the
google/gemma-4-31B-itmodel. - PowerShell:
$env:HF_TOKEN="your_huggingface_api_key"
$env:MODEL_NAME="google/gemma-4-31B-it"
$env:API_BASE_URL="https://router.huggingface.co/v1"- Bash/Zsh:
export HF_TOKEN="your_huggingface_api_key"
export MODEL_NAME="google/gemma-4-31B-it"
export API_BASE_URL="https://router.huggingface.co/v1"- Run the Inference Script:
python inference.pyThis runs the agent through the 50 tasks and outputs the final scores.
Option 2: Running via Docker (Hugging Face Spaces validation)
To test if your environment works with the automated Hugging Face Spaces pipeline:
docker build -t citation-agent .
docker run --env HF_TOKEN="your_token" --env MODEL_NAME="google/gemma-4-31B-it" --env API_BASE_URL="https://router.huggingface.co/v1" citation-agentOpenEnv Compliance Checklist
- Real-world task: Accurately simulates literature review and academic source verification.
- OpenEnv Spec Compliance:
- Contains a valid
openenv.yaml. environment.pyuses Pydantic Models (Observation,Action,Reward) and implements the requiredreset(),state(), andstep(action)methods.- Observation Space: JSON containing
current_claim,search_results,last_abstract,citations_data,message, andstep_count. - Action Space:
action_type(search,read_abstract,get_citations,submit),query, andpaper_id. - 50 Distinct Tasks with Graders:
tasks.pyloads 50 distinct Easy, Medium, and Hard tasks from the SQLite database.- Includes a deterministic
Graderclass that checks the submittedpaper_idagainst the ground truth. - Database Architecture:
- To stay under the 1GB limit for free HF Spaces,
environment.pyuseshuggingface-hubto automatically pull thecitation_db.sqlitedatabase from theruby56/Citation-Databasedataset on startup. - Continuous Reward Function:
- Uses dense shaping. The agent gets a -0.05 step penalty to encourage efficiency, and -0.1 to -0.2 penalties for formatting errors. It gets the final grader score (+1.0 max) on submit.
- Inference Script Auto-Retry:
- Uses the OpenAI Python client pointed at HF Serverless endpoints. Implements basic exponential backoff to handle HTTP 429 rate limits safely without crashing the evaluation loop.
- Production Dockerfile:
- Standard Dockerfile that installs dependencies and runs
inference.pydirectly.
