Instructions to use SatyaUdayB/gemma-3-4b-FC with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use SatyaUdayB/gemma-3-4b-FC with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-3-4b-it-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "SatyaUdayB/gemma-3-4b-FC") - Transformers
How to use SatyaUdayB/gemma-3-4b-FC with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SatyaUdayB/gemma-3-4b-FC") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SatyaUdayB/gemma-3-4b-FC", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SatyaUdayB/gemma-3-4b-FC with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SatyaUdayB/gemma-3-4b-FC" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SatyaUdayB/gemma-3-4b-FC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SatyaUdayB/gemma-3-4b-FC
- SGLang
How to use SatyaUdayB/gemma-3-4b-FC 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 "SatyaUdayB/gemma-3-4b-FC" \ --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": "SatyaUdayB/gemma-3-4b-FC", "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 "SatyaUdayB/gemma-3-4b-FC" \ --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": "SatyaUdayB/gemma-3-4b-FC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use SatyaUdayB/gemma-3-4b-FC with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for SatyaUdayB/gemma-3-4b-FC to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for SatyaUdayB/gemma-3-4b-FC to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for SatyaUdayB/gemma-3-4b-FC to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="SatyaUdayB/gemma-3-4b-FC", max_seq_length=2048, ) - Docker Model Runner
How to use SatyaUdayB/gemma-3-4b-FC with Docker Model Runner:
docker model run hf.co/SatyaUdayB/gemma-3-4b-FC
Gemma-3-4B-FC
Gemma-3-4B-FC is a LoRA fine-tuned version of Gemma 3 4B Instruct for function (tool) calling. The model is trained to recognize when external tools are required and generate structured tool calls with JSON arguments while maintaining conversational capabilities.
This repository contains only the LoRA adapter and tokenizer. The base model must be loaded separately.
Model Details
Model Description
Gemma-3-4B-FC extends Gemma 3 4B Instruct with function-calling capabilities using parameter-efficient fine-tuning (LoRA). The tokenizer included in this repository contains the custom chat template used during training and should always be loaded instead of the base tokenizer.
Developed by
Bandaru Venkata Satya Uday
Model Type
PEFT LoRA Adapter
Language(s)
Primarily English
Finetuned From
unsloth/gemma-3-4b-it
Model Sources
- Base Model:
unsloth/gemma-3-4b-it - GitHub: Visit the repository for fine-tuning code and instructions
Uses
Direct Use
This model is intended for applications requiring structured function/tool calling, including:
- AI Agents
- Tool Calling
- Function Calling
- Workflow Automation
- Assistant Applications
Since this repository only contains the LoRA adapter, users must first load the base Gemma 3 model and then apply the adapter.
Out-of-Scope Use
This model is not intended to execute tools. It only predicts which tool should be called and the corresponding JSON arguments.
How to Get Started
Install the required libraries.
pip install unsloth transformers peft
Load the base model.
from unsloth import FastModel
model, _ = FastModel.from_pretrained(
model_name="unsloth/gemma-3-4b-it",
max_seq_length=4096,
load_in_4bit=False,
load_in_8bit=False,
full_finetuning=False,
)
Load the tokenizer from this repository.
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained(
"SatyaUdayB/gemma-3-4b-FC"
)
Load the LoRA adapter.
from peft import PeftModel
model = PeftModel.from_pretrained(
model,
"SatyaUdayB/gemma-3-4b-FC"
)
Important
Use the tokenizer provided in this repository. It contains the custom chat template required for correct function-calling behavior.
Example
inputs = tokenizer.apply_chat_template(
messages,
tools=tools,
add_generation_prompt=True,
tokenize=True,
return_tensors="pt",
return_dict=True,
)
outputs = model.generate(
**inputs.to("cuda"),
max_new_tokens=128,
)
print(
tokenizer.batch_decode(
outputs,
skip_special_tokens=False,
)
)
Example output:
<tool_call>
[
{
"name": "get_current_time",
"arguments": {
"timezone": "Asia/Kolkata"
}
}
]
</tool_call>
Training Details
Training Data
This model was fine-tuned on a function-calling dataset derived from the APIGen-MT dataset. The data was preprocessed into a unified chat template and adapted for function-calling instruction tuning.
For more details about the dataset, please refer to the citation below.
Training Procedure
- Base Model: Gemma 3 4B Instruct
- Fine-tuning Method: LoRA
- Frameworks: Unsloth, Transformers, PEFT and TRL
- Context Length: 4096 tokens
Evaluation
Testing Data
A custom benchmark consisting of:
- Single-tool prompts
- Normal conversation
- Edge cases
Metrics
| Metric | Score |
|---|---|
| Tool Accuracy | 60.00% |
| Tool Call Format Accuracy | 60.00% |
| JSON Validity | 90.00% |
| False Positive Rate | 40.00% |
Summary
The model consistently produces syntactically valid JSON tool calls while demonstrating function-calling capability on a custom benchmark. Future work includes improving tool selection accuracy, reducing false-positive tool calls, and evaluating on public function-calling benchmarks such as BFCL.
Bias, Risks and Limitations
- The model only predicts tool calls and does not execute tools.
- Performance depends on using the tokenizer included in this repository.
- Tool selection performance may vary depending on the prompt and available tool definitions.
- Evaluation results are reported on a custom benchmark and may differ on public benchmarks.
Technical Specifications
Architecture
- Base Model: Gemma 3 4B Instruct
- Fine-tuning Method: LoRA
- Adapter Framework: PEFT
Software
- Transformers
- PEFT
- TRL
- Unsloth
More Information
Future releases aim to improve tool selection performance, reduce false positives, evaluate on public function-calling benchmarks (e.g. BFCL), and provide merged model and GGUF releases.
Acknowledgements
This work builds upon the following open-source projects and resources:
- Gemma 3 by Google
- Unsloth
- Hugging Face Transformers
- PEFT
- TRL
- APIGen-MT
Citation
This model was trained using data derived from the APIGen-MT dataset. If you use this model, please consider citing the original APIGen-MT paper.
APIGen-MT
@article{prabhakar2025apigen,
title={APIGen-MT: Agentic PIpeline for Multi-Turn Data Generation via Simulated Agent-Human Interplay},
author={Prabhakar, Akshara and Liu, Zuxin and Zhu, Ming and Zhang, Jianguo and Awalgaonkar, Tulika and Wang, Shiyu and Liu, Zhiwei and Chen, Haolin and Hoang, Thai and others},
journal={arXiv preprint arXiv:2504.03601},
year={2025}
}
Framework Versions
- PEFT 0.19.1
- Downloads last month
- 55
Model tree for SatyaUdayB/gemma-3-4b-FC
Base model
google/gemma-3-4b-pt