Dataset Viewer

The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.

Blood Pathology LIMS Environment

Blood Pathology LIMS Environment is an open clinical-agent benchmark that places a model inside a simulated hospital Laboratory Information Management System (LIMS). The agent must review pending pathology cases, inspect patient demographics, active medications, lab orders, current and previous lab results, reference ranges, and then submit an ICD-10-coded diagnostic report. The environment is designed to test whether a model can perform disciplined laboratory medicine reasoning instead of guessing a diagnosis from a short vignette.

The benchmark focuses on a problem that is especially difficult for general-purpose language models: laboratory values are not self-interpreting. A hemoglobin result can be normal or abnormal depending on pregnancy status. An INR value can mean different things depending on whether the patient is taking warfarin and why. Hyperkalemia can be a life-threatening emergency, a medication-related warning sign, or part of a broader multi-panel syndrome. This environment forces the agent to use context before diagnosis.

The runtime is small enough to inspect by hand, but structured enough to behave like a real clinical workflow. It uses an in-memory SQLite database, OpenEnv-compatible action and observation models, a FastAPI server, deterministic graders, dense process rewards, and optional trajectory capture for model evaluation or training-data generation.

Design Motivation

Most clinical AI benchmarks evaluate final-answer knowledge. They ask a model to select an option or name a diagnosis, then score whether the answer matches a key. That is useful for measuring recall, but it does not show whether the model can safely operate inside a clinical information system. A laboratory medicine agent must know what to inspect, which values require confirmation, what patient context changes the interpretation, when to flag critical values, and when a diagnosis is premature.

Blood Pathology LIMS Environment was built to expose those process failures. The agent is rewarded for meaningful investigative steps and penalized for dangerous shortcuts. It cannot get full credit by submitting an ICD code alone. It must interact with tools and produce a final diagnostic report that is supported by the evidence available in the simulated LIMS.

The benchmark also creates a clean environment for comparing model behavior. Each episode has a deterministic hidden grading rule, a bounded action space, structured observations, and a final score breakdown. That makes it useful for agent architecture work, evaluation of tool-use policies, prompt design, offline reinforcement learning, supervised fine-tuning from trajectories, and error analysis of clinical reasoning.

Dataset And Runtime Summary

  • Environment type: OpenEnv-compatible FastAPI environment.
  • Domain: blood pathology, laboratory medicine, clinical diagnostic reasoning.
  • Runtime state: in-memory SQLite LIMS database.
  • Patients: 25 total patients, including 9 target patients and 16 distractor patients.
  • Task variants: 8 clinical scenarios across 3 difficulty tiers.
  • Database tables: 8 relational tables covering patients, medications, lab orders, lab results, previous results, diagnostic reports, critical alerts, and pending cases.
  • Biomarkers: 40+ laboratory analytes and clinical chemistry markers.
  • Action tools: 9 LIMS tools exposed through structured commands.
  • Episode cap: 20 steps.
  • Scoring: deterministic, dense, bounded to the 0.01-0.99 range.
  • Outputs: step logs, final reward, score breakdown, and optional trajectory JSON files.
  • Compute: CPU-only server; no GPU is required to run the environment.

Runtime Architecture

The environment is built around a conventional laboratory workflow:

Model or agent policy
  -> structured JSON action
  -> OpenEnv/FastAPI server
  -> PathologyEnvironment.step(...)
  -> simulated LIMS database
  -> deterministic tool output and reward update
  -> final diagnostic report and score breakdown

The server exposes the environment over HTTP and WebSocket interfaces. The core pathology logic lives in server/pathology_env_environment.py. Data models are defined in models.py, the OpenEnv client wrapper is in client.py, and inference.py demonstrates how to connect an OpenAI-compatible chat-completions endpoint to the environment.

The environment is intentionally data-driven. Each reset creates a fresh in-memory database, seeds patient records and medications, randomly selects a scenario variant within the selected difficulty tier, inserts the relevant lab orders and results, and then exposes only the pending cases and tool outputs to the agent. The answer key remains inside the grader.

Episode Lifecycle

An episode follows this sequence:

  1. Reset: the environment creates a new episode ID, initializes the SQLite LIMS database, selects a task variant, and returns instructions plus the valid tool list.
  2. Case discovery: the agent usually starts with list_pending_cases to see which cases need review.
  3. Context gathering: the agent may call demographic, medication, lab order, lab result, previous-result, and reference-range tools.
  4. Critical-value handling: when clinically appropriate, the agent calls flag_critical_value.
  5. Diagnostic closure: the agent calls submit_diagnostic_report with patient ID, ICD-10 code, severity, and clinical notes.
  6. Grading: the deterministic grader computes the reward from investigation actions, critical flags, final ICD code, severity, and scenario-specific penalties.
  7. Breakdown: the final observation appends a human-readable score breakdown explaining what was done, what was missed, and why the score was assigned.

