BP Monitoring LLM - LoRA Adapters

Fine-tuned LoRA adapters for blood pressure monitoring and medical advice.

Model Description

These are LoRA (Low-Rank Adaptation) adapters fine-tuned on top of mistralai/Mistral-7B-Instruct-v0.3 for intelligent blood pressure monitoring tasks.

Base Model: mistralai/Mistral-7B-Instruct-v0.3
Fine-tuning Method: QLoRA (4-bit quantization + LoRA)
LoRA Rank: 16
LoRA Alpha: 32
Target Modules: All attention and MLP layers

Capabilities

  1. Voice Input Parsing: Extract BP readings from natural language

    • "My BP is 130 over 85" → {systolic: 130, diastolic: 85}
  2. BP Classification: Categorize readings according to AHA guidelines

    • Provides category, explanation, and recommendations
  3. Medical Advice: Answer questions with reasoning

    • Asks for missing information instead of assuming
    • Grounds advice in provided context
    • Always includes medical disclaimers
  4. Trend Analysis: Interpret historical BP patterns

    • Analyzes actual data trends
    • Identifies variability and patterns
  5. Lifestyle Simulations: Evidence-based projections

    • Reasons from research, not hardcoded numbers
    • Explains caveats and individual variation

Usage

Loading the Model

from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
import torch

# Load base model with 4-bit quantization
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16,
)

base_model = AutoModelForCausalLM.from_pretrained(
    "mistralai/Mistral-7B-Instruct-v0.3",
    quantization_config=bnb_config,
    device_map="auto",
)

# Load LoRA adapters
model = PeftModel.from_pretrained(
    base_model,
    "TesterColab/Mistral-BP-LLMV5",
)

tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.3")

Using the BP Assistant

from bp_assistant import BPAssistant

# Initialize (will download adapters automatically)
assistant = BPAssistant(
    model_path="TesterColab/Mistral-BP-LLMV5",
    base_model="mistralai/Mistral-7B-Instruct-v0.3",
)

# Parse voice input
result = assistant.parse_voice_input("My BP is 135 over 88")
print(result)
# {'systolic': 135, 'diastolic': 88, 'extracted': True}

# Quick check
check = assistant.quick_check(135, 88)
print(check['spoken_message'])
# "Your blood pressure is 135 over 88, which is elevated..."

# Get medical advice
advice = assistant.get_medical_advice(
    "What should I do about my high blood pressure?",
    context="Current BP: 145/92"
)
print(advice)

Training Details

Dataset: Synthetic doctor-patient conversations generated from MIMIC-BP dataset

  • ~3,000-5,000 training examples
  • Covers voice parsing, classification, medical Q&A, trend analysis, simulations

Training Configuration:

  • Learning Rate: 2e-4
  • Batch Size: 4 (per device)
  • Gradient Accumulation: 4 steps
  • Epochs: 3
  • Scheduler: Cosine with warmup
  • Precision: BFloat16

Hardware: Trained on RTX 4090 / A6000 / A100

Key Features

No Hallucinations

The model is trained to:

  • Ask for missing information instead of assuming
  • Ground all advice in provided context
  • Refuse to make predictions without baseline data
  • Explain reasoning and caveats

Natural Conversation

  • Varied response styles (not templated)
  • Empathetic and conversational tone
  • Asks follow-up questions
  • Sounds like a real doctor

Medical Safety

  • Always includes disclaimers
  • Recommends consulting healthcare providers
  • Detects emergency situations (BP >180/120)
  • Warns against stopping medications

Limitations

⚠️ Important: This model is for educational and informational purposes only.

  • NOT a substitute for professional medical advice
  • Cannot diagnose conditions
  • Cannot prescribe medications
  • Individual results from lifestyle changes vary
  • Always consult qualified healthcare providers

Files

  • adapter_config.json: LoRA configuration
  • adapter_model.safetensors: LoRA weights (small file, ~100MB)
  • README.md: This file

Citation

@misc{bp_monitoring_lora,
  title={BP Monitoring LLM - LoRA Adapters},
  author={Your Name},
  year={2024},
  publisher={Hugging Face},
  url={https://huggingface.co/TesterColab/Mistral-BP-LLMV5}
}

License

MIT License

Downloads last month
8
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for TesterColab/Mistral-BP-LLMV5

Adapter
(888)
this model