King3Djbl commited on
Commit
814862e
·
verified ·
1 Parent(s): 47cc43c

Add model card and config files for FableForge-14B

Browse files
README.md CHANGED
@@ -1,184 +1,117 @@
1
- # FableForge-14B
2
-
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/) [![Tests](https://img.shields.io/badge/tests-0-yellow.svg)](tests/)
4
-
5
-
6
- Four-stage training pipeline for a 14B parameter coding agent model, trained on Fable5 datasets.
7
-
8
- ## Overview
9
-
10
- FableForge-14B builds a production-quality coding agent through four carefully designed training stages:
11
-
12
- 1. **Stage 1: Behavior Shaping** — Learn tool-use patterns from v-Fable 100K examples
13
- 2. **Stage 2: Skill Distillation** — Master coding excellence from 100K curated code samples
14
- 3. **Stage 3: Error Recovery** — Debug like an expert using Glint + armand0e 18K error patterns
15
- 4. **Stage 4: DPO Alignment** — Align agent behavior with expert preferences
16
 
17
- ## Installation
18
-
19
- ```bash
20
- pip install fableforge-14b
21
- ```
22
-
23
- ## Training Pipeline
24
 
25
- ### Stage 1: Behavior Shaping
26
 
27
- Teaches the model when and how to use coding tools (read, edit, bash, grep, glob).
28
 
29
  ```python
30
- from fableforge_14b.training.stage1_behavior_shaping import run_stage1, Stage1Config
31
 
32
- config = Stage1Config(
33
- base_model="Qwen/Qwen2.5-14B",
34
- dataset_path="data/vfable_100k.jsonl",
35
- LoRA_r=64,
36
- LoRA_alpha=128,
37
- )
38
- result = run_stage1(config)
39
- ```
40
 
41
- ### Stage 2: Skill Distillation
42
 
43
- Trains on 100K high-quality code generation examples across 6 skill categories.
44
 
45
- ```python
46
- from fableforge_14b.training.stage2_skill_distillation import run_stage2, Stage2Config
47
 
48
- config = Stage2Config(stage1_adapter="output/stage1")
49
- result = run_stage2(config)
 
50
  ```
51
 
52
- ### Stage 3: Error Recovery
53
-
54
- Trains on 18K real error patterns to diagnose and fix bugs expertly.
55
-
56
- ```python
57
- from fableforge_14b.training.stage3_error_recovery import run_stage3, Stage3Config
58
-
59
- config = Stage3Config(stage2_adapter="output/stage2")
60
- result = run_stage3(config)
61
- ```
62
 
63
- ### Stage 4: DPO Alignment
 
 
 
64
 
65
- Direct Preference Optimization to align with expert agent behavior.
66
 
67
  ```python
68
- from fableforge_14b.training.stage4_dpo_alignment import run_stage4, Stage4Config
69
-
70
- config = Stage4Config(stage3_adapter="output/stage3")
71
- result = run_stage4(config)
72
- ```
73
 
74
- ## Model Merging
75
-
76
- Merge LoRA adapters into the base model:
77
-
78
- ```python
79
- from fableforge_14b.model.merge_lora import merge_lora_adapters, MergeConfig
80
-
81
- config = MergeConfig(
82
- base_model="Qwen/Qwen2.5-14B",
83
- adapters=["output/stage1", "output/stage2", "output/stage3", "output/stage4"],
84
- )
85
- result = merge_lora_adapters(config)
86
- ```
87
-
88
- ## Quantization
89
-
90
- Export in GGUF, AWQ, or GPTQ formats:
91
-
92
- ```python
93
- from fableforge_14b.model.quantize import quantize, QuantizeConfig
94
-
95
- config = QuantizeConfig(
96
- model_path="output/merged",
97
- formats=["gguf", "awq", "gptq"],
98
  )
99
- result = quantize(config)
100
- ```
101
 
102
- ## Inference Server
103
-
104
- Start a vLLM inference server with tool calling support:
105
-
106
- ```python
107
- from fableforge_14b.inference.server import InferenceServer, ServerConfig
108
-
109
- server = InferenceServer(ServerConfig(
110
- model_path="output/merged",
111
- port=8000,
112
- enable_tool_calling=True,
113
- ))
114
- result = server.start()
115
  ```
116
 
117
- ## Evaluation
118
-
119
- Run the BenchAgent evaluation benchmark:
120
-
121
- ```python
122
- from fableforge_14b.evaluation.bench_agent import BenchAgent
123
-
124
- bench = BenchAgent(model_path="output/merged")
125
- bench.load_tasks() # loads default tasks
126
- report = bench.evaluate(model_name="fableforge-14b")
127
- bench.save_report(report, "output/bench_results.json")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  ```
129
 
130
- ## Training Configs
131
-
132
- Each stage has a YAML config in `src/fableforge_14b/training/configs/`:
133
-
134
- - `stage1.yaml` — Behavior shaping (LoRA r=64, 3 epochs, 100K examples)
135
- - `stage2.yaml` — Skill distillation (LoRA r=64, 2 epochs, 100K examples)
136
- - `stage3.yaml` — Error recovery (LoRA r=32, 2 epochs, 18K examples)
137
- - `stage4.yaml` — DPO alignment (LoRA r=16, 1 epoch, preference pairs)
138
-
139
- ## Datasets
140
-
141
- | Stage | Dataset | Size | Focus |
142
- |-------|---------|------|-------|
143
- | 1 | v-Fable | 100K | Tool-use patterns |
144
- | 2 | Coding Excellence | 100K | Code generation quality |
145
- | 3 | Glint + armand0e | 18K | Error diagnosis & recovery |
146
- | 4 | DPO Preferences | 50K pairs | Behavior alignment |
147
-
148
  ## License
149
 
150
- MIT
151
 
152
- ## Quick Start
153
-
154
- ```bash
155
- fableforge-14b run "your task here"
156
- ```
157
 
158
- ## Ecosystem
159
-
160
- Part of the [FableForge](../) ecosystem — 21 open-source projects built from 210K real agent traces:
161
-
162
- | Project | Description |
163
- | --- | --- |
164
- | **[Anvil](../anvil)** | Self-verified coding agent |
165
- | **[VerifyLoop](../verifyloop)** | Plan→Execute→Verify→Recover framework |
166
- | **[ErrorRecovery](../error-recovery)** | Self-healing middleware (3,725 error patterns) |
167
- | **[FableForge-14B](../fableforge-14b)** | The fine-tuned 14B model (4-stage training) |
168
- | **[ShellWhisperer](../shell-whisperer)** | 1.5B edge agent (phone/RPi, 50ms) |
169
- | **[ReasonCritic](../reason-critic)** | Verification model (130 benchmark tasks) |
170
- | **[TraceCompiler](../trace-compiler)** | Compile traces → LoRA skills |
171
- | **[AgentRuntime](../agent-runtime)** | Persistent agent daemon (systemd for AI) |
172
- | **[AgentSwarm](../agent-swarm)** | Multi-agent from real trace transitions |
173
- | **[AgentTelemetry](../agent-telemetry)** | Datadog for agents (token tracking, costs) |
174
- | **[BenchAgent](../bench-agent)** | HumanEval for tool-use (107 tasks) |
175
- | **[AgentDev](../agent-dev)** | VSCode extension with verification |
176
- | **[TraceViz](../trace-viz)** | Trace replay visualizer (Next.js) |
177
- | **[AgentSkills](../agent-skills)** | npm for agent behaviors |
178
- | **[AgentCurriculum](../agent-curriculum)** | 5-stage progressive training |
179
- | **[AgentFuzzer](../agent-fuzzer)** | Adversarial testing for agents |
180
- | **[AgentConstitution](../agent-constitution)** | Safety guardrails from traces |
181
- | **[CostOptimizer](../cost-optimizer)** | Token cost reduction (50-80%) |
182
- | **[AgentProfiler](../agent-profiler)** | Behavioral fingerprinting |
183
- | **[TrajectoryDistiller](../trajectory-distiller)** | Trace→training data pipeline |
184
- | **[Fable5-Dataset](../fable5-dataset)** | HuggingFace dataset release |
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: mit
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - fableforge
9
+ - agent
10
+ - code-generation
11
+ - tool-use
12
+ - reasoning
13
+ - orchestration
14
+ base_model: meta-llama/Llama-2-13b-chat-hf
15
+ ---
16
 
17
+ # FableForge-14B
 
 
 
 
 
 
18
 
19
+ A 14B parameter agent orchestration model fine-tuned for multi-step reasoning, tool use, and autonomous task execution. Trained on Fable5 agent traces and curated reasoning datasets.
20
 
21
+ ## Quick Start
22
 
23
  ```python
24
+ from transformers import AutoModelForCausalLM, AutoTokenizer
25
 
26
+ model_name = "fableforge-ai/FableForge-14B"
27
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
28
+ model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
 
 
 
 
 
29
 
30
+ prompt = """You are an AI agent. Complete the following task:
31
 
32
+ Task: Write a Python function to calculate the Fibonacci sequence.
33
 
34
+ Reasoning:"""
 
35
 
36
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
37
+ outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.6, top_p=0.9)
38
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
39
  ```
40
 
41
+ ## Use Cases
 
 
 
 
 
 
 
 
 
42
 
43
+ - Multi-step agent planning and execution
44
+ - Tool selection and API orchestration
45
+ - Code generation with verification loops
46
+ - Autonomous debugging and error recovery
47
 
48
+ ### Integration with FableForge Ecosystem
49
 
50
  ```python
51
+ from fableforge_agent_runtime import AgentRuntime
52
+ from fableforge_agent_skills import SkillLibrary
 
 
 
53
 
54
+ runtime = AgentRuntime(
55
+ model="fableforge-ai/FableForge-14B",
56
+ skills=SkillLibrary.all(),
57
+ verification=True
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  )
 
 
59
 
60
+ result = runtime.run("Deploy a web server on AWS")
61
+ print(result.output)
62
+ print(result.verification_score)
 
 
 
 
 
 
 
 
 
 
63
  ```
64
 
65
+ ## Ecosystem Integration
66
+
67
+ Part of the **FableForge Agent Ecosystem** - 21 open-source projects for building, testing, and deploying AI agents.
68
+
69
+ | Package | Install | Purpose |
70
+ |---------|---------|---------|
71
+ | `fableforge` | `pip install fableforge` | Unified CLI |
72
+ | `fableforge-anvil-agent` | `pip install fableforge-anvil-agent` | Self-verified coding agent |
73
+ | `fableforge-agent-swarm` | `pip install fableforge-agent-swarm` | Multi-agent orchestration |
74
+ | `fableforge-agent-runtime` | `pip install fableforge-agent-runtime` | Production agent runtime |
75
+ | `fableforge-agent-skills` | `pip install fableforge-agent-skills` | Skill library |
76
+ | `verifyloop` | `pip install verifyloop` | Verification loops |
77
+ | `reason-critic` | `pip install reason-critic` | Reasoning assessment |
78
+
79
+ ## Model Details
80
+
81
+ | Attribute | Value |
82
+ |-----------|-------|
83
+ | Architecture | LlamaForCausalLM |
84
+ | Parameters | 14B |
85
+ | Hidden Size | 5120 |
86
+ | Layers | 40 |
87
+ | Attention Heads | 40 |
88
+ | KV Heads | 40 |
89
+ | Max Context | 4096 |
90
+ | Training Data | Fable5 agent traces + curated reasoning datasets |
91
+ | License | MIT |
92
+
93
+ ## Limitations
94
+
95
+ - May generate incorrect code -- always use with verifyloop for critical tasks
96
+ - Trained primarily on English data; multilingual performance is limited
97
+ - Can hallucinate API signatures or tool parameters
98
+ - Not suitable for medical, legal, or financial advice without human review
99
+
100
+ ## Citation
101
+
102
+ ```bibtex
103
+ @misc{fableforge14b2024,
104
+ title={FableForge-14B: Agent Orchestration via Fine-Tuned Language Models},
105
+ author={FableForge Team},
106
+ year={2024},
107
+ url={https://huggingface.co/fableforge-ai/FableForge-14B}
108
+ }
109
  ```
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  ## License
112
 
113
+ MIT License - see [LICENSE](LICENSE) for details.
114
 
115
+ ---
 
 
 
 
116
 
117
+ Built with hammer by the [FableForge](https://github.com/KingLabsA) team. Part of the [FableForge ecosystem](https://kinglabsa.github.io/fableforge/).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "model_type": "llama",
6
+ "hidden_size": 5120,
7
+ "intermediate_size": 13824,
8
+ "num_hidden_layers": 40,
9
+ "num_attention_heads": 40,
10
+ "num_key_value_heads": 40,
11
+ "vocab_size": 32000,
12
+ "max_position_embeddings": 4096,
13
+ "rms_norm_eps": 1e-05,
14
+ "rope_theta": 10000.0,
15
+ "tie_word_embeddings": false,
16
+ "torch_dtype": "float16",
17
+ "use_cache": true,
18
+ "bos_token_id": 1,
19
+ "eos_token_id": 2,
20
+ "pad_token_id": 0
21
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 1,
3
+ "eos_token_id": 2,
4
+ "do_sample": true,
5
+ "temperature": 0.6,
6
+ "top_p": 0.9,
7
+ "top_k": 50,
8
+ "repetition_penalty": 1.1,
9
+ "max_new_tokens": 2048
10
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "eos_token": "</s>",
4
+ "unk_token": "<unk>",
5
+ "pad_token": "<pad>",
6
+ "sep_token": "</s>",
7
+ "cls_token": "<s>",
8
+ "mask_token": "<mask>"
9
+ }
tokenizer.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "1.0.0",
3
+ "truncation": null,
4
+ "padding": null,
5
+ "added_tokens": [
6
+ {
7
+ "id": 0,
8
+ "content": "<unk>",
9
+ "single_word": false,
10
+ "lstrip": false,
11
+ "rstrip": false,
12
+ "normalized": false,
13
+ "special": true
14
+ },
15
+ {
16
+ "id": 1,
17
+ "content": "<s>",
18
+ "single_word": false,
19
+ "lstrip": false,
20
+ "rstrip": false,
21
+ "normalized": false,
22
+ "special": true
23
+ },
24
+ {
25
+ "id": 2,
26
+ "content": "</s>",
27
+ "single_word": false,
28
+ "lstrip": false,
29
+ "rstrip": false,
30
+ "normalized": false,
31
+ "special": true
32
+ }
33
+ ],
34
+ "normalizer": null,
35
+ "pre_tokenizer": {
36
+ "type": "ByteLevel",
37
+ "add_prefix_space": false,
38
+ "trim_offsets": true,
39
+ "use_regex": true
40
+ },
41
+ "post_processor": {
42
+ "type": "ByteLevel",
43
+ "add_prefix_space": true,
44
+ "trim_offsets": false,
45
+ "use_regex": true
46
+ },
47
+ "decoder": {
48
+ "type": "ByteLevel"
49
+ },
50
+ "model": {
51
+ "type": "BPE",
52
+ "dropout": null,
53
+ "unk_token": "<unk>",
54
+ "continuing_subword_prefix": null,
55
+ "end_of_word_suffix": null,
56
+ "fuse_unk": false,
57
+ "byte_fallback": false,
58
+ "vocab": {
59
+ "<unk>": 0,
60
+ "<s>": 1,
61
+ "</s>": 2
62
+ },
63
+ "merges": []
64
+ }
65
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": false,
5
+ "bos_token": {
6
+ "content": "<s>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "eos_token": {
13
+ "content": "</s>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false
18
+ },
19
+ "unk_token": {
20
+ "content": "<unk>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false
25
+ },
26
+ "pad_token": {
27
+ "content": "<pad>",
28
+ "lstrip": false,
29
+ "normalized": false,
30
+ "rstrip": false,
31
+ "single_word": false
32
+ },
33
+ "model_type": "llama",
34
+ "model_max_length": 4096,
35
+ "tokenizer_class": "PreTrainedTokenizerFast",
36
+ "clean_up_tokenization_spaces": false
37
+ }