The episode ends when a diagnostic report is submitted or when the 20-step cap is reached.

Difficulty Tiers And Scenarios

The benchmark contains 8 implemented scenario variants.

Easy: Critical Value Identification

The easy tier tests whether the agent can detect a clear critical abnormality, flag it, and submit the appropriate diagnosis.

  • Hyperkalemia: patient 1001, potassium 7.2 mEq/L, expected diagnosis E87.5, expected severity CRITICAL.
  • Acute myocardial infarction: patient 1005, Troponin I 2.8 ng/mL, expected diagnosis I21.9 or close acute-MI codes, expected severity CRITICAL.
  • Severe anemia: patient 1006, hemoglobin 6.2 g/dL, iron-deficiency pattern, expected anemia diagnosis such as D64.9 or D50.9, expected severity CRITICAL.

These cases are not meant to be trivial pattern matching. The agent still needs to use the LIMS interface, identify the target patient among distractors, inspect lab results, and file the correct critical alert when required.

Medium: Context-Dependent Interpretation

The medium tier tests whether the model can avoid false positives by using demographics, medications, previous results, and therapeutic context.

  • Pregnancy-adjusted hemoglobin: patient 1002, hemoglobin 11.5 g/dL, pregnant at 28 weeks. This is normal under pregnancy-adjusted ranges. Expected diagnosis NORMAL, severity INFO. False-positive anemia is penalized.
  • Warfarin INR: patient 1007, mechanical heart valve, on warfarin, INR 4.8. The agent must interpret this as supratherapeutic anticoagulation rather than DIC. Expected diagnosis T45.515A or closely related anticoagulant adverse-effect code, severity WARNING.
  • Drug-induced hyperkalemia: patient 1008, CKD stage 3a, lisinopril plus potassium supplement, potassium 5.8 mEq/L. Expected diagnosis E87.5, severity WARNING, with reasoning that the elevation is medication-related and not above the critical threshold.

These scenarios are designed to catch models that diagnose solely from abnormal flags. The model must ask: abnormal relative to which patient, which medication context, and which historical baseline?

Hard: Multi-Panel Syndrome Recognition

The hard tier tests multi-panel synthesis. The agent must combine findings across multiple lab orders and avoid shallow single-abnormality diagnoses.

  • Disseminated intravascular coagulation (DIC): patient 1004, ICU sepsis context, CBC/coagulation/CMP panels, thrombocytopenia, prolonged PT/PTT, low fibrinogen, high D-dimer, and schistocytes. Expected diagnosis D65, severity CRITICAL.
  • Tumor lysis syndrome (TLS): patient 1009, lymphoma after chemotherapy, hyperuricemia, hyperphosphatemia, hypocalcemia, hyperkalemia, elevated LDH, and acute kidney injury. Expected diagnosis E88.3, severity CRITICAL.

The hard cases reward evidence integration. A model that only identifies sepsis, thrombocytopenia, kidney injury, or hyperkalemia receives partial or low credit because it missed the higher-order syndrome.

Patient And Data Design

The simulated LIMS includes 25 patients:

  • 9 target patients used by the eight scenario variants.
  • 16 distractor patients with their own demographics, medical histories, medications, and labs.

Target patients include diabetes and hypertension with ACE-inhibitor exposure, pregnancy, chest pain, ICU sepsis, severe anemia, warfarin anticoagulation, CKD with potassium supplementation, and lymphoma after chemotherapy. Distractors include routine wellness cases, controlled chronic conditions, anticoagulation monitoring, CKD/gout, carrier states, and benign screening panels.

The database schema is intentionally relational:

  • patients: demographics, sex, ethnicity, medical history, active diagnoses, and flags.
  • medications: active drug list, dose, route, and frequency.
  • lab_orders: panel identity, ordering clinician, date, and status.
  • lab_results: analyte, value, unit, flag, and collection time.
  • previous_results: historical values for delta checks.
  • diagnostic_reports: submitted ICD-coded diagnostic reports.
  • critical_alerts: filed critical-value alerts.
  • pending_cases: cases assigned to the AI agent.

This structure makes the environment more realistic than a flat JSON question. The agent has to navigate the clinical data surface.

Reference Ranges And Context

The environment contains reference ranges for common chemistry, hematology, coagulation, cardiac, lipid, thyroid, iron, urinalysis, enzyme, tumor-marker, and HbA1c values. Several ranges are context-sensitive:

  • Sex-specific ranges for red blood cell count, hemoglobin, hematocrit, creatinine, ferritin, uric acid, and HDL.
  • Pregnancy-adjusted hemoglobin range for pregnant female patients.
  • Therapeutic INR ranges for anticoagulated patients, including mechanical-valve context.
  • Critical low/high thresholds for selected dangerous values.

