CoolFace
Apppublic

suyash94/slm-function-calling

sourceHugging Facemitupdated 9mo agoView on Hugging Face
0likes
App README

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

PropertyValue
Base ModelGPT-2 (124M parameters)
Fine-tuningLoRA (rank=32, alpha=32)
Training Data~156K car control command samples
Functions18 car control functions
InputNatural language command
OutputStructured function call JSON

Function Categories

The model supports 18 functions across these categories:

  • Climate Control: settemperature, adjusttemperature, setfanspeed, adjustfanspeed
  • Comfort: adjustseat, controlwindow
  • Wipers & Defroster: setwiperspeed, adjustwiperspeed, activate_defroster
  • Engine & Security: startengine, lockdoors
  • Entertainment: play_music
  • Navigation: setnavigationdestination
  • Lighting: toggleheadlights, controlambient_lighting
  • Driving: setcruisecontrol, togglesportmode
  • Maintenance: checkbatteryhealth

Output Format

The model generates function calls in this format:

<functioncall> {"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 (cattn, cproj)

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