Literature · Rumiii
Trion 8B-FHIR R4
A fine-tuned 8-billion-parameter language model for multi-turn FHIR R4 clinical tool calling.
What Trion 8B-FHIR R4 is
Trion 8B-FHIR R4 is a specialised medical language model developed by Rumiii, adapted from Meta's Llama-3.1-8B-Instruct. It is built to carry out multi-turn clinical tool calling over Fast Healthcare Interoperability Resources (FHIR) R4 application programming interfaces (APIs). When presented with a clinical instruction, the model determines a sequence of structured actions—such as patient identification, laboratory value queries, vital signs logging, medication orders, and service requests—and concludes with a final structured response.
The model addresses efficiency issues encountered when training language models on raw FHIR documentation and responses. Standard FHIR resources and documentation payloads contain substantial boilerplate that easily exhausts language model context windows. Trion 8B-FHIR R4 was trained using condensed tool response representations and standard JSON tool-calling templates to enable multi-step electronic health record (EHR) workflows within manageable sequence limits.
Designed primarily for research, pipeline development, and clinical workflow prototyping, the model demonstrates how conversational agents can interface with standardised healthcare data structures using standard open-weights architectures.
How it works
The model is fine-tuned from unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit using Quantised Low-Rank Adaptation (QLoRA) with 4-bit base weights, target modules across all projection layers, a rank of 16, and an alpha of 32 (amounting to 41,943,040 trainable parameters). The final weights are merged to 16-bit floating point (fp16). It was trained over three epochs using Unsloth and Hugging Face's Trainer with an effective batch size of 16, the 8-bit AdamW optimiser, and a maximum sequence length of 3,072 tokens.
Training utilized the Nadhari/MedToolCalling dataset, containing 284 multi-turn conversations across 10 clinical task categories. Rather than consuming verbose FHIR resources, tool outputs were systematically compressed to essential clinical fields (reducing payloads from thousands of tokens to approximately 50 tokens), and actions were converted to native Llama 3.1 JSON tool calls across a fixed set of six functions: search_patient, get_observation, record_vital_sign, order_medication, order_service_request, and finish. Response-only loss masking ensured gradient updates were calculated solely on assistant tool-call tokens.
Key facts
- Base architecture
- Llama-3.1-8B-Instruct
- Parameter count
- 8 billion (41,943,040 trainable LoRA parameters)
- Fine-tuning method
- QLoRA (4-bit base, merged to fp16)
- Training dataset
- Nadhari/MedToolCalling (284 examples, 10 clinical task types)
- Maximum sequence length
- 3,072 tokens
- Tool schema size
- 6 fixed callable functions
- Output format
- Native Llama 3.1 JSON tool calls
What you can use it for
- Patient Lookup and Identification
- Executing multi-parameter searches for patient records using given name, family name, and date of birth to retrieve Medical Record Numbers (MRNs).
- Observation and Laboratory Queries
- Interrogating FHIR Observation resources using LOINC codes or categories to retrieve vital signs, blood glucose levels, magnesium, potassium, or HbA1c values.
- Vital Sign Logging
- Formatting structured requests to record newly obtained clinical measurements, such as blood pressure observations, directly into an EHR system.
- Clinical Order Generation
- Chaining lab retrieval with conditional ordering logic to issue MedicationRequest orders (such as intravenous magnesium replacement) or ServiceRequest referral orders.
Run it here
We list this model but cannot run it yet: its first test run here did not return a result, so it is tried again in a week.
Everything on this page still applies. Running it needs a loader for this repository, not a bigger machine.
Strengths and limits
Good at
- Generated syntactically valid tool-calling formats across 100% of the 1,100 evaluated synthetic benchmark episodes.
- Exhibits high accuracy (90% to 100%) in basic EHR interactions, such as patient lookup, age calculation, blood pressure recording, and orthopedic referrals.
- Uses native JSON tool-calling templates, functioning as a direct drop-in for standard Transformers chat template pipelines.
- Eliminates sequence truncation during training by heavily compressing verbose FHIR JSON payloads down to essential clinical fields.
Watch out for
- For research use only: it is not a medical device and must not be used for diagnosis, treatment or any clinical decision.
- Not validated for safety, diagnostic accuracy, or reliability, and strictly unsuitable for real clinical decision support.
- Demonstrates poor accuracy on tasks requiring temporal averaging or complex conditions, such as calculating 24-hour average blood glucose (7%) or conditional HbA1c orders (26%).
- Restricted to a fixed schema of six pre-defined functions and does not generalise well to novel tools or unseen clinical task combinations (dropping to 38% accuracy).
- Expects compressed tool inputs, meaning it may perform unpredictably if exposed to raw, uncompressed FHIR resource payloads at inference time.
Inputs and outputs
You provide
Prompt
The model continues from here.
You get back
The model's completion.
Licence
Check the licence before commercial use · apache-2.0
The apache-2.0 licence carries terms worth reading before you depend on it.
Questions
Can I use Trion 8B-FHIR R4 commercially?
Check the licence before commercial use. The apache-2.0 licence carries terms worth reading before you depend on it.
What tools can Trion 8B-FHIR R4 call?
It is trained on six predefined functions: search_patient, get_observation, record_vital_sign, order_medication, order_service_request, and finish.
How well does the model generalise to new clinical tasks?
Generalisation to unfamiliar workflows is limited; it achieved 61.9% accuracy on its 10 core task types but dropped to 38% on unseen scenarios, including 20% on average magnesium calculations.
Does the model require raw FHIR JSON inputs during inference?
No. The model was specifically trained on compressed representations of FHIR resources (e.g. key patient and observation values) rather than full multi-thousand-token FHIR JSON bundles, and may fail if fed unabridged payloads.
Can this model be deployed in active hospital settings?
No. It is an experimental research model trained on synthetic data and 284 training conversations; it is explicitly not validated for clinical use.
How to cite it
@misc{trion8bfhirr4, title = {Trion-8B-FHIR-R4: A Llama-3.1-8B Tool-Calling Model for FHIR R4 Clinical Workflows}, author = {Rumi}, year = {2026}, url = {https://huggingface.co/Rumiii/Trion_8B-FHIR_R4}}
Written from Trion 8B-FHIR R4's own documentation (model card). Statements citing a figure that does not appear there are removed before publication. Licence and running details come from our registry.
