File size: 3,201 Bytes
ca29f40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
license: other
library_name: transformers
pipeline_tag: text-generation
language:
- en
base_model: LiquidAI/LFM2.5-1.2B-Thinking
tags:
- lfm2
- agent
- fine-tune
- teichai
- thinking
metrics:
- perplexity
---

# LiquidAgent-1.2B

A supervised fine-tune of **LiquidAI/LFM2.5-1.2B-Thinking** on OpenAI-style agent
traces, intended to pick up the agent-trace format and style (thinking + text +
tool calls). Built for the model request in
[Compactbot/model-requests#15](https://huggingface.co/spaces/Compactbot/model-requests)
(requested by @DedeProGames).

> **License note:** This is a derivative of `LiquidAI/LFM2.5-1.2B-Thinking`,
> which is distributed under the **LFM Open License v1.0** (a custom license;
> `license: other` on the Hub). That license carries a commercial-use threshold
> ($10M annual revenue). Read the base model's LICENSE before commercial use.

## What it is

- **Base:** `LiquidAI/LFM2.5-1.2B-Thinking` (LFM2 / `Lfm2ForCausalLM`), bf16.
- **Params:** 1,170,340,608 (verified by loading the released weights).
- **Architecture:** 16 blocks — 10 LIV convolutional + 6 full-attention (GQA,
  32 query / 8 KV heads), `block_dim`/`hidden_size` 2048, `intermediate_size`
  12288, SwiGLU, RoPE (θ = 1e6), vocab 65536, max position 128000, tied
  embeddings.
- **Training:** full fine-tune (not LoRA), bf16, 8-bit AdamW, gradient
  checkpointing, batch 1, sequence length 32k, cosine LR, 1300 steps.
- **Data:** 379 agent-trace examples, ~1.34M assistant tokens, packed from
  `TeichAI/Ox-Alpha-Pi-Traces` + `TeichAI/DeepSeek-v4-Pro-Agent`. Training is
  masked so the model learns **assistant turns only** (thinking + text + tool
  calls); user / system / tool-result tokens are masked out.

## Honest quality picture

This is a **light fine-tune**: ~1.34M assistant tokens on top of a 1.2B base.
It reliably adopts the agent-trace format and thinking style of the source
traces, but it is not a strong agent and should not be expected to solve
multi-step agentic tasks reliably.

Verified by loading the released weights standalone and generating:
- Coherent, grammatical responses with well-formed `[[ctrl:think]]` blocks.
- Correct simple arithmetic (e.g. 27 × 43 = 1161; 12 + 7 = 19).
- No degenerate token loops in the sampled prompts.

## Usage

```python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "Compactbot/liquidagent-1.2b"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="bfloat16", device_map="cuda")

prompt = "User: What is 27 * 43? Answer briefly."
ids = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=256, do_sample=False,
                     pad_token_id=tok.eos_token_id)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
```

The chat template is the base model's (with thinking preservation), so
`apply_chat_template` works as-is.

## Reproducibility

- Base: `LiquidAI/LFM2.5-1.2B-Thinking`
- Datasets: `TeichAI/Ox-Alpha-Pi-Traces`, `TeichAI/DeepSeek-v4-Pro-Agent`
- Training: full SFT, bf16, 8-bit AdamW, grad checkpointing, batch 1, seq 32k,
  cosine LR, 1300 steps, masked to assistant turns.