한국어 자연어 이체 명령을 구조화된 function call로 변환하는 경량 모델입니다.
TransferFunctionGemma는
google/functiongemma-270m-it를 한국어 금융 이체 도메인에 맞게 full fine-tuning한 모델입니다. 자연어 이체 명령을 분석하여 4종류의 function call JSON으로 변환합니다.
ONNX INT8 양자화를 통해 약 418MB로 경량화되었으며, Transformers.js + WebGPU를 통해 브라우저에서 직접 추론할 수 있습니다. 서버 통신 없이 100% 클라이언트 사이드에서 동작합니다.
시드 데이터를 Claude API로 증강하여 500~1,000개 학습 샘플을 생성했습니다. 증강 시 다음을 변형합니다:
1{
2 "messages": [
3 {
4 "role": "developer",
5 "content": "You are a model that can do function calling with the following functions",
6 "tool_definitions": [...]
7 },
8 {
9 "role": "user",
10 "content": "엄마한테 오만원 보내"
11 },
12 {
13 "role": "assistant",
14 "content": "",
15 "function_calls": [
16 {"name": "execute_transfer", "arguments": {"recipient": "엄마", "amount": 50000}}
17 ]
18 }
19 ]
20}
1# Fine-tuned 모델 -> ONNX 변환 + INT8 양자화
2python ml/scripts/convert_onnx.py
1import { pipeline } from '@xenova/transformers';
2
3// 모델 로드 (WebGPU 자동 감지)
4const generator = await pipeline(
5 'text-generation',
6 'your-username/transfer-function-gemma-onnx-int4',
7 { device: 'webgpu' }
8);
9
10// 추론
11const messages = [
12 {
13 role: 'system',
14 content: 'You are a model that can do function calling with the following functions: [execute_transfer, query_history, summarize_history, confirm_transfer]'
15 },
16 {
17 role: 'user',
18 content: '엄마한테 5만원 보내줘'
19 }
20];
21
22const output = await generator(messages, {
23 max_new_tokens: 256,
24 temperature: 0.1,
25});
26
27console.log(output);
28// => {"name": "execute_transfer", "arguments": {"recipient": "엄마", "amount": 50000}}
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model = AutoModelForCausalLM.from_pretrained(
4 "your-username/transfer-function-gemma",
5 torch_dtype="bfloat16",
6 device_map="auto"
7)
8tokenizer = AutoTokenizer.from_pretrained(
9 "your-username/transfer-function-gemma"
10)
11
12messages = [
13 {"role": "user", "content": "엄마한테 5만원 보내줘"}
14]
15
16inputs = tokenizer.apply_chat_template(
17 messages,
18 return_tensors="pt",
19 add_generation_prompt=True
20).to(model.device)
21
22outputs = model.generate(inputs, max_new_tokens=256, temperature=0.1)
23result = tokenizer.decode(outputs[0], skip_special_tokens=True)
24print(result)
1@misc{transfer-function-gemma-2026,
2 title={TransferFunctionGemma: On-Device Korean Banking Function Calling},
3 author={Kimin Ryu},
4 year={2026},
5 url={https://github.com/your-username/TransferFunctionGemma}
6}