DJLougen commited on
Commit
32f947d
·
verified ·
1 Parent(s): 6bd86e5

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ library_name: transformers
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - busybeaver
7
+ - tool-calling
8
+ - agent-policy
9
+ - json
10
+ - local-agents
11
+ - qdelta
12
+ - 50m
13
+ private: true
14
+ ---
15
+
16
+ # BusyBeaver-50M
17
+
18
+ BusyBeaver-50M is a compact agent-policy model for strict JSON tool-call prediction. It is not a general chatbot. It takes a compact agent state, task goal, recent observations, and available tool schemas, then predicts exactly one next tool call for a local agent harness.
19
+
20
+ This repository is the canonical packaging of the internally tracked V10 checkpoint 200 run.
21
+
22
+ ## Intended Use
23
+
24
+ BusyBeaver-50M is meant to run beside larger agent models or deterministic harnesses as a cheap local policy head:
25
+
26
+ - choose the next tool call in SWE-agent style loops
27
+ - debug code-edit/test/inspect workflows
28
+ - emit strict JSON for local harnesses
29
+ - reduce repeated action loops and unsafe shell decisions
30
+ - provide analyzable trajectories for tool-policy evaluation
31
+
32
+ It is intended for controlled local workflows, not open-ended chat, advice generation, autonomous browsing, or unsupervised shell execution.
33
+
34
+ ## Model Size
35
+
36
+ - Parameters: 49,382,784
37
+ - Tokenizer: 16k BusyBeaver policy tokenizer
38
+ - Context length used in training/eval: 2048 tokens
39
+ - Architecture: local BusyBeaver QDelta causal LM
40
+ - Reloadable weights: `busybeaver_state.pt`
41
+
42
+ The included `model.safetensors` is kept for compatibility with the training output, but the current local loader should prefer `busybeaver_state.pt`.
43
+
44
+ ## Input Format
45
+
46
+ The model expects the compact BusyBeaver prompt format:
47
+
48
+ ```text
49
+ <|system|>
50
+ You are BusyBeaver, a small tool-policy model. Emit exactly one JSON object matching the schema. Do not explain.
51
+ <|goal|>
52
+ ...
53
+ <|state|>
54
+ ...
55
+ <|tools|>
56
+ ...
57
+ <|output_schema|>
58
+ {"tool":"string","args":"object","confidence":"number","state_update":"string"}
59
+ <|assistant|>
60
+ ```
61
+
62
+ The expected output is one strict JSON object:
63
+
64
+ ```json
65
+ {"tool":"read_file","args":{"path":"<PATH_FROM_STATE>"},"confidence":0.82,"state_update":"Read the referenced file before editing."}
66
+ ```
67
+
68
+ ## Tool Contract
69
+
70
+ BusyBeaver-50M was trained around a small canonical tool set:
71
+
72
+ - `read_file`
73
+ - `list_files`
74
+ - `run_shell`
75
+ - `run_tests`
76
+ - `apply_patch`
77
+ - `git_diff`
78
+ - `remember`
79
+ - `retrieve_memory`
80
+ - `escalate`
81
+
82
+ Harnesses should validate every emitted object before execution. Shell tools should remain dry-run or sandboxed by default.
83
+
84
+ ## Training Data
85
+
86
+ The training pipeline normalized public Hugging Face agent/function-call trajectories into state/action rows, then filtered them through the local Crucible pipeline. Sources included SWE/debug trajectory datasets and tool/function-calling datasets. The shipped V10 dataset uses intent/family state signals such as:
87
+
88
+ - `needs_source_lookup`
89
+ - `needs_code_change`
90
+ - `needs_validation`
91
+ - `needs_environment_check`
92
+
93
+ It does not use an exact `recommended_tool` field.
94
+
95
+ Filtering removed malformed rows, unsafe shell commands, credential-like content, prose-as-tool-call rows, duplicate rows, and examples with missing context. Long reasoning text was not used as a target; the model is trained to emit only a tool-call JSON object.
96
+
97
+ ## Evaluation
98
+
99
+ Held-out evaluation on `data/train_v10/test.jsonl`:
100
+
101
+ | Metric | Score |
102
+ | --- | ---: |
103
+ | JSON validity | 1.0000 |
104
+ | Strict JSON | 1.0000 |
105
+ | Schema validity | 1.0000 |
106
+ | Valid tool rate | 1.0000 |
107
+ | Correct tool accuracy | 0.9790 |
108
+ | Argument exact match | 0.9790 |
109
+ | Argument semantic match | 0.9802 |
110
+ | Unnecessary escalation rate | 0.0000 |
111
+ | Unsafe command rate | 0.0000 |
112
+
113
+ Grouped correct-tool accuracy:
114
+
115
+ | Group | Rows | Correct Tool |
116
+ | --- | ---: | ---: |
117
+ | edit | 138 | 1.0000 |
118
+ | execute | 98 | 1.0000 |
119
+ | inspect | 578 | 0.9689 |
120
+ | test | 43 | 1.0000 |
121
+
122
+ ## Loading
123
+
124
+ Use the BusyBeaver local implementation in this repository. The loader should instantiate `BusyBeaverQDeltaForCausalLM` from `config.json`, then load `busybeaver_state.pt`.
125
+
126
+ Example:
127
+
128
+ ```python
129
+ import torch
130
+ from busybeaver.modeling import BusyBeaverQDeltaConfig, BusyBeaverQDeltaForCausalLM
131
+
132
+ model_dir = "path/to/BusyBeaver-50M"
133
+ cfg = BusyBeaverQDeltaConfig.from_pretrained(model_dir)
134
+ model = BusyBeaverQDeltaForCausalLM(cfg)
135
+ state = torch.load(f"{model_dir}/busybeaver_state.pt", map_location="cpu")
136
+ model.load_state_dict(state, strict=True)
137
+ model.eval()
138
+ ```
139
+
140
+ ## Safety
141
+
142
+ BusyBeaver-50M predicts tool calls; it does not execute them. Production harnesses should:
143
+
144
+ - validate JSON and schema before execution
145
+ - reject unsafe shell commands
146
+ - run shell/test actions in a sandbox
147
+ - require dry-run mode by default
148
+ - cap repeated identical actions
149
+ - log every state/action pair for trajectory analysis
150
+
151
+ ## Limitations
152
+
153
+ - This is a specialized policy model, not a general assistant.
154
+ - It depends on the BusyBeaver prompt/state format.
155
+ - It is strongest when the larger planner or harness supplies compact state and intent signals.
156
+ - Browser-agent data was not the primary training target yet.
157
+ - The architecture is custom, so ordinary inference engines need a BusyBeaver adapter unless exported through a compatible runtime wrapper.
158
+
159
+ ## Provenance
160
+
161
+ - Internal run label: V10 intent-fast
162
+ - Promoted checkpoint: 200
163
+ - Local report: `reports/policy_training_run_v10_ckpt200_candidate.md`
164
+ - Previous best honest baseline: V9 checkpoint 1200 at 0.8959 correct-tool accuracy
busybeaver_eval/metrics.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "json_validity_rate": 1.0,
3
+ "strict_json_rate": 1.0,
4
+ "schema_validity_rate": 1.0,
5
+ "valid_tool_rate": 1.0,
6
+ "correct_tool_accuracy": 0.9765625,
7
+ "argument_exact_match": 0.9765625,
8
+ "argument_semantic_match": 0.9765625,
9
+ "groups": {
10
+ "edit": {
11
+ "n": 40,
12
+ "json_validity_rate": 1.0,
13
+ "strict_json_rate": 1.0,
14
+ "schema_validity_rate": 1.0,
15
+ "valid_tool_rate": 1.0,
16
+ "correct_tool_accuracy": 1.0,
17
+ "argument_exact_match": 1.0,
18
+ "argument_semantic_match": 1.0
19
+ },
20
+ "execute": {
21
+ "n": 27,
22
+ "json_validity_rate": 1.0,
23
+ "strict_json_rate": 1.0,
24
+ "schema_validity_rate": 1.0,
25
+ "valid_tool_rate": 1.0,
26
+ "correct_tool_accuracy": 1.0,
27
+ "argument_exact_match": 1.0,
28
+ "argument_semantic_match": 1.0
29
+ },
30
+ "inspect": {
31
+ "n": 172,
32
+ "json_validity_rate": 1.0,
33
+ "strict_json_rate": 1.0,
34
+ "schema_validity_rate": 1.0,
35
+ "valid_tool_rate": 1.0,
36
+ "correct_tool_accuracy": 0.9651162790697675,
37
+ "argument_exact_match": 0.9651162790697675,
38
+ "argument_semantic_match": 0.9651162790697675
39
+ },
40
+ "test": {
41
+ "n": 17,
42
+ "json_validity_rate": 1.0,
43
+ "strict_json_rate": 1.0,
44
+ "schema_validity_rate": 1.0,
45
+ "valid_tool_rate": 1.0,
46
+ "correct_tool_accuracy": 1.0,
47
+ "argument_exact_match": 1.0,
48
+ "argument_semantic_match": 1.0
49
+ }
50
+ }
51
+ }
busybeaver_eval/report.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BusyBeaver Checkpoint Evaluation
2
+
3
+ - Step: 200
4
+
5
+ - json_validity_rate: 1.0000
6
+ - strict_json_rate: 1.0000
7
+ - schema_validity_rate: 1.0000
8
+ - valid_tool_rate: 1.0000
9
+ - correct_tool_accuracy: 0.9766
10
+ - argument_exact_match: 0.9766
11
+ - argument_semantic_match: 0.9766
12
+
13
+ ## Grouped Metrics
14
+
15
+ ### edit (n=40)
16
+ - json_validity_rate: 1.0000
17
+ - strict_json_rate: 1.0000
18
+ - schema_validity_rate: 1.0000
19
+ - valid_tool_rate: 1.0000
20
+ - correct_tool_accuracy: 1.0000
21
+ - argument_exact_match: 1.0000
22
+ - argument_semantic_match: 1.0000
23
+ ### execute (n=27)
24
+ - json_validity_rate: 1.0000
25
+ - strict_json_rate: 1.0000
26
+ - schema_validity_rate: 1.0000
27
+ - valid_tool_rate: 1.0000
28
+ - correct_tool_accuracy: 1.0000
29
+ - argument_exact_match: 1.0000
30
+ - argument_semantic_match: 1.0000
31
+ ### inspect (n=172)
32
+ - json_validity_rate: 1.0000
33
+ - strict_json_rate: 1.0000
34
+ - schema_validity_rate: 1.0000
35
+ - valid_tool_rate: 1.0000
36
+ - correct_tool_accuracy: 0.9651
37
+ - argument_exact_match: 0.9651
38
+ - argument_semantic_match: 0.9651
39
+ ### test (n=17)
40
+ - json_validity_rate: 1.0000
41
+ - strict_json_rate: 1.0000
42
+ - schema_validity_rate: 1.0000
43
+ - valid_tool_rate: 1.0000
44
+ - correct_tool_accuracy: 1.0000
45
+ - argument_exact_match: 1.0000
46
+ - argument_semantic_match: 1.0000
busybeaver_eval/traces.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
busybeaver_state.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ebb34b27c60da61c2122f1891c42dac497cad9df546c02061245d63da106080
3
+ size 222742359
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BusyBeaverQDeltaForCausalLM"
4
+ ],
5
+ "conv_kernel_size": 4,
6
+ "dtype": "float32",
7
+ "hidden_size": 384,
8
+ "initializer_range": 0.02,
9
+ "intermediate_size": 1152,
10
+ "layer_pattern": [
11
+ "delta",
12
+ "delta",
13
+ "delta",
14
+ "attention"
15
+ ],
16
+ "max_position_embeddings": 2048,
17
+ "model_type": "busybeaver_qdelta",
18
+ "mtp_steps": 2,
19
+ "num_attention_heads": 6,
20
+ "num_hidden_layers": 16,
21
+ "num_key_value_heads": 2,
22
+ "num_tool_families": 8,
23
+ "rms_norm_eps": 1e-06,
24
+ "rope_theta": 1000000.0,
25
+ "transformers_version": "4.57.6",
26
+ "use_mtp": true,
27
+ "use_router_aux": true,
28
+ "vocab_size": 16384
29
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1443fd3505aa19fa1c6d3ffb7b0e2e6aa82b3941be41d540192d204ea460efb
3
+ size 197545296
rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4a9f217e852f439efa6bd32fde98d6867f11aa6ea13ddc021ba10af6a0b0934
3
+ size 14645
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d8f6ffb2e60dfea393aa338a0a59969df109c78532f2f01b3606dee6d328f3e4
3
+ size 1465
special_tokens_map.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "eos_token": "</s>",
4
+ "unk_token": "<unk>",
5
+ "pad_token": "<pad>",
6
+ "additional_special_tokens": [
7
+ "<busybeaver_task>",
8
+ "</busybeaver_task>",
9
+ "<tool_schema>",
10
+ "</tool_schema>",
11
+ "<|system|>",
12
+ "<|goal|>",
13
+ "<|state|>",
14
+ "<|tools|>",
15
+ "<|output_schema|>",
16
+ "<|assistant|>"
17
+ ]
18
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "eos_token": "</s>",
4
+ "unk_token": "<unk>",
5
+ "pad_token": "<pad>",
6
+ "additional_special_tokens": [
7
+ "<busybeaver_task>",
8
+ "</busybeaver_task>",
9
+ "<tool_schema>",
10
+ "</tool_schema>",
11
+ "<|system|>",
12
+ "<|goal|>",
13
+ "<|state|>",
14
+ "<|tools|>",
15
+ "<|output_schema|>",
16
+ "<|assistant|>"
17
+ ],
18
+ "model_max_length": 2048,
19
+ "clean_up_tokenization_spaces": false
20
+ }
trainer_state.json ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 0.15047493651838614,
6
+ "eval_steps": 100,
7
+ "global_step": 200,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.007523746825919308,
14
+ "grad_norm": 60.44245910644531,
15
+ "learning_rate": 1.7999999999999997e-05,
16
+ "loss": 86.4235,
17
+ "step": 10
18
+ },
19
+ {
20
+ "epoch": 0.015047493651838616,
21
+ "grad_norm": 40.04138946533203,
22
+ "learning_rate": 3.8e-05,
23
+ "loss": 65.01,
24
+ "step": 20
25
+ },
26
+ {
27
+ "epoch": 0.022571240477757923,
28
+ "grad_norm": 30.586576461791992,
29
+ "learning_rate": 5.7999999999999994e-05,
30
+ "loss": 45.3936,
31
+ "step": 30
32
+ },
33
+ {
34
+ "epoch": 0.030094987303677233,
35
+ "grad_norm": 27.570419311523438,
36
+ "learning_rate": 7.8e-05,
37
+ "loss": 34.0648,
38
+ "step": 40
39
+ },
40
+ {
41
+ "epoch": 0.037618734129596536,
42
+ "grad_norm": 26.078763961791992,
43
+ "learning_rate": 9.799999999999998e-05,
44
+ "loss": 28.1261,
45
+ "step": 50
46
+ },
47
+ {
48
+ "epoch": 0.045142480955515846,
49
+ "grad_norm": 24.367155075073242,
50
+ "learning_rate": 0.00011799999999999998,
51
+ "loss": 23.8896,
52
+ "step": 60
53
+ },
54
+ {
55
+ "epoch": 0.052666227781435156,
56
+ "grad_norm": 18.385601043701172,
57
+ "learning_rate": 0.000138,
58
+ "loss": 19.575,
59
+ "step": 70
60
+ },
61
+ {
62
+ "epoch": 0.060189974607354466,
63
+ "grad_norm": 13.478289604187012,
64
+ "learning_rate": 0.00015799999999999996,
65
+ "loss": 14.9189,
66
+ "step": 80
67
+ },
68
+ {
69
+ "epoch": 0.06771372143327377,
70
+ "grad_norm": 8.762843132019043,
71
+ "learning_rate": 0.000178,
72
+ "loss": 10.0506,
73
+ "step": 90
74
+ },
75
+ {
76
+ "epoch": 0.07523746825919307,
77
+ "grad_norm": 8.72549057006836,
78
+ "learning_rate": 0.000198,
79
+ "loss": 5.6379,
80
+ "step": 100
81
+ },
82
+ {
83
+ "epoch": 0.07523746825919307,
84
+ "eval_loss": 0.49864813685417175,
85
+ "eval_runtime": 38.1955,
86
+ "eval_samples_per_second": 32.91,
87
+ "eval_steps_per_second": 8.247,
88
+ "step": 100
89
+ },
90
+ {
91
+ "epoch": 0.08276121508511239,
92
+ "grad_norm": 6.59492826461792,
93
+ "learning_rate": 0.00021799999999999999,
94
+ "loss": 2.9898,
95
+ "step": 110
96
+ },
97
+ {
98
+ "epoch": 0.09028496191103169,
99
+ "grad_norm": 2.056182384490967,
100
+ "learning_rate": 0.00023799999999999998,
101
+ "loss": 1.6078,
102
+ "step": 120
103
+ },
104
+ {
105
+ "epoch": 0.09780870873695101,
106
+ "grad_norm": 1.4380172491073608,
107
+ "learning_rate": 0.000258,
108
+ "loss": 0.8847,
109
+ "step": 130
110
+ },
111
+ {
112
+ "epoch": 0.10533245556287031,
113
+ "grad_norm": 1.7172917127609253,
114
+ "learning_rate": 0.000278,
115
+ "loss": 0.6103,
116
+ "step": 140
117
+ },
118
+ {
119
+ "epoch": 0.11285620238878961,
120
+ "grad_norm": 0.5045933723449707,
121
+ "learning_rate": 0.000298,
122
+ "loss": 0.3398,
123
+ "step": 150
124
+ },
125
+ {
126
+ "epoch": 0.12037994921470893,
127
+ "grad_norm": 0.30618351697921753,
128
+ "learning_rate": 0.0002964,
129
+ "loss": 0.1732,
130
+ "step": 160
131
+ },
132
+ {
133
+ "epoch": 0.12790369604062823,
134
+ "grad_norm": 0.7540925145149231,
135
+ "learning_rate": 0.0002924,
136
+ "loss": 0.1196,
137
+ "step": 170
138
+ },
139
+ {
140
+ "epoch": 0.13542744286654754,
141
+ "grad_norm": 0.25162777304649353,
142
+ "learning_rate": 0.00028839999999999996,
143
+ "loss": 0.1363,
144
+ "step": 180
145
+ },
146
+ {
147
+ "epoch": 0.14295118969246684,
148
+ "grad_norm": 0.12225139141082764,
149
+ "learning_rate": 0.0002844,
150
+ "loss": 0.0717,
151
+ "step": 190
152
+ },
153
+ {
154
+ "epoch": 0.15047493651838614,
155
+ "grad_norm": 1.7007333040237427,
156
+ "learning_rate": 0.0002804,
157
+ "loss": 0.1011,
158
+ "step": 200
159
+ },
160
+ {
161
+ "epoch": 0.15047493651838614,
162
+ "eval_loss": 0.012117554433643818,
163
+ "eval_runtime": 38.2632,
164
+ "eval_samples_per_second": 32.851,
165
+ "eval_steps_per_second": 8.232,
166
+ "step": 200
167
+ }
168
+ ],
169
+ "logging_steps": 10,
170
+ "max_steps": 900,
171
+ "num_input_tokens_seen": 0,
172
+ "num_train_epochs": 1,
173
+ "save_steps": 100,
174
+ "stateful_callbacks": {
175
+ "TrainerControl": {
176
+ "args": {
177
+ "should_epoch_stop": false,
178
+ "should_evaluate": false,
179
+ "should_log": false,
180
+ "should_save": true,
181
+ "should_training_stop": false
182
+ },
183
+ "attributes": {}
184
+ }
185
+ },
186
+ "total_flos": 3388839926169600.0,
187
+ "train_batch_size": 4,
188
+ "trial_name": null,
189
+ "trial_params": null
190
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0d2535d2d034cc23032036ce4ac74d7680256890d3513f7979a162ddb0b04ced
3
+ size 5841