The query_reference_ranges tool is therefore not just a lookup table. It tests whether the agent can include patient context in the query and avoid using a generic adult range when a contextual range is required.

Action Space

The agent acts by emitting a PathologyAction object:

class PathologyAction(Action):
    command: str
    arguments: dict

Valid commands:

  • list_pending_cases: list cases assigned to the agent.
  • get_patient_demographics: retrieve age, sex, weight, ethnicity, history, active diagnoses, and flags.
  • get_medications: retrieve active medications for a patient.
  • get_lab_orders: list available lab panels for a patient.
  • get_lab_results: retrieve analyte-level values for a lab order.
  • get_previous_results: retrieve historical values for a patient, optionally filtered by analyte.
  • query_reference_ranges: retrieve context-adjusted reference information for an analyte.
  • flag_critical_value: file a critical-value alert.
  • submit_diagnostic_report: submit final patient ID, ICD-10 code, severity, and clinical notes.

The server validates each command and returns a structured observation. Invalid commands or missing records return explicit errors rather than crashing the environment.

Observation Space

The agent receives a PathologyObservation:

class PathologyObservation(Observation):
    output: str
    error: str

Tool output is JSON or structured text. The final observation includes a score breakdown with the scenario name, step count, investigation checklist, critical flags, submitted diagnosis, expected diagnosis, expected severity, and final score.

Reward Design

Rewards are deterministic and scenario-specific. Every grader starts from a small participation credit, then adds or subtracts points based on what the agent did.

Reward components include:

  • relevant demographic lookup;
  • medication lookup when medication context matters;
  • lab-result retrieval;
  • previous-result retrieval for trend or delta interpretation;
  • reference-range lookup when clinical thresholds matter;
  • correct critical-value flagging;
  • correct ICD-10 code or clinically close alternate;
  • correct severity level;
  • penalties for dangerous false positives or wrong diagnostic category.

Scores are bounded between 0.01 and 0.99. The ceiling avoids pretending that a simulated environment provides absolute clinical certainty, while the floor keeps failed trajectories analyzable.

Deterministic Grading Details

The graders are intentionally transparent and inspectable in server/pathology_env_environment.py.

Examples:

  • The hyperkalemia case rewards demographics, medications, potassium reference lookup, lab-result inspection, correct potassium critical alert, E87.5, and CRITICAL.
  • The pregnancy hemoglobin case gives meaningful credit for seeing the pregnancy flag and querying hemoglobin ranges with pregnancy context. It penalizes false critical hemoglobin alerts and false anemia diagnoses.
  • The warfarin INR case gives extra weight to medication lookup, because the diagnosis depends on recognizing therapeutic anticoagulation.
  • The DIC case requires multi-panel retrieval and rewards critical flags for platelets, fibrinogen, and D-dimer.
  • The TLS case rewards recognition of the full metabolic syndrome rather than isolated hyperkalemia, AKI, or hyperuricemia.

This design supports step-level failure analysis. If a model gets a low score, the final breakdown shows whether it failed because it skipped labs, ignored medication context, missed previous results, filed the wrong alert, or submitted the wrong diagnosis.

Anti-Shortcut Properties

The benchmark includes several safeguards against shallow behavior:

  • Distractor cases: the agent must identify which pending case matters.
  • Neutral case descriptions: task descriptions avoid giving away the final diagnosis.
  • Context traps: pregnancy hemoglobin and warfarin INR punish generic threshold interpretation.
  • Medication dependencies: drug-lab interactions matter for medium tasks.
  • Delta checks: previous values can distinguish acute change from baseline abnormality.
  • Multi-panel hard cases: DIC and TLS cannot be diagnosed properly from one analyte.
  • False-positive penalties: overcalling anemia, DIC, or critical severity can reduce score.

The goal is not to reward verbosity. The goal is to reward the clinical process needed to make the diagnosis defensible.

Local Usage

Start the environment server

Using Docker:

docker build -t pathology_env_env:latest .
docker run --rm -p 8000:8000 -e TASK_LEVEL=easy pathology_env_env:latest

Using Python/uv:

uv sync
uv run server

Health check:

curl http://localhost:8000/health

The root page provides a compact web landing page, and the OpenEnv web interface is available through the server when enabled.

Run a model through the benchmark

inference.py connects the environment to any OpenAI-compatible chat-completions endpoint.

