Downloads · 30 days
12
10% of all-time downloads
philka-ua/mistral-instruct-finetuned-iee_v0-4bit
mistral-instruct-finetuned-iee_v0-4bit is a text generation model from philka-ua. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
Author: Vitalii Filipov · Created: October 2023 · Status: research prototype, not for clinical use
Downloads · 30 days
12
10% of all-time downloads
All-time downloads
122
Public
Repo size
218 MB
Likes
0
Public
Click a slice to open those files.
.bin218 MB · 99%
From the Hugging Face model README
Author: Vitalii Filipov · Created: October 2023 · Status: research prototype, not for clinical use
A LoRA adapter for mistralai/Mistral-7B-Instruct-v0.1, trained on a 4-bit quantized base model (QLoRA-style).
It is a local, simplified prototype of a QA step from a production clinical NLP system for patient chats. In production, this QA logic runs as an agentic workflow on OpenAI, Anthropic and Google models through their APIs. The workflow checks two things:
The adapter tested whether an open-source 7B model, run locally, could take over part of this check.
Task: given a system question, the patient's answer and the system's interpretation, return a structured verdict: is the interpretation supported by the answer, and is a clarifying question needed.
| Item | Value |
|---|---|
| Base model | mistralai/Mistral-7B-Instruct-v0.1 |
| Method | LoRA (PEFT) on a 4-bit quantized base |
| LoRA | r = 64, alpha = 16, dropout = 0.1, target modules: q_proj, k_proj, v_proj, o_proj, bias = none |
| Quantization (bitsandbytes) | load_in_4bit = True, quant type = fp4, double quantization = off, compute dtype = float32 |
| Framework | PEFT 0.6.0.dev0, Transformers, bitsandbytes |
| Training data | De-identified patient-chat examples (question, answer, interpretation, verdict). The exact dataset size was not recorded. No patient data is published in this repository |
Not formally evaluated. This was an exploratory prototype used to compare a local open-source model with the API-based workflow.
The production QA workflow (API-based) is evaluated separately against doctor-verified reference data. In production it reduced final-output errors by about 25-30% compared with the system without the QA step; the effect varies with case mix.
Input
System question: How many times a day do you take metformin now?
Patient answer: same as before
Interpretation: {"medication": "metformin", "frequency": "2 times/day"}
Output
{"verdict": "needs_clarification",
"reason": "context-dependent answer; frequency is not stated in the answer and was inferred",
"follow_up": "Could you tell me how many times a day you take metformin now?"}
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
base_id = "mistralai/Mistral-7B-Instruct-v0.1"
adapter_id = "philka-ua/mistral-instruct-finetuned-iee_v0-4bit"
bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="fp4",
bnb_4bit_compute_dtype=torch.float32)
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base = AutoModelForCausalLM.from_pretrained(base_id, quantization_config=bnb, device_map="auto")
model = PeftModel.from_pretrained(base, adapter_id)