Add LiquidAgent-1.2B: config, generation config, tokenizer config, and model card
Browse files- README.md +82 -0
- config.json +60 -0
- generation_config.json +7 -0
- tokenizer_config.json +19 -0
README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model: LiquidAI/LFM2.5-1.2B-Thinking
|
| 8 |
+
tags:
|
| 9 |
+
- lfm2
|
| 10 |
+
- agent
|
| 11 |
+
- fine-tune
|
| 12 |
+
- teichai
|
| 13 |
+
- thinking
|
| 14 |
+
metrics:
|
| 15 |
+
- perplexity
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# LiquidAgent-1.2B
|
| 19 |
+
|
| 20 |
+
A supervised fine-tune of **LiquidAI/LFM2.5-1.2B-Thinking** on OpenAI-style agent
|
| 21 |
+
traces, intended to pick up the agent-trace format and style (thinking + text +
|
| 22 |
+
tool calls). Built for the model request in
|
| 23 |
+
[Compactbot/model-requests#15](https://huggingface.co/spaces/Compactbot/model-requests)
|
| 24 |
+
(requested by @DedeProGames).
|
| 25 |
+
|
| 26 |
+
> **License note:** This is a derivative of `LiquidAI/LFM2.5-1.2B-Thinking`,
|
| 27 |
+
> which is distributed under the **LFM Open License v1.0** (a custom license;
|
| 28 |
+
> `license: other` on the Hub). That license carries a commercial-use threshold
|
| 29 |
+
> ($10M annual revenue). Read the base model's LICENSE before commercial use.
|
| 30 |
+
|
| 31 |
+
## What it is
|
| 32 |
+
|
| 33 |
+
- **Base:** `LiquidAI/LFM2.5-1.2B-Thinking` (LFM2 / `Lfm2ForCausalLM`), bf16.
|
| 34 |
+
- **Params:** 1,170,340,608 (verified by loading the released weights).
|
| 35 |
+
- **Architecture:** 16 blocks — 10 LIV convolutional + 6 full-attention (GQA,
|
| 36 |
+
32 query / 8 KV heads), `block_dim`/`hidden_size` 2048, `intermediate_size`
|
| 37 |
+
12288, SwiGLU, RoPE (θ = 1e6), vocab 65536, max position 128000, tied
|
| 38 |
+
embeddings.
|
| 39 |
+
- **Training:** full fine-tune (not LoRA), bf16, 8-bit AdamW, gradient
|
| 40 |
+
checkpointing, batch 1, sequence length 32k, cosine LR, 1300 steps.
|
| 41 |
+
- **Data:** 379 agent-trace examples, ~1.34M assistant tokens, packed from
|
| 42 |
+
`TeichAI/Ox-Alpha-Pi-Traces` + `TeichAI/DeepSeek-v4-Pro-Agent`. Training is
|
| 43 |
+
masked so the model learns **assistant turns only** (thinking + text + tool
|
| 44 |
+
calls); user / system / tool-result tokens are masked out.
|
| 45 |
+
|
| 46 |
+
## Honest quality picture
|
| 47 |
+
|
| 48 |
+
This is a **light fine-tune**: ~1.34M assistant tokens on top of a 1.2B base.
|
| 49 |
+
It reliably adopts the agent-trace format and thinking style of the source
|
| 50 |
+
traces, but it is not a strong agent and should not be expected to solve
|
| 51 |
+
multi-step agentic tasks reliably.
|
| 52 |
+
|
| 53 |
+
Verified by loading the released weights standalone and generating:
|
| 54 |
+
- Coherent, grammatical responses with well-formed `[[ctrl:think]]` blocks.
|
| 55 |
+
- Correct simple arithmetic (e.g. 27 × 43 = 1161; 12 + 7 = 19).
|
| 56 |
+
- No degenerate token loops in the sampled prompts.
|
| 57 |
+
|
| 58 |
+
## Usage
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 62 |
+
|
| 63 |
+
model_id = "Compactbot/liquidagent-1.2b"
|
| 64 |
+
tok = AutoTokenizer.from_pretrained(model_id)
|
| 65 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="bfloat16", device_map="cuda")
|
| 66 |
+
|
| 67 |
+
prompt = "User: What is 27 * 43? Answer briefly."
|
| 68 |
+
ids = tok(prompt, return_tensors="pt").to(model.device)
|
| 69 |
+
out = model.generate(ids, max_new_tokens=256, do_sample=False,
|
| 70 |
+
pad_token_id=tok.eos_token_id)
|
| 71 |
+
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
The chat template is the base model's (with thinking preservation), so
|
| 75 |
+
`apply_chat_template` works as-is.
|
| 76 |
+
|
| 77 |
+
## Reproducibility
|
| 78 |
+
|
| 79 |
+
- Base: `LiquidAI/LFM2.5-1.2B-Thinking`
|
| 80 |
+
- Datasets: `TeichAI/Ox-Alpha-Pi-Traces`, `TeichAI/DeepSeek-v4-Pro-Agent`
|
| 81 |
+
- Training: full SFT, bf16, 8-bit AdamW, grad checkpointing, batch 1, seq 32k,
|
| 82 |
+
cosine LR, 1300 steps, masked to assistant turns.
|
config.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Lfm2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"block_auto_adjust_ff_dim": true,
|
| 6 |
+
"block_dim": 2048,
|
| 7 |
+
"block_ffn_dim_multiplier": 1.0,
|
| 8 |
+
"block_mlp_init_scale": 1.0,
|
| 9 |
+
"block_multiple_of": 256,
|
| 10 |
+
"block_norm_eps": 1e-05,
|
| 11 |
+
"block_out_init_scale": 1.0,
|
| 12 |
+
"block_use_swiglu": true,
|
| 13 |
+
"block_use_xavier_init": true,
|
| 14 |
+
"bos_token_id": 1,
|
| 15 |
+
"conv_L_cache": 3,
|
| 16 |
+
"conv_bias": false,
|
| 17 |
+
"conv_dim": 2048,
|
| 18 |
+
"conv_use_xavier_init": true,
|
| 19 |
+
"dtype": "bfloat16",
|
| 20 |
+
"eos_token_id": 7,
|
| 21 |
+
"full_attn_idxs": null,
|
| 22 |
+
"hidden_size": 2048,
|
| 23 |
+
"initializer_range": 0.02,
|
| 24 |
+
"intermediate_size": 12288,
|
| 25 |
+
"layer_types": [
|
| 26 |
+
"conv",
|
| 27 |
+
"conv",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"conv",
|
| 30 |
+
"conv",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"conv",
|
| 33 |
+
"conv",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"conv",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"conv",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"conv",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"conv"
|
| 42 |
+
],
|
| 43 |
+
"max_position_embeddings": 128000,
|
| 44 |
+
"model_type": "lfm2",
|
| 45 |
+
"norm_eps": 1e-05,
|
| 46 |
+
"num_attention_heads": 32,
|
| 47 |
+
"num_heads": 32,
|
| 48 |
+
"num_hidden_layers": 16,
|
| 49 |
+
"num_key_value_heads": 8,
|
| 50 |
+
"pad_token_id": 0,
|
| 51 |
+
"rope_parameters": {
|
| 52 |
+
"rope_theta": 1000000.0,
|
| 53 |
+
"rope_type": "default"
|
| 54 |
+
},
|
| 55 |
+
"tie_word_embeddings": true,
|
| 56 |
+
"transformers_version": "5.5.0",
|
| 57 |
+
"use_cache": true,
|
| 58 |
+
"use_pos_enc": true,
|
| 59 |
+
"vocab_size": 65536
|
| 60 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 7,
|
| 5 |
+
"pad_token_id": 0,
|
| 6 |
+
"transformers_version": "5.5.0"
|
| 7 |
+
}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "[[ctrl:startoftext]]",
|
| 4 |
+
"clean_up_tokenization_spaces": false,
|
| 5 |
+
"eos_token": "[[ctrl:im_end]]",
|
| 6 |
+
"is_local": true,
|
| 7 |
+
"legacy": false,
|
| 8 |
+
"model_input_names": [
|
| 9 |
+
"input_ids",
|
| 10 |
+
"attention_mask"
|
| 11 |
+
],
|
| 12 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 13 |
+
"pad_token": "[[ctrl:pad]]",
|
| 14 |
+
"sp_model_kwargs": {},
|
| 15 |
+
"spaces_between_special_tokens": false,
|
| 16 |
+
"tokenizer_class": "TokenizersBackend",
|
| 17 |
+
"use_default_system_prompt": false,
|
| 18 |
+
"use_fast": true
|
| 19 |
+
}
|