Downloads · 30 days
0
Hakid/ai-research-assistant-qwen35-4b-lora-safe
ai-research-assistant-qwen35-4b-lora-safe is a machine learning model from Hakid. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Jun 14, 2026
Repo size
150 MB
Likes
0
Public
Click a slice to open those files.
.safetensors130 MB · 87%
From the Hugging Face model README
This repository contains a LoRA adapter fine-tuned from unsloth/Qwen3.5-4B for a safe scientific research assistant task.
The model is designed to answer research-related questions using the provided context, extract supporting evidence, and clearly state limitations when the context is incomplete.
This model is a fine-tuned LoRA adapter for scientific question answering and short research summarization.
The expected output format is:
Answer:
Evidence:
Limitation:
The model is not intended to freely invent information. It should answer based on the given context and mention limitations when the context does not contain enough information.
unsloth/Qwen3.5-4B
This model was fine-tuned using:
The training setup used a conservative safe configuration to reduce unstable generation, repetition, and malformed output.
The model was trained using scientific question-answering and summarization datasets:
| Dataset | Usage |
|---|---|
allenai/qasper | Scientific question answering with evidence |
allenai/scitldr | Scientific TL;DR summarization |
QASPER samples without evidence were filtered out so the model learns to provide grounded answers instead of unsupported evidence.
This model is intended for:
Example prompt:
Context:
A research paper abstract or paragraph.
Question:
What is the main contribution of this paper?
Expected response:
Answer:
The paper proposes ...
Evidence:
The context states that ...
Limitation:
The provided context does not include ...
This model should not be used for:
The model may still hallucinate, especially if the prompt does not provide enough context.
Main configuration used in the notebook:
MODEL_NAME = "unsloth/Qwen3.5-4B"
TRAINING_PROFILE = "safe"
MAX_SEQ_LENGTH = 2048
LOAD_IN_4BIT = False
QASPER_MAX_PAPERS = 500
SCITLDR_MAX_ROWS = 800
MAX_UPDATE_STEPS = 300
PER_DEVICE_BATCH_SIZE = 1
GRAD_ACCUM_STEPS = 8
LEARNING_RATE = 5e-5
The safe profile was used to reduce the risk of adapter collapse and unstable output.
Install the required libraries:
pip install transformers peft accelerate bitsandbytes
Example loading code:
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
base_model = "unsloth/Qwen3.5-4B"
adapter_model = "YOUR_USERNAME/YOUR_REPO_NAME"
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(
base_model,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(model, adapter_model)
model.eval()
Example inference:
prompt = """
You are a safe AI research assistant.
Answer only using the given context.
Context:
Deep learning models have been used to improve scientific document understanding by extracting relevant evidence from papers.
Question:
What is the main idea of the context?
Respond using this format:
Answer:
Evidence:
Limitation:
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.2,
top_p=0.9,
do_sample=False
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Use this structure for best results:
You are a safe AI research assistant.
Answer only using the given context.
Context:
[Insert paper abstract, paragraph, or evidence here]
Question:
[Insert research question here]
Respond using this format:
Answer:
Evidence:
Limitation:
The model should answer with:
Answer:
A direct answer to the question.
Evidence:
Relevant evidence from the given context.
Limitation:
A clear limitation if the context is incomplete.
This model has several limitations:
The model was trained with a safer output structure, but it is still a language model. Outputs should be reviewed manually before being used in academic, scientific, or professional work.
Do not treat the model output as a verified citation or final academic conclusion.
This is an experimental fine-tuned LoRA adapter for research assistant behavior. The goal is to improve grounded answering, evidence extraction, and limitation awareness in scientific QA tasks.
This model is released under the Apache License 2.0.