AnkitAI's picture
Upload README.md with huggingface_hub
2daba57 verified
|
Raw
History Blame Contribute Delete
5.56 kB
---
license: apache-2.0
base_model: Nanbeige/Nanbeige4.2-3B
datasets:
- Glint-Research/Fable-5-traces
- Roman1111111/gpt5.5-terminal
pipeline_tag: text-generation
tags:
- qlora
- agentic
- coding
- reasoning
- nanbeige
---
# Parable-Nanbeige4.2-3B-Claude-Fable-5
![Nanbeige4.2-3B](banner.svg)
Part of the **Parable** series: small local LLMs fine-tuned on genuine agent
traces. This is the reasoning-style chat variant of Nanbeige4.2-3B (to our
knowledge the first published fine-tune of this base), tuned on real Claude
Fable 5 agent transcripts so its step-by-step reasoning voice carries into
local use.
GGUF quants for llama.cpp / Ollama / LM Studio: [Parable-Nanbeige4.2-3B-Claude-Fable-5-GGUF](https://huggingface.co/AnkitAI/Parable-Nanbeige4.2-3B-Claude-Fable-5-GGUF)
## Usage
`trust_remote_code=True` is required: the architecture ships its own
modeling code (`modeling_nanbeige.py`, included in this repo).
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained(
"AnkitAI/Parable-Nanbeige4.2-3B-Claude-Fable-5", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
"AnkitAI/Parable-Nanbeige4.2-3B-Claude-Fable-5",
torch_dtype="bfloat16", device_map="auto", trust_remote_code=True)
msgs = [{"role": "user", "content": "Write a python function that reverses a string."}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
print(tok.decode(model.generate(ids, max_new_tokens=512, use_cache=False)[0]))
```
Note `use_cache=False`: the base architecture's modeling code was written
against transformers 4.42 and calls a cache API that transformers removed in
later versions, so cached generation crashes with
`'DynamicCache' object has no attribute 'get_max_length'` on transformers
4.47+. Either pass `use_cache=False` (shown above, slower) or pin
`transformers>=4.42,<4.47`. Training and loss computation are unaffected.
Output begins with a `<think>...</think>` reasoning block, then the answer.
If you are building on top of this model, parse and strip the think block
before showing text to end users.
The architecture runs its 22-layer stack twice (`num_loops: 2`, effective
depth 44). This is encoded in the GGUF and handled automatically; expect
roughly 2x the per-token compute of a typical 22-layer model of this width.
## Model details
- **Base:** [Nanbeige/Nanbeige4.2-3B](https://huggingface.co/Nanbeige/Nanbeige4.2-3B) (4.17B params, 3B non-embedding, Apache-2.0)
- **Method:** QLoRA (nf4, r=16, alpha=32) on the standard 7-module target set, all 22 layers (154 adapted modules)
- **Data:** 845 genuine Claude Fable 5 agent-session traces (chat variant: prose answers, `<think>` reasoning preserved) + 362 replay rows (OpenCoder educational_instruct + tulu-3 mix) to limit forgetting; 98% of rows retain their full assistant span at the 3,072-token training window
- **Schedule:** 380 optimizer steps, effective batch 8, completion-only loss masking, cosine LR
- **Held-out trace loss:** 2.333 (base) → **2.133** (tuned), same 225-trace held-out set never used in training
## Evaluation
The number above is a held-out language-modeling loss on real agent traces:
it measures how much better the model fits the Fable-5 reasoning
distribution, and it is the honest headline for what this fine-tune does.
We do not claim benchmark gains over the base model. Nanbeige4.2-3B's model
card reports strong agentic results (SWE-bench Verified 63.6, Terminal-Bench
2.0 44.1, vendor self-reported); this variant trains the *reasoning voice*,
not tool-calling, and prose-only SFT should be expected to trade a little
benchmark sharpness for style fidelity. If you need maximum benchmark
performance on agentic harnesses, use the base; if you want its capability
with a transparent, well-structured reasoning trace in local use, use this.
## Limitations
- The base model's own benchmark figures are vendor self-reported and were
not independently reproduced here.
- Training ran on a 4-bit quantized base (QLoRA); the F16 merge cannot exceed
4-bit-base quality.
- Requires very recent llama.cpp (2026-07-27+); ecosystem tools bundling
older builds will not load it yet.
## Provenance & licensing
Fine-tuned from Nanbeige/Nanbeige4.2-3B (Apache-2.0). Training data:
[Glint-Research/Fable-5-traces](https://huggingface.co/datasets/Glint-Research/Fable-5-traces)
(AGPL-3.0) and
[Roman1111111/gpt5.5-terminal](https://huggingface.co/datasets/Roman1111111/gpt5.5-terminal)
(MIT). Because those traces originate from third-party assistants, the
providers' terms may apply to downstream training and distillation. If you
plan to build on this model commercially, confirm your use aligns with those
terms.
## Citation
The recipe, evaluation methodology and failure analysis behind this model are
documented in the tech report:
> Aglawe, A. (2026). *Agent-Trace Fine-Tuning of Small Language Models under
> Constrained Compute.* Zenodo. [doi:10.5281/zenodo.21676407](https://doi.org/10.5281/zenodo.21676407)
```bibtex
@misc{aglawe2026agenttrace,
author = {Aglawe, Ankit},
title = {Agent-Trace Fine-Tuning of Small Language Models under Constrained Compute},
year = {2026},
publisher = {Zenodo},
doi = {10.5281/zenodo.21676407},
url = {https://doi.org/10.5281/zenodo.21676407}
}
```
## Acknowledgements
The Nanbeige team for the base model; Glint-Research and Roman1111111 for the
trace datasets; empero-ai for the recipe this series iterates on.