1 {
2 "Biomarkers_abbreviations" : [ "HbA1c" , "CRP" ] ,
3 "Biomarkers_full_name" : [ "Hemoglobin A1c" , "C-Reactive Protein" , "troponin I" ] ,
4 "All_biomarkers" : [ "HbA1c" , "Hemoglobin A1c" , "CRP" , "C-Reactive Protein" , "troponin I" ]
5 }
Qwen/Qwen3.5-0.8B
└── v1 (1K biomarker NER samples) → loss 1.645
└── v2 (1K GPT-120B-labeled samples, bf16) → loss 1.473
└── v2.1 (1K Nemotron-labeled, JSON output) → loss 0.951 ← THIS MODEL (BEST)
Method: LoRA (bf16, NOT 4-bit — per Unsloth Qwen3.5 guidelines)
LoRA rank: 16, alpha: 16
Learning rate: 1e-4 (cosine scheduler)
Batch size: 8 (gradient accumulation 2, effective 16)
Epochs: 3
Optimizer: adamw_8bit
Sequence length: 2048
Framework: Unsloth + TRL SFTTrainer
Hardware: NVIDIA RTX A6000 (48GB), ~11 minutes per round
Minimum inference: any GPU with 3GB+ VRAM
1 import json
2 from unsloth import FastLanguageModel
3 from transformers import AutoTokenizer
4 import torch
5
6 model , tokenizer = FastLanguageModel . from_pretrained (
7 model_name = "Shubh-0789/biomarker-qwen3.5-0.8b-lora-v2.1" ,
8 max_seq_length = 2048 ,
9 load_in_4bit = False ,
10 load_in_16bit = True ,
11 dtype = torch . bfloat16 ,
12 )
13 text_tokenizer = AutoTokenizer . from_pretrained ( "Shubh-0789/biomarker-qwen3.5-0.8b-lora-v2.1" )
14 FastLanguageModel . for_inference ( model )
15 model . generation_config . pad_token_id = text_tokenizer . pad_token_id
16
17 # Extract biomarkers
18 clinical_text = "The patient's HbA1c was 7.2%, C-Reactive Protein (CRP) levels elevated at 15mg/L, and troponin I was within normal range."
19
20 messages = [
21 { "role" : "user" , "content" : f"Extract all biomarker names from the following clinical text. Return ONLY a JSON.\nText: { clinical_text } " }
22 ]
23
24 inputs = text_tokenizer . apply_chat_template (
25 messages , tokenize = True , add_generation_prompt = True ,
26 return_tensors = "pt" , return_dict = True ,
27 ) . to ( model . device )
28
29 with torch . no_grad ( ) :
30 outputs = model . generate ( ** inputs , max_new_tokens = 256 , temperature = 0.1 , do_sample = True )
31
32 result = text_tokenizer . decode ( outputs [ 0 ] [ inputs [ "input_ids" ] . shape [ 1 ] : ] , skip_special_tokens = True )
33 biomarkers = json . loads ( result )
34 print ( json . dumps ( biomarkers , indent = 2 ) )
1 {
2 "Biomarkers_abbreviations" : [ "HbA1c" , "CRP" ] ,
3 "Biomarkers_full_name" : [ "Hemoglobin A1c" , "C-Reactive Protein" , "troponin I" ] ,
4 "All_biomarkers" : [ "HbA1c" , "Hemoglobin A1c" , "CRP" , "C-Reactive Protein" , "troponin I" ]
5 }
1 from peft import PeftModel
2 from transformers import AutoModelForCausalLM , AutoTokenizer
3
4 base_model = AutoModelForCausalLM . from_pretrained ( "Qwen/Qwen3.5-0.8B" , torch_dtype = "bfloat16" , device_map = "auto" )
5 model = PeftModel . from_pretrained ( base_model , "Shubh-0789/biomarker-qwen3.5-0.8b-lora-v2.1" )
6 tokenizer = AutoTokenizer . from_pretrained ( "Shubh-0789/biomarker-qwen3.5-0.8b-lora-v2.1" )
@misc{biomarker-qwen3.5-0.8b-lora-v2.1,
author = {Shubh-0789},
title = {Biomarker Extraction Model v2.1 — Best (Qwen3.5-0.8B LoRA, JSON output)},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/Shubh-0789/biomarker-qwen3.5-0.8b-lora-v2.1}
}