suyash94/slm-function-calling
0
1---2title: SLM Function Calling3emoji: "\U0001F697"4colorFrom: blue5colorTo: purple6sdk: gradio7sdk_version: "4.44.0"8app_file: app.py9license: mit10tags:11 - function-calling12 - gpt213 - lora14 - car-control15 - nlp16---17 18# SLM Function Calling - Car Control Demo19 20Convert natural language commands into structured function calls using a fine-tuned GPT-2 model with LoRA.21 22## Demo23 24Try commands like:25- "Set the temperature to 22 degrees for the driver"26- "Turn up the heat"27- "Navigate to Central Park"28- "Play jazz music at volume 7"29- "Lock all the doors"30 31## Model Details32 33| Property | Value |34|----------|-------|35| Base Model | GPT-2 (124M parameters) |36| Fine-tuning | LoRA (rank=32, alpha=32) |37| Training Data | ~156K car control command samples |38| Functions | 18 car control functions |39| Input | Natural language command |40| Output | Structured function call JSON |41 42## Function Categories43 44The model supports 18 functions across these categories:45 46- **Climate Control:** set_temperature, adjust_temperature, set_fan_speed, adjust_fan_speed47- **Comfort:** adjust_seat, control_window48- **Wipers & Defroster:** set_wiper_speed, adjust_wiper_speed, activate_defroster49- **Engine & Security:** start_engine, lock_doors50- **Entertainment:** play_music51- **Navigation:** set_navigation_destination52- **Lighting:** toggle_headlights, control_ambient_lighting53- **Driving:** set_cruise_control, toggle_sport_mode54- **Maintenance:** check_battery_health55 56## Output Format57 58The model generates function calls in this format:59 60```61<functioncall> {"name": "function_name", "arguments": "{'param': value}"} <|im_end|>62```63 64## Training65 66The model was trained using:67- ChatML format with system/user/assistant messages68- Label masking (loss computed only on assistant response)69- LoRA adapters targeting attention layers (c_attn, c_proj)70 71## Limitations72 73- Only trained on car control domain74- May produce incorrect outputs for ambiguous or out-of-domain queries75- Best results with clear, specific commands76 77## Links78 79- [GitHub Repository](https://github.com/suyash94/slm-function-calling)80- [Model Weights on HuggingFace](https://huggingface.co/suyash94/gpt2-fc-adapter)81 