export API_KEY="your_provider_or_router_token"
export API_BASE_URL="https://router.huggingface.co/v1"
export MODEL_NAME="provider/model-name"
python inference.py

By default, the script runs all three difficulty levels in sequence: easy, medium, and hard. It prints bracketed benchmark logs:

[START] task=easy env=pathology_env model=...
[STEP] step=1 action=list_pending_cases reward=0.01 done=false error=null
[END] success=true steps=... score=... rewards=...

It writes newly generated trajectory JSON files to a local trajectories/ directory in the working copy. No prior model traces or baseline scores are bundled with this dataset package; each user should generate fresh traces with their own model, prompt, endpoint, and decoding settings.

Run without an external model

For environment integrity checks, use the deterministic grader tests:

python test_graders.py

The test script simulates perfect actions for all 8 scenario variants and verifies that wrong-answer cases are penalized.

API Surface

The FastAPI/OpenEnv server exposes standard environment endpoints through the OpenEnv runtime, including reset, step, state, schema, health, and WebSocket session support. The action contract is defined by PathologyAction, and the observation contract is defined by PathologyObservation.

Programmatic users can interact through client.py:

from client import PathologyEnv
from models import PathologyAction

env = PathologyEnv("http://localhost:8000")
env.reset()
result = env.step(PathologyAction(command="list_pending_cases", arguments={}))
print(result.observation.output)

Project Structure

.
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ README.md
β”œβ”€β”€ client.py
β”œβ”€β”€ inference.py
β”œβ”€β”€ models.py
β”œβ”€β”€ openenv.yaml
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ app.py
β”‚   β”œβ”€β”€ pathology_env_environment.py
β”‚   └── requirements.txt
β”œβ”€β”€ test_graders.py
└── test_all_llm.py

Important files:

  • server/pathology_env_environment.py: core environment, database seeding, tools, scenario variants, and graders.
  • server/app.py: FastAPI/OpenEnv app and landing page.
  • models.py: Pydantic action and observation models.
  • client.py: OpenEnv client adapter.
  • inference.py: OpenAI-compatible model runner and trajectory logger.
  • test_graders.py: deterministic validation of the grading rules.
  • openenv.yaml: OpenEnv metadata.

Training And Evaluation Uses

This environment can support several research workflows:

  • Agent benchmark evaluation: compare how models navigate laboratory tasks under identical hidden grading rules.
  • Tool-use policy analysis: study whether a model calls the right tools before diagnosis.
  • Clinical safety testing: expose false positives, missed critical values, medication-blind interpretations, and incomplete workups.
  • Process-supervision datasets: use step-level rewards and final score breakdowns to build supervised or preference-style data.
  • Offline reinforcement learning: collect trajectories, weight actions by reward, and train policies to improve diagnostic process quality.
  • Medical education prototypes: show learners how systematic workup affects the final diagnostic score.

The most useful signal is often not the final score alone. The trajectory tells whether the model failed from missing demographics, missing medications, weak lab-order exploration, skipped historical results, inadequate reference-range use, wrong alerting, or an incorrect final ICD code.

Limitations

This is a synthetic benchmark environment, not a clinical decision-support tool. It should not be used for patient care. The cases, lab values, answer keys, and reward functions are designed for model evaluation and training research. They are clinically motivated, but they do not replace physician review, laboratory medicine expertise, prospective validation, or safety testing in real clinical systems.

The benchmark currently covers a focused slice of blood pathology. It includes 8 scenario variants, not the full scope of clinical pathology. It tests structured reasoning under known rules rather than free-form real-world uncertainty. Its grading rules are deterministic by design, which is valuable for reproducible benchmarking but necessarily simplifies clinical judgment.

This package intentionally does not include precomputed model scores. Results should be generated against the current environment with the evaluator's chosen model, prompt, endpoint, and decoding settings.

Developer & Architect

Blood Pathology LIMS Environment was built by Yatin Taneja as part of a broader effort to create open, inspectable environments for evaluating autonomous agents in domains where reasoning quality matters. I built this benchmark to test whether a model can behave like a careful laboratory medicine assistant: gather the right evidence, apply patient-specific context, avoid false positives, recognize critical values, and close the loop with a structured diagnostic report.

Weblinks

IM Superintelligence: Visit my central knowledge hub hosting other open datasets and over 2,000 articles exploring Superintelligence, cognitive architectures, quantum computing, distributed networks, and the future of the global education sector, authored through a custom 8-step multi-model agentic infrastructure.

Yatin Taneja | Professional Portfolio: View my professional portfolio for a comprehensive overview of my skills, industry experience, and software prototypes.

LinkedIn: Connect to collaborate on advanced autonomous systems, enterprise AI implementations, or to follow my ongoing research.

Downloads last month
72