Instructions to use Miladsaeedi70/smollm2-135m-scientific-sft-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Miladsaeedi70/smollm2-135m-scientific-sft-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM2-135M-Instruct") model = PeftModel.from_pretrained(base_model, "Miladsaeedi70/smollm2-135m-scientific-sft-lora") - Transformers
How to use Miladsaeedi70/smollm2-135m-scientific-sft-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Miladsaeedi70/smollm2-135m-scientific-sft-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Miladsaeedi70/smollm2-135m-scientific-sft-lora", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Miladsaeedi70/smollm2-135m-scientific-sft-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Miladsaeedi70/smollm2-135m-scientific-sft-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Miladsaeedi70/smollm2-135m-scientific-sft-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Miladsaeedi70/smollm2-135m-scientific-sft-lora
- SGLang
How to use Miladsaeedi70/smollm2-135m-scientific-sft-lora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Miladsaeedi70/smollm2-135m-scientific-sft-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Miladsaeedi70/smollm2-135m-scientific-sft-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Miladsaeedi70/smollm2-135m-scientific-sft-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Miladsaeedi70/smollm2-135m-scientific-sft-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Miladsaeedi70/smollm2-135m-scientific-sft-lora with Docker Model Runner:
docker model run hf.co/Miladsaeedi70/smollm2-135m-scientific-sft-lora
SmolLM2-135M Scientific SFT LoRA
This repository contains a LoRA adapter fine-tuned from
HuggingFaceTB/SmolLM2-135M-Instruct
for concise scientific instruction following.
The model was trained on a custom dataset covering scientific question answering, summarization, concept explanation, method comparison, technical simplification, bullet generation, data analysis, and Python code generation.
This repository contains the LoRA adapter and tokenizer files, not a complete standalone copy of the base model. The adapter must be loaded together with the original SmolLM2-135M-Instruct model.
Training Summary
| Item | Value |
|---|---|
| Base model | HuggingFaceTB/SmolLM2-135M-Instruct |
| Fine-tuning method | Supervised Fine-Tuning (SFT) with PEFT LoRA |
| Dataset size | 1,576 instruction-following examples |
| Training split | 1,260 |
| Validation split | 158 |
| Test split | 158 |
| Task categories | 8 |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.05 |
| Target modules | All linear layers |
| Maximum sequence length | 512 tokens |
| Epochs | 3 |
| Per-device batch size | 2 |
| Gradient accumulation | 8 |
| Effective batch size | 16 |
| Learning rate | 2e-4 |
| Optimizer | AdamW |
| Final training loss | 2.57 |
Dataset Overview
The training dataset contains eight scientific instruction-following tasks:
- Scientific question answering (256)
- Summarization (220)
- Concept explanation (200)
- Method comparison (200)
- Technical simplification (200)
- Bullet generation (200)
- Data analysis (200)
- Code generation (100)
The dataset focuses on scientific and technical domains including environmental science, air pollution, geospatial machine learning, computer vision, large language models, and scientific Python programming. Grouped train/validation/test splitting was used to reduce prompt leakage between data splits.
Model Details
Model Description
The model is a parameter-efficient scientific instruction-following adaptation of SmolLM2-135M-Instruct.
Supervised fine-tuning was performed using Low-Rank Adaptation across the model's linear layers. The training data emphasizes concise, structured, technically accurate responses in scientific and machine-learning domains.
The primary covered domains include:
- Environmental science
- Air pollution
- Geospatial machine learning
- Data science
- Computer vision
- Large language models
- Scientific Python programming
Model characteristics:
- Developed by: Milad Saeedi
- Model type: Decoder-only causal language model with a LoRA adapter
- Base model: HuggingFaceTB/SmolLM2-135M-Instruct
- Fine-tuning method: Supervised fine-tuning with PEFT LoRA
- Language: English
- Pipeline: Text generation
- Library: PEFT, Transformers, and TRL
- License: Apache-2.0, following the base model license
- Parameters updated: LoRA adapter parameters only
Model Sources
- Base model: HuggingFaceTB/SmolLM2-135M-Instruct
- Adapter repository: Miladsaeedi70/smollm2-135m-scientific-sft-lora
Uses
Direct Use
The adapter can be used for scientific instruction-following tasks such as:
- Answering scientific questions
- Explaining technical concepts
- Simplifying technical language
- Summarizing scientific text
- Comparing scientific or machine-learning methods
- Generating concise bullet points
- Interpreting small data-analysis problems
- Producing short Python examples
- Drafting structured scientific responses
The model is intended mainly for experimentation, education, portfolio demonstrations, and lightweight scientific NLP applications.
Downstream Use
The adapter may be integrated into:
- Scientific assistants
- Educational applications
- Retrieval-augmented generation systems
- Scientific document-processing pipelines
- Lightweight local language-model applications
- Model-comparison demonstrations
- Further preference optimization experiments such as GRPO
The adapter may also be merged with the base model for deployment, subject to the licenses and terms of both the base model and this repository.
Out-of-Scope Use
The model should not be relied upon as the sole source for:
- Medical diagnosis or treatment
- Legal advice
- Safety-critical engineering decisions
- Environmental regulatory decisions
- High-stakes scientific conclusions
- Fully autonomous code execution
- Factual claims requiring verified and current evidence
The model was not trained to provide unrestricted general-purpose assistance across every field. It may perform poorly on topics that differ substantially from the training domains.
Bias, Risks, and Limitations
This adapter inherits limitations from the SmolLM2-135M-Instruct base model.
Because the base model is small, generated responses may:
- Contain factual inaccuracies
- Hallucinate scientific terminology or references
- Oversimplify complex topics
- Produce incomplete reasoning
- Generate incorrect Python code
- Repeat phrases
- Misinterpret ambiguous prompts
- Perform poorly on long-context inputs
- Struggle with advanced mathematical reasoning
- Produce plausible but unsupported scientific conclusions
The training dataset is custom and relatively small. It does not represent the full diversity of scientific disciplines, writing styles, institutions, geographic regions, or technical perspectives.
The evaluation primarily uses ROUGE, which measures lexical overlap with reference answers. Higher ROUGE scores do not guarantee factual correctness, scientific validity, originality, or safe downstream behavior.
Recommendations
Users should independently verify scientific claims, calculations, code, and citations produced by the model.
For higher-reliability applications, the model should be combined with:
- Retrieval from trusted sources
- Citation verification
- Domain-specific validation
- Human expert review
- Structured output checks
- Code testing and sandboxed execution
How to Get Started
Install the required packages:
pip install -U transformers peft accelerate torch
- Downloads last month
- 82
Model tree for Miladsaeedi70/smollm2-135m-scientific-sft-lora
Base model
HuggingFaceTB/SmolLM2-135M