jacob-valdez commited on
Commit
a454f57
·
verified ·
1 Parent(s): a17922a

Upload BuilderBrain small model

Browse files
README.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ tags:
5
+ - builderbrain
6
+ - compositional-ai
7
+ - grammar-constrained
8
+ - pytorch
9
+ - transformers
10
+ model-index:
11
+ - name: builderbrain-small
12
+ results: []
13
+ ---
14
+
15
+ # BuilderBrain Small Model
16
+
17
+ BuilderBrain is a dual-rail compositional AI system that extends pretrained transformers with learned composition blocks, grammar constraints, and executable plans.
18
+
19
+ ## Model Description
20
+
21
+ This is a small scale BuilderBrain model trained for compositional reasoning tasks.
22
+
23
+ ### Architecture
24
+
25
+ - **Base Model**: GPT-2 based transformer
26
+ - **Builder Rail**: Additional composition layer with discrete program skills
27
+ - **Grammar Constraints**: CFG/PEG parsing for structured outputs
28
+ - **Plan Validation**: DAG-based plan execution with precondition checking
29
+ - **Multi-objective Training**: Lagrangian optimization with constraint satisfaction
30
+
31
+ ### Training
32
+
33
+ - **Dataset**: Compositional reasoning tasks
34
+ - **Loss Functions**: Multi-objective with grammar, plan, and reuse constraints
35
+ - **Training Steps**: 50 epochs
36
+
37
+ ## Usage
38
+
39
+ ```python
40
+ from transformers import AutoTokenizer, AutoModelForCausalLM
41
+
42
+ tokenizer = AutoTokenizer.from_pretrained("builderbrain_small_1759327754")
43
+ model = AutoModelForCausalLM.from_pretrained("builderbrain_small_1759327754")
44
+
45
+ # Grammar-constrained generation
46
+ input_text = "Generate a JSON API call"
47
+ inputs = tokenizer(input_text, return_tensors="pt")
48
+
49
+ # Generate with grammar constraints (implementation specific)
50
+ outputs = model.generate(**inputs, max_length=150)
51
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
52
+ ```
53
+
54
+ ## Limitations
55
+
56
+ - This is a mock export for demonstration purposes
57
+ - In production, models would be trained on domain-specific datasets
58
+ - Grammar constraints and plan validation would be fully implemented
59
+
60
+ ## Citation
61
+
62
+ ```bibtex
63
+ @misc{builderbrain_small,
64
+ title={BuilderBrain: Dual-Rail Compositional AI System},
65
+ author={BuilderBrain Team},
66
+ year={2024},
67
+ url={https://github.com/JacobFV/builderbrain}
68
+ }
69
+ ```
model/config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "builderbrain",
3
+ "scale": "small",
4
+ "builderbrain_version": "1.0.0",
5
+ "model": {
6
+ "type": "gpt2",
7
+ "name": "gpt2",
8
+ "hidden_size": 768,
9
+ "num_layers": 4,
10
+ "num_programs": 16,
11
+ "alpha_cap": 0.1
12
+ },
13
+ "constraints": {
14
+ "grammar": {
15
+ "enabled": true,
16
+ "target": 0.0,
17
+ "normalizer": "rank"
18
+ },
19
+ "graph2graph": {
20
+ "enabled": true,
21
+ "target": 0.2,
22
+ "normalizer": "rank"
23
+ },
24
+ "buildability": {
25
+ "enabled": true,
26
+ "target": 0.0,
27
+ "normalizer": "winsor"
28
+ },
29
+ "reuse": {
30
+ "enabled": true,
31
+ "target": 0.5,
32
+ "normalizer": "rank"
33
+ }
34
+ },
35
+ "training": {
36
+ "batch_size": 8,
37
+ "learning_rate": "5e-4",
38
+ "eta_lambda": "1e-2",
39
+ "lambda_max": 20.0,
40
+ "num_epochs": 50,
41
+ "save_every": 10
42
+ },
43
+ "data": {
44
+ "max_length": 512,
45
+ "vocab_size": 50257
46
+ },
47
+ "runtime": {
48
+ "max_generation_length": 100,
49
+ "temperature": 0.8,
50
+ "use_grammar_mask": true
51
+ }
52
+ }
model/generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "max_new_tokens": 150,
3
+ "temperature": 0.7,
4
+ "top_p": 0.9,
5
+ "do_sample": true,
6
+ "pad_token_id": 50256,
7
+ "bos_token_id": 50256,
8
+ "eos_token_id": 50256
9
+ }
model/pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c532b929bb974691b379361fc095c803a9e50cb5052abe694ed5238e9bbf19d7
3
+ size 18
model/pytorch_model.bin.index.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 18
4
+ },
5
+ "weight_map": {
6
+ "model.embed_tokens.weight": "pytorch_model.bin",
7
+ "model.layers.0.weight": "pytorch_model.bin",
8
+ "lm_head.weight": "pytorch_model.bin"
9
+ }
10
+ }
model/special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "eos_token": "<|endoftext|>",
3
+ "unk_token": "<|endoftext|>",
4
+ "pad_token": "<|endoftext|>",
5
+ "additional_special_tokens": []
6
+ }
model/tokenizer/merges.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ # Mock merges file
model/tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_class": "GPT2Tokenizer",
3
+ "model_max_length": 1024,
4
+ "padding_side": "right",
5
+ "truncation_side": "right",
6
+ "pad_token": "<|endoftext|>",
7
+ "unk_token": "<|endoftext|>",
8
+ "eos_token": "<|endoftext|>",
9
+ "bos_token": "<|endoftext|>"
10
+ }
model/tokenizer/vocab.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"mock": "vocabulary"}