kartikaybagla commited on
Commit
3a775cc
·
verified ·
1 Parent(s): 12cfed1

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +133 -0
README.md ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: gemma
3
+ base_model: google/functiongemma-270m-it
4
+ tags:
5
+ - function-calling
6
+ - finance
7
+ - sms-parsing
8
+ - transaction-extraction
9
+ - gguf
10
+ - llama-cpp
11
+ language:
12
+ - en
13
+ pipeline_tag: text-generation
14
+ library_name: transformers
15
+ ---
16
+
17
+ # FunctionGemma Bank SMS Parser
18
+
19
+ A fine-tuned [FunctionGemma-270M-IT](https://huggingface.co/google/functiongemma-270m-it) model for extracting structured transaction data from bank SMS messages.
20
+
21
+ ## Model Description
22
+
23
+ This model is trained to perform two functions:
24
+
25
+ 1. **`extract_transaction`** - Parse banking SMS and extract structured fields:
26
+ - `source`: Bank or sender name
27
+ - `currency`: Currency code (INR, USD, etc.)
28
+ - `amount`: Transaction amount (number)
29
+ - `date`: Transaction date
30
+ - `destination`: Recipient or merchant
31
+ - `type`: "debit" or "credit"
32
+
33
+ 2. **`skip_message`** - Identify non-transaction messages:
34
+ - OTPs and verification codes
35
+ - Promotional messages
36
+ - Payment requests (not completed transactions)
37
+ - Account alerts without transactions
38
+
39
+ ## Quantization Options
40
+
41
+ | File | Quantization | Size | Description |
42
+ |------|--------------|------|-------------|
43
+ | `functiongemma-270m-bank-sms-parser-Q4_K_M.gguf` | Q4_K_M | ~242MB | **Recommended** - Best size/quality tradeoff |
44
+ | `functiongemma-270m-bank-sms-parser-Q5_K_M.gguf` | Q5_K_M | ~248MB | Higher quality if Q4 shows issues |
45
+ | `functiongemma-270m-bank-sms-parser-Q8_0.gguf` | Q8_0 | ~280MB | Near-lossless, for validation |
46
+
47
+ ## Usage
48
+
49
+ ### With llama.cpp server
50
+
51
+ ```bash
52
+ # Download model
53
+ huggingface-cli download kartikaybagla/functiongemma-bank-sms-parser \
54
+ functiongemma-270m-bank-sms-parser-Q4_K_M.gguf \
55
+ --local-dir ./models
56
+
57
+ # Run server
58
+ llama-server --model ./models/functiongemma-270m-bank-sms-parser-Q4_K_M.gguf \
59
+ --host 0.0.0.0 --port 8080 --ctx-size 2048
60
+ ```
61
+
62
+ ### With Docker
63
+
64
+ ```bash
65
+ docker run -p 8080:8080 -v ./models:/models \
66
+ ghcr.io/ggml-org/llama.cpp:server \
67
+ --model /models/functiongemma-270m-bank-sms-parser-Q4_K_M.gguf \
68
+ --host 0.0.0.0 --port 8080
69
+ ```
70
+
71
+ ### API Request
72
+
73
+ ```bash
74
+ curl http://localhost:8080/v1/completions \
75
+ -H "Content-Type: application/json" \
76
+ -d '{
77
+ "prompt": "<bos><start_of_turn>developer\nYou are a financial transaction extractor. Analyze SMS messages and:\n1. If the message describes a completed financial transaction (money sent, received, debited, or credited), use extract_transaction to capture the details.\n2. If the message is not a transaction (OTP, promotional, application status, payment request, etc.), use skip_message.\n\nOnly extract actual completed transactions with concrete amounts, not payment requests or pending transactions.<start_function_declaration>declaration:extract_transaction{description:<escape>Extract transaction details from a banking SMS message<escape>,parameters:{properties:{source:{type:<escape>STRING<escape>},currency:{type:<escape>STRING<escape>},amount:{type:<escape>NUMBER<escape>},date:{type:<escape>STRING<escape>},destination:{type:<escape>STRING<escape>},type:{type:<escape>STRING<escape>}},required:[<escape>source<escape>,<escape>currency<escape>,<escape>amount<escape>,<escape>date<escape>,<escape>destination<escape>,<escape>type<escape>],type:<escape>OBJECT<escape>}}<end_function_declaration><start_function_declaration>declaration:skip_message{description:<escape>Skip messages that are not financial transactions<escape>,parameters:{properties:{reason:{type:<escape>STRING<escape>}},required:[<escape>reason<escape>],type:<escape>OBJECT<escape>}}<end_function_declaration><end_of_turn>\n<start_of_turn>user\nICICI Bank Acct XX123 debited Rs 450.00 on 15-Jan-25; UPI to SWIGGY. UPI Ref: 123456789012<end_of_turn>\n<start_of_turn>model\n",
78
+ "max_tokens": 200,
79
+ "stop": ["<end_function_call>"]
80
+ }'
81
+ ```
82
+
83
+ ### Example Output
84
+
85
+ **Input SMS:**
86
+ ```
87
+ ICICI Bank Acct XX123 debited Rs 450.00 on 15-Jan-25; UPI to SWIGGY. UPI Ref: 123456789012
88
+ ```
89
+
90
+ **Model Output:**
91
+ ```
92
+ <start_function_call>extract_transaction{"source": "ICICI Bank", "currency": "INR", "amount": 450.00, "date": "15-Jan-25", "destination": "SWIGGY", "type": "debit"}<end_function_call>
93
+ ```
94
+
95
+ **Input SMS (non-transaction):**
96
+ ```
97
+ Your OTP for login is 482910. Valid for 5 minutes. Do not share.
98
+ ```
99
+
100
+ **Model Output:**
101
+ ```
102
+ <start_function_call>skip_message{"reason": "OTP verification code"}<end_function_call>
103
+ ```
104
+
105
+ ## Training
106
+
107
+ - **Base Model**: [google/functiongemma-270m-it](https://huggingface.co/google/functiongemma-270m-it)
108
+ - **Training Framework**: Hugging Face TRL (SFTTrainer)
109
+ - **Training Data**: Classified bank SMS messages from Indian banks
110
+ - **Fine-tuning Method**: LoRA
111
+
112
+ ## Intended Use
113
+
114
+ This model is designed for:
115
+ - Personal finance automation
116
+ - Importing transactions into budgeting apps (e.g., Actual Budget)
117
+ - SMS-based expense tracking
118
+
119
+ ## Limitations
120
+
121
+ - Primarily trained on Indian bank SMS formats (ICICI, HDFC, SBI, etc.)
122
+ - May not generalize well to banks from other countries
123
+ - Requires the specific prompt format shown above
124
+ - Not suitable for security-critical applications without additional validation
125
+
126
+ ## License
127
+
128
+ This model inherits the [Gemma license](https://ai.google.dev/gemma/terms) from the base model.
129
+
130
+ ## Links
131
+
132
+ - [Project Repository](https://github.com/kartikaybagla/bank-sms-parsing)
133
+ - [Base Model](https://huggingface.co/google/functiongemma-270m-it)