Skip to content

ClinKriya

ClinKriya bridges the critical gap between clinical AI capability and real-world EHR workflows by providing the first RL training environment built on FHIR — enabling small, deployable models to learn multi-step clinical

Core trick

Exposes a mock FHIR server as tool calls so GRPO-trained small models learn multi-step EHR tasks from reward on MedAgentBench scenarios.

Tags

Description

ClinKriya bridges the critical gap between clinical AI capability and real-world EHR workflows by providing the first RL training environment built on FHIR — enabling small, deployable models to learn multi-step clinical reasoning through trial and error, with the potential to reclaim thousands of physician hours lost to administrative burden.
ananya173147/clinKriya★ 00 forksPythonCreated Mar 8, 2026 · last push May 5, 2026

README excerpt

# clinKriya

Reinforcement learning framework for training LLM-based clinical agents on structured EHR tasks. Uses GRPO (Group Relative Policy Optimization) via TRL to train models that interact with a mock FHIR server through tool calls.

Built on top of [MedAgentBench](https://github.com/stanfordmlgroup/MedAgentBench) v1 and v2.

---

## Quick Start

```bash
pip install -e "medagentbench_env[train]"

# Run GRPO training (Qwen3-8B, SFT warmstart)
CUBLAS_DIR="$(pwd)/venv/lib/python3.12/site-packages/nvidia/cublas/lib"
nohup env LD_PRELOAD="$CUBLAS_DIR/libcublas.so.12:$CUBLAS_DIR/libcublasLt.so.12" \
  PYTORCH_ALLOC_CONF=expandable_segments:True \
  venv/bin/python -m medagentbench_env.train \
  --model Qwen/Qwen3-8B \
  --sft-adapter <path-to-sft-adapter> \
  --lora-rank 64 \
  --per-device-batch-size 4 \
  --num-generations 4 \
  --tasks-file medagentbench_env/data/clinkriya_train.json \
  --output-dir training/output_v31

# Eval a trained adapter on the held-out test set
venv/bin/python -m medagentbench_env.eval_checkpoints \
  --model Qwen/Qwen3-8B \
  --adapter training/output_v31 \
  --tasks-file medagentbench_env/data/clinkriya_test.json \
  --num-rollouts-per-task 4 \
  --output-dir training/eval/v31

# SFT warmstart
venv/bin/python -m medagentbench_env.train_sft \
  --model Qwen/Qwen3-8B \
  --lora-rank 64 \
  --output-dir training/sft_r64
```

---

## Dataset — clinKriya-Fair

554 tasks split into train/test with no overlap:

| Split | File | Tasks |
|-------|------|

Team