File size: 6,428 Bytes
714828b
 
735d9db
714828b
735d9db
714828b
735d9db
714828b
 
 
 
 
735d9db
714828b
735d9db
 
 
 
 
714828b
735d9db
714828b
735d9db
 
714828b
 
 
 
 
735d9db
714828b
735d9db
 
 
714828b
735d9db
714828b
735d9db
714828b
 
 
735d9db
714828b
735d9db
 
 
 
714828b
 
 
735d9db
 
 
714828b
 
 
735d9db
 
 
714828b
 
 
735d9db
714828b
735d9db
 
 
 
714828b
735d9db
 
 
714828b
735d9db
 
 
 
 
714828b
735d9db
 
714828b
735d9db
 
714828b
735d9db
 
 
714828b
735d9db
 
 
 
 
 
 
 
714828b
735d9db
 
714828b
735d9db
714828b
735d9db
714828b
735d9db
714828b
735d9db
714828b
735d9db
714828b
735d9db
714828b
735d9db
714828b
735d9db
 
 
 
 
 
 
714828b
735d9db
714828b
 
 
735d9db
714828b
 
 
735d9db
714828b
 
 
735d9db
714828b
735d9db
 
 
 
 
714828b
735d9db
714828b
 
 
735d9db
 
 
 
 
 
 
 
 
714828b
 
 
735d9db
714828b
735d9db
714828b
735d9db
714828b
 
 
735d9db
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168


## library\_name: transformers tags: [scientific, instruction-following, gemma, lora, gemma3-270m, science]

# Model Card for ps2program/gemma3-270m-scisinstruct

This is a **LoRA-fine-tuned version of Gemma 3 (270M)**, specialized for **scientific instruction-following and reasoning tasks**. The model has been trained on the `zd21/SciInstruct` dataset to excel at generating explanations, summaries, and scientific reasoning outputs in response to natural language prompts.

## Model Details

### Model Description

This model extends the Google-developed Gemma 3 base language model using LoRA (Low-Rank Adaptation) adapters. This technique allows for efficient fine-tuning on a specific task without modifying the entire model. The resulting model is designed to handle a variety of scientific questions and instructions, making it a valuable tool for academic and research-oriented applications.

  - **Developed by:** ps2program
  - **Model type:** Causal Language Model (LoRA-finetuned)
  - **Language(s) (NLP):** English
  - **License:** Apache-2.0
  - **Finetuned from model:** `gemma3-270m`

### Model Sources

  - **Repository:** [https://huggingface.co/ps2program/gemma3-270m-scisinstruct](https://huggingface.co/ps2program/gemma3-270m-scisinstruct)
  - **Dataset Card:** [https://huggingface.co/datasets/zd21/SciInstruct](https://huggingface.co/datasets/zd21/SciInstruct)

## Uses

### Direct Use

This model is intended for direct use in applications requiring scientific text generation. Examples of its use include:

  - Answering questions about scientific principles.
  - Generating summaries of scientific papers or concepts.
  - Assisting in educational contexts for students and researchers.

### Downstream Use

This model can serve as a base for further fine-tuning on highly specialized, domain-specific scientific corpora (e.g., specific fields like biochemistry or astrophysics) to improve performance on those particular tasks.

### Out-of-Scope Use

The model is **not intended** for:

  - General-purpose conversation or casual chat.
  - Providing medical, legal, or financial advice.
  - Generating content in non-scientific domains where it may produce inaccurate or nonsensical outputs.
  - Applications where factual accuracy is critical without human verification.

## Bias, Risks, and Limitations

  - **Factual Inaccuracies:** The model may generate factually incorrect or outdated information. Users should always verify outputs, especially in academic or research contexts.
  - **Data Bias:** The model's performance and outputs are limited by the quality and content of its training data (`SciInstruct`). It may reflect any biases present in the original dataset.
  - **Limited Scope:** The model is specialized for scientific reasoning and may perform poorly on tasks outside of this domain.

### Recommendations

  - Always verify the generated scientific content with reliable sources.
  - Do not use the model for high-stakes decision-making.
  - Be aware of the model's limitations and potential for generating incorrect information.

## How to Get Started with the Model

To use this model, you'll need to load the base `gemma3-270m` model first, and then load the LoRA adapters on top of it.

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch

# Load the base model (you must have access to gemma3-270m)
base_model_id = "google/gemma-3-270m"
model_id = "ps2program/gemma3-270m-scisinstruct"

base_model = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

# Load the LoRA adapters from your repo
model = PeftModel.from_pretrained(base_model, model_id)

# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_id)

# Prepare a scientific prompt
prompt = "Explain the significance of CRISPR-Cas9 technology in genetic engineering."
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")

# Generate the output
outputs = model.generate(
    **inputs,
    max_new_tokens=256,
    do_sample=True,
    temperature=0.7,
    top_p=0.95
)

print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

## Training Details

### Training Data

The model was fine-tuned on the `zd21/SciInstruct` dataset, which contains high-quality, scientifically-grounded instruction-following examples.

### Training Procedure

#### Preprocessing

The dataset was formatted into instruction-following prompts and tokenized using the `gemma3-270m` tokenizer.

#### Training Hyperparameters

  - **Training regime:** Mixed precision (bfloat16)
  - **LoRA parameters:** `r=8`, `lora_alpha=16`
  - **Optimizer:** `adamw_torch_fused`
  - **Learning rate:** `2e-5`
  - **Batch size:** `4`
  - **Epochs:** `5`
  - **Gradient accumulation steps:** `4`

## Evaluation

### Testing Data, Factors & Metrics

The model's performance was evaluated qualitatively by observing its ability to generate coherent and scientifically accurate responses to a diverse set of prompts. Standard metrics were not used in this initial fine-tuning.

### Results

The model demonstrates an improved ability to follow scientific instructions compared to the base `gemma3-270m` model. It can provide well-structured explanations and summaries.

## Environmental Impact

Carbon emissions were not calculated for this fine-tuning process. However, as a small-parameter model fine-tuned using LoRA, the training was computationally efficient and had a significantly lower environmental impact than training a large model from scratch.

  - **Hardware Type:** (e.g., 1x NVIDIA A100 GPU)
  - **Hours used:** (e.g., \~2 hours)
  - **Cloud Provider:** (e.g., Google Cloud, AWS, etc.)
  - **Compute Region:** (e.g., us-east-1)
  - **Carbon Emitted:** [More Information Needed]

## Citation

**BibTeX:**

```bibtex
@misc{ps2program2025gemma3,
  title={Gemma 3 270M SciInstruct LoRA},
  author={ps2program},
  year={2025},
  howpublished={\url{https://huggingface.co/ps2program/gemma3-270m-scisinstruct}},
  note={LoRA fine-tuning of Gemma 3 270M on the SciInstruct dataset.}
}
```

**APA:**

ps2program. (2025). *Gemma 3 270M SciInstruct LoRA*. Hugging Face Model Hub. [https://huggingface.co/ps2program/gemma3-270m-scisinstruct](https://huggingface.co/ps2program/gemma3-270m-scisinstruct)

## Model Card Authors

ps2program

## Model Card Contact

[Your preferred contact method or email address]