Downloads · 30 days
0
drguilhermeapolinario/gemma3-1b_med_reasoning
gemma3-1b_med_reasoning is a machine learning model from drguilhermeapolinario. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as gemma.
Developed by: Rhaymison - Medicine Information PT Adaptation Model type: Fine-tuned Large Language Model with explicit reasoning format Language(s): Portuguese License: Same as base model (Google Gemma license) Finetu…
Downloads · 30 days
0
Access
Public
Updated Mar 22, 2025
Repo size
51.2 MB
Likes
0
Public
Click a slice to open those files.
.json34.5 MB · 66%
From the Hugging Face model README
This model is specifically designed to answer medical questions in Portuguese with a structured reasoning approach. The dataset was specifically modified to include reasoning components, training the model to explicitly show its thought process. It first provides its analysis and reasoning process, then delivers a clear answer. The model follows a specific format:
<start_working_out>
[Detailed reasoning and analysis about the medical question]
</end_working_out>
<SOLUTION>
[Clear and concise medical answer]
</SOLUTION>
This format makes the model's reasoning transparent, allowing users to understand how it arrived at its conclusions.
The model can be integrated into:
This model should NOT be used for:
# !pip install unsloth git+https://github.com/huggingface/[email protected] -q
from unsloth import FastModel
import torch
# Modelo base Unsloth
base_model, tokenizer = FastModel.from_pretrained(
model_name="unsloth/gemma-3-1b-it-unsloth-bnb-4bit",
max_seq_length=1024,
load_in_4bit=True, # Atenção: usar a mesma quantização
)
# Adaptadores
from peft import PeftModel
model = PeftModel.from_pretrained(base_model, "drguilhermeapolinario/gemma3-1b_med_reasoning")
# Query
input_text = "Como uma pancreatite se manifesta?"
inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_length=1024)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
The model was fine-tuned on the "rhaymison/medicine-information-pt" dataset, which contains medical information in Portuguese. The dataset was modified and processed to include explicit reasoning components. Each entry was transformed to separate questions from answers and reformatted to include dedicated reasoning sections, following the structured format with <start_working_out>, <end_working_out>, <SOLUTION>, and </SOLUTION> tags.
The model was trained using Generative Reward-guided Policy Optimization (GRPO) with custom reward functions specifically designed to encourage and reward structured reasoning. The dataset was enhanced with explicit reasoning components before training. The training procedure included:
The model was evaluated based on:
The model successfully learned to:
The model uses the Gemma-3-1B architecture with LoRA adapters applied to attention and MLP modules. The training objective was to optimize the model to:
If you use this model in your research, please cite:
@misc{medical-reasoning-assistant,
author = {Rhaymison},
title = {Medical Reasoning Assistant: A Fine-tuned Model for Structured Medical Information in Portuguese},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/your-username/medicine-reasoning-model}}
}
For questions or issues related to this model, please contact the model author through Hugging Face.