Compactbot commited on
Commit
45054fb
·
verified ·
1 Parent(s): 61076c6

Add model card

Browse files
Files changed (1) hide show
  1. README.md +37 -37
README.md CHANGED
@@ -1,46 +1,52 @@
1
  ---
2
  license: apache-2.0
3
- library_name: transformers
4
  pipeline_tag: text-generation
5
  language: en
6
- base_model: LiquidAI/LFM2.5-1.2B-Thinking
7
  tags:
 
8
  - agent
9
  - fine-tune
10
- - reasoning
11
  - tool-use
12
- - lfm2
 
 
 
13
  metrics:
14
- - perplexity
15
  ---
16
 
17
  # LiquidAgent-1.2B
18
 
19
- A fine-tune of [LiquidAI/LFM2.5-1.2B-Thinking](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Thinking) for agent-style tasks: multi-step reasoning, tool use, and structured output generation.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  ## Architecture
22
 
23
  | Parameter | Value |
24
  |-----------|-------|
25
- | Base model | LiquidAI/LFM2.5-1.2B-Thinking |
26
- | Architecture | LFM2 (hybrid conv + full-attention) |
27
- | Layers | 16 (10 conv, 6 full-attention) |
28
  | Hidden size | 2048 |
29
- | Attention heads | 32 Q / 8 KV (GQA) |
30
- | Vocab size | 65,536 |
31
- | Max position | 128,000 |
32
- | Tied embeddings | Yes |
33
- | Total params | 1,170,300,000 (148 tensors) |
34
  | Dtype | bfloat16 |
35
 
