Safeeq commited on
Commit
d4121b4
·
verified ·
1 Parent(s): 5c9dcba

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +70 -0
  2. config.json +15 -0
  3. model.safetensors +3 -0
  4. tokenizer.json +0 -0
README.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language: en
4
+ tags:
5
+ - function-calling
6
+ - tiny-model
7
+ - edge-ai
8
+ - tool-use
9
+ pipeline_tag: text-generation
10
+ ---
11
+
12
+ # Tiny Function-Calling LM (~0.47M params)
13
+
14
+ A from-scratch decoder-only transformer with ~471,760 parameters, trained to route
15
+ natural-language requests to a single tool (`web_search`) or abstain (`none`).
16
+ Built as a demonstration of function-calling on an extremely small budget.
17
+
18
+ ## Architecture
19
+ - 4 transformer layers, d_model=80, 4 attention heads (head dim 20)
20
+ - RoPE positional encoding, RMSNorm, GELU feed-forward (4x width), tied input/output embeddings
21
+ - BPE tokenizer with a 2,048-token vocabulary trained on the task's own synthetic data
22
+ - Context length: 80 tokens
23
+
24
+ ## Output format
25
+ ```
26
+ web_search|query=<search terms>|recency=<day|week|any>
27
+ none
28
+ ```
29
+
30
+ ## Loading
31
+ This is **not** a registered `transformers` architecture — it uses a small custom
32
+ model class. Load it with the reference implementation (`model.py`) from the
33
+ companion GitHub repo:
34
+
35
+ **Code:** https://github.com/YOUR_USERNAME/tiny-fc-lm
36
+
37
+ ```python
38
+ import torch
39
+ from safetensors.torch import load_file
40
+ from tokenizers import Tokenizer
41
+ from model import TinyLM # from the GitHub repo
42
+
43
+ state = load_file("model.safetensors")
44
+ tok = Tokenizer.from_file("tokenizer.json")
45
+ model = TinyLM(vocab=2048, d=80, n_layers=4, n_heads=4, ffn_mult=4, max_len=80)
46
+ model.load_state_dict(state)
47
+ model.eval()
48
+ ```
49
+ See the GitHub repo's `infer.py` for constrained decoding and tool dispatch.
50
+
51
+ ## Training data
52
+ 80,000 synthetic (request, tool-call) pairs generated from templated phrasings
53
+ across ~10 intents (news, weather, price, stock, how-to, sports scores, definitions,
54
+ generic web search, and weekly recaps), plus chit-chat examples mapped to `none`.
55
+
56
+ ## Evaluation
57
+ | Split | Exact match |
58
+ |---|---|
59
+ | In-distribution (val) | ~1.00 |
60
+ | Held-out phrasing (OOD) | ~0.88 |
61
+
62
+ ## Limitations
63
+ - Single tool only (`web_search`); not a general-purpose assistant.
64
+ - Learned via memorized entity↔pattern associations rather than true entity
65
+ copying, so genuinely novel named entities (names/places never seen in training)
66
+ are sometimes replaced with a memorized default instead of preserved.
67
+ - English only; no multi-turn context.
68
+
69
+ ## License
70
+ MIT. Provided as-is for research/educational use.
config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "tinylm-fc",
3
+ "vocab_size": 2048,
4
+ "d_model": 80,
5
+ "n_layers": 4,
6
+ "n_heads": 4,
7
+ "ffn_mult": 4,
8
+ "max_position_embeddings": 80,
9
+ "positional_encoding": "rope",
10
+ "normalization": "rmsnorm",
11
+ "activation": "gelu",
12
+ "tied_embeddings": true,
13
+ "num_parameters": 471760,
14
+ "task": "single-tool function calling (web_search) + abstain (none)"
15
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c6933d390e964c2d03472251d0d7be434be5095e5f40d57611cb6b5a0ce1989
3
+ size 1889192
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff