--- title: SLM Function Calling emoji: "\U0001F697" colorFrom: blue colorTo: purple sdk: gradio sdk_version: "4.44.0" app_file: app.py license: mit tags: - function-calling - gpt2 - lora - car-control - nlp --- # SLM Function Calling - Car Control Demo Convert natural language commands into structured function calls using a fine-tuned GPT-2 model with LoRA. ## Demo Try commands like: - "Set the temperature to 22 degrees for the driver" - "Turn up the heat" - "Navigate to Central Park" - "Play jazz music at volume 7" - "Lock all the doors" ## Model Details | Property | Value | |----------|-------| | Base Model | GPT-2 (124M parameters) | | Fine-tuning | LoRA (rank=32, alpha=32) | | Training Data | ~156K car control command samples | | Functions | 18 car control functions | | Input | Natural language command | | Output | Structured function call JSON | ## Function Categories The model supports 18 functions across these categories: - **Climate Control:** set_temperature, adjust_temperature, set_fan_speed, adjust_fan_speed - **Comfort:** adjust_seat, control_window - **Wipers & Defroster:** set_wiper_speed, adjust_wiper_speed, activate_defroster - **Engine & Security:** start_engine, lock_doors - **Entertainment:** play_music - **Navigation:** set_navigation_destination - **Lighting:** toggle_headlights, control_ambient_lighting - **Driving:** set_cruise_control, toggle_sport_mode - **Maintenance:** check_battery_health ## Output Format The model generates function calls in this format: ``` {"name": "function_name", "arguments": "{'param': value}"} <|im_end|> ``` ## Training The model was trained using: - ChatML format with system/user/assistant messages - Label masking (loss computed only on assistant response) - LoRA adapters targeting attention layers (c_attn, c_proj) ## Limitations - Only trained on car control domain - May produce incorrect outputs for ambiguous or out-of-domain queries - Best results with clear, specific commands ## Links - [GitHub Repository](https://github.com/suyash94/slm-function-calling) - [Model Weights on HuggingFace](https://huggingface.co/suyash94/gpt2-fc-adapter)