36
- ## Training
37
-
38
- - **Data**: Agent traces from [TeichAI/Ox-Alpha-Pi-Traces](https://huggingface.co/datasets/TeichAI/Ox-Alpha-Pi-Traces) and [TeichAI/DeepSeek-v4-Pro-Agent](https://huggingface.co/datasets/TeichAI/DeepSeek-v4-Pro-Agent)
39
- - **Method**: Full fine-tune (all parameters), assistant-token masking (loss on assistant turns only)
40
- - **Steps**: 47 optimizer steps (batch 1, grad accum 16, ~1.5M assistant tokens)
41
- - **LR**: 2e-5, cosine decay with 5-step warmup
42
- - **Hardware**: NVIDIA RTX 5090 (32 GB), bfloat16, gradient checkpointing
43
-
44
  ## Usage
45
 
46
  ```python
@@ -49,26 +55,20 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
49
  model = AutoModelForCausalLM.from_pretrained(
50
  "Compactbot/liquidagent-1.2b",
51
  torch_dtype="bfloat16",
52
- device_map="auto"
53
  )
54
  tokenizer = AutoTokenizer.from_pretrained("Compactbot/liquidagent-1.2b")
55
 
56
- messages = [{"role": "user", "content": "Write a Python function to parse a JSON config file and validate required fields."}]
57
  text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
58
  inputs = tokenizer(text, return_tensors="pt").to(model.device)
59
- output = model.generate(**inputs, max_new_tokens=512, temperature=0.7, top_p=0.9)
60
- print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
61
  ```
62
 
63
- ## Quality
64
-
65
- Ship gate (2026-09-30): PASS. Generates coherent, on-topic agent-style responses with thinking tokens. No degenerate repetition (1 repeated 5-gram in 301 words across 3 prompts).
66
-
67
- **Known limitations**:
68
- - Only 47 optimizer steps — this is a lightweight SFT, not a full training run
69
- - Best suited for agent-style tasks (reasoning chains, tool calls, structured output)
70
- - Not a general-purpose chat model; general knowledge is from the base model
71
-
72
- ## Notes
73
 
74
- This is a demonstration fine-tune showing that agent capabilities can be injected into a 1.2B hybrid-attention model with a small number of optimizer steps. The base model's thinking-token format is preserved.
 
 
 
 
1
  ---
2
  license: apache-2.0
 
3
  pipeline_tag: text-generation
4
  language: en
 
5
  tags:
6
+ - lfm2
7
  - agent
8
  - fine-tune
 
9
  - tool-use
10
+ - liquid-ai
11
+ base_model: LiquidAI/LFM2.5-1.2B-Thinking
12
+ datasets:
13
+ - TeichAI/Ox-Alpha-Pi-Traces
14
  metrics:
15
+ - loss
16
  ---
17
 
18
  # LiquidAgent-1.2B
19
 
20
+ A supervised fine-tune of [LiquidAI/LFM2.5-1.2B-Thinking](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Thinking) on agent traces from [TeichAI/Ox-Alpha-Pi-Traces](https://huggingface.co/datasets/TeichAI/Ox-Alpha-Pi-Traces), with tool results properly included in the training data.
21
+
22
+ ## What this is
23
+
24
+ The base LFM2.5-1.2B-Thinking model is a 1.17B-param hybrid architecture (10 LIV-conv + 6 GQA blocks, 32K context, 65536 vocab) with built-in thinking. This fine-tune adapts it for agentic tool-use: the model learns to emit tool calls, see the tool results, and reason about them in subsequent turns.
25
+
26
+ **Key fix over prior attempts:** The original parser for the TeichAI data silently dropped all `toolResult` messages (the `type` field is always `"message"` in the raw data, and tool results arrive as `message.role == "toolResult"` - a branch that did not exist). This fine-tune uses a fixed parser that recovers 100% of tool turns (verified: 562/562 on a 50-file sample).
27
+
28
+ ## Training details
29
+
30
+ - **Base:** LiquidAI/LFM2.5-1.2B-Thinking (bfloat16)
31
+ - **Data:** 379 examples, ~1.34M assistant tokens (from Ox-Alpha-Pi-Traces, 400 session files, 397 usable)
32
+ - **Optimizer:** AdamW 8-bit, lr 2e-6 to 8e-6 (cosine warmup over 47 steps)
33
+ - **Hardware:** NVIDIA RTX 5090 (32 GB), gradient checkpointing, batch size 1
34
+ - **Duration:** 81 seconds (47 steps)
35
+ - **Final loss:** 0.5965 (step 40) - training completed at step 47
36
 
37
  ## Architecture
38
 
39
  | Parameter | Value |
40
  |-----------|-------|
41
+ | Params | 1,170,340,608 (tied embedding) |
42
+ | Layers | 16 (10 conv + 6 full attention) |
 
43
  | Hidden size | 2048 |
44
+ | FF dim | 12288 |
45
+ | Attention heads | 32 Q / 8 KV |
46
+ | Vocab | 65,536 |
47
+ | Context | 32,768 (max_position_embeddings: 128,000) |
 
48
  | Dtype | bfloat16 |
49
 
 
 
 
 
 
 
 
 
50
  ## Usage
51
 
52
  ```python
 
55
  model = AutoModelForCausalLM.from_pretrained(
56
  "Compactbot/liquidagent-1.2b",
57
  torch_dtype="bfloat16",
58
+ device_map="auto",
59
  )
60
  tokenizer = AutoTokenizer.from_pretrained("Compactbot/liquidagent-1.2b")
61
 
62
+ messages = [{"role": "user", "content": "Write a Python function to parse a JSON config file."}]
63
  text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
64
  inputs = tokenizer(text, return_tensors="pt").to(model.device)
65
+ out = model.generate(**inputs, max_new_tokens=512, temperature=0.7, top_p=0.9)
66
+ print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
67
  ```
68
 
69
+ ## Honest limitations
 
 
 
 
 
 
 
 
 
70
 
71
+ - Trained on only 379 examples (~1.3M tokens) - this is a very light adaptation, not a full agent training run.
72
+ - The model retains the base's thinking pattern (emits thinking blocks before responding).
73
+ - No independent benchmark evaluation was run; quality was verified by generation samples (coherent, on-topic, no degenerate repetition).
74
+ - The 32k sequence length requested by the requester was not used in this run (data was packed at shorter lengths to fit the 32GB GPU with 8-bit AdamW).