botbottingbot commited on
Commit
fb0b460
·
verified ·
1 Parent(s): b8af3c1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +97 -295
README.md CHANGED
@@ -1,334 +1,136 @@
1
- ## System-level view (60 seconds)
 
2
 
3
- This is **not** just a GPT-2 model.
4
 
5
- It is a small, self-contained **reasoning system** with:
 
6
 
7
- - **Modules**: task-specific lenses (Analysis Note, Strategy Memo, Document Explainer, etc.).
8
- - **Checkers**: second-pass reviewers that audit a module’s output.
9
- - **Contracts**: every module must answer in fixed sections (e.g. CONTEXT / OPTIONS / RISKS / NEXT_STEPS).
 
10
 
11
- Under the hood it still uses next-token prediction, but the **system behaviour** is:
12
 
13
- > free-form task choose lens (module) → generate structured output optional checker review.
14
 
15
- You can swap the engine (`gpt2`) for any stronger model. The **architecture stays the same**.
16
- ---
17
- library_name: transformers
18
- license: mit
19
- base_model: openai-community/gpt2
20
- language:
21
- - en
22
- tags:
23
- - modular-intelligence
24
- - text-generation
25
- - structured-reasoning
26
- - experimental
27
- ---
28
-
29
- # Modular Intelligence (GPT-2 baseline)
30
-
31
- This repository is an **experimental baseline** for **Modular Intelligence** built on top of `openai-community/gpt2`.
32
-
33
- The goal is **not** to claim that GPT-2 is “intelligent”, but to show how a **small, simple model** can be wrapped inside a **modular reasoning architecture**:
34
-
35
- - **Modules**: small, single-purpose “skills” (e.g. analysis note, strategy memo).
36
- - **Checkers**: strict reviewers that check the output of a module.
37
- - **Structured outputs**: fixed sections like CONTEXT / OPTIONS / RISKS / NEXT STEPS.
38
-
39
- Later, this same architecture can be reused with much stronger models.
40
 
41
  ---
42
 
43
- ## What this model is
44
-
45
- - A **GPT-2 checkpoint** configured as the engine behind a **Modular Intelligence** framework.
46
- - It is **not** heavily fine-tuned; it is used mainly to demonstrate:
47
- - Structured prompts
48
- - Module definitions
49
- - Checker patterns
50
- - Deterministic, repeatable formats
51
-
52
- Think of this repo as:
53
-
54
- > “The engine inside a modular reasoning system, using GPT-2 for a minimal, low-cost demo.”
 
 
 
 
 
 
 
55
 
56
  ---
57
 
58
- ## What’s different from base GPT-2?
59
 
60
- Base GPT-2 is a generic text generator.
61
-
62
- Here, GPT-2 is wrapped in a **specific contract**:
63
-
64
- 1. **Fixed module types**
65
- For example:
66
- - `analysis_note_v1`
67
- - `document_explainer_v1`
68
- - `strategy_memo_v1`
69
- - `message_reply_v1`
70
- - `profile_application_v1`
71
- - `system_blueprint_v1`
72
- - `modular_brainstorm_v1`
73
-
74
- 2. **Fixed output sections**
75
- Each module must respond in a strict, labelled format. Example (Strategy Memo):
76
-
77
- - CONTEXT
78
- - OBJECTIVE
79
- - CONSTRAINTS
80
- - OPTIONS
81
- - RECOMMENDATION
82
- - RISKS
83
- - NEXT_ACTIONS
84
-
85
- 3. **Paired checkers**
86
- Certain modules have a checker module that:
87
- - Re-reads the original task
88
- - Reviews the draft output
89
- - Returns a verdict + issues + suggested fixes
90
-
91
- 4. **Use pattern**
92
- Instead of “just generating text”, you:
93
- - Call a **module** with structured inputs
94
- - Get a **structured output**
95
- - Optionally call a **checker** on that output
96
-
97
- So the “intelligence” here is in the **architecture and prompts**, not in new weights.
98
 
99
  ---
100
 
101
- ## Dataset
102
-
103
- This repository **does not introduce** a new training dataset and **does not re-train** GPT-2.
104
-
105
- - **Base model**: `openai-community/gpt2`
106
- - **Training objective**: next-token prediction (causal language modeling)
107
- - **Original GPT-2 pretraining data** (by OpenAI, not included here):
108
- - Large, general-domain English web corpus (“WebText”)
109
- - ~40 GB of text from web pages linked from Reddit posts with score ≥ 3
110
- - Mixed content (news, blogs, forums, technical/non-technical)
111
-
112
- In this repository:
113
 
114
- - GPT-2 is used **as-is** as the language engine.
115
- - The **Modular Intelligence** behaviour comes from:
116
- - The **module prompts** (how we talk to the model)
117
- - The **checker prompts** (how we review its answers)
118
- - The **fixed output formats**
119
-
120
- No new datasets are uploaded or used for further fine-tuning inside this repo.
121
 
122
  ---
123
 
124
- ## Modular Intelligence: modules and checkers (simple view)
125
-
126
- ### Generator modules
127
-
128
- Each generator is a “skill” with a fixed format.
129
-
130
- 1. **Analysis Note (`analysis_note_v1`)**
131
-
132
- - **Inputs**:
133
- - `context` – short description of the situation or text
134
- - `questions` – what you want to understand
135
- - `constraints` – any limits (time, style, scope)
136
-
137
- - **Outputs (sections)**:
138
- - CONTEXT
139
- - QUESTIONS
140
- - FRAMEWORK
141
- - ANALYSIS
142
- - CONCLUSION
143
- - NEXT_STEPS
144
-
145
- 2. **Document Explainer (`document_explainer_v1`)**
146
-
147
- - **Inputs**:
148
- - `document_text`
149
- - `focus`
150
- - `audience`
151
-
152
- - **Outputs**:
153
- - SNAPSHOT
154
- - KEY_POINTS
155
- - STRUCTURE
156
- - DETAILED_EXPLANATION
157
- - IMPLICATIONS
158
- - ACTIONS
159
-
160
- 3. **Strategy Memo (`strategy_memo_v1`)**
161
-
162
- - **Inputs**:
163
- - `context`
164
- - `objective`
165
- - `constraints`
166
-
167
- - **Outputs**:
168
- - CONTEXT
169
- - OBJECTIVE
170
- - CONSTRAINTS
171
- - OPTIONS
172
- - RECOMMENDATION
173
- - RISKS
174
- - NEXT_ACTIONS
175
-
176
- 4. **Message / Post Reply (`message_reply_v1`)**
177
-
178
- - **Inputs**:
179
- - `source_text`
180
- - `your_angle`
181
- - `tone_notes`
182
-
183
- - **Outputs**:
184
- - DRAFT_REPLY
185
-
186
- 5. **Profile / Application Draft (`profile_application_v1`)**
187
-
188
- - **Inputs**:
189
- - `target_role_or_goal`
190
- - `your_background`
191
- - `audience`
192
-
193
- - **Outputs**:
194
- - POSITIONING
195
- - KEY_POINTS
196
- - FULL_DRAFT
197
-
198
- 6. **System / Architecture Blueprint (`system_blueprint_v1`)**
199
-
200
- - **Inputs**:
201
- - `objective`
202
- - `current_state`
203
- - `constraints`
204
-
205
- - **Outputs**:
206
- - OBJECTIVE
207
- - CURRENT_STATE
208
- - COMPONENTS
209
- - FLOWS
210
- - RISKS
211
- - IMPROVEMENTS
212
- - NEXT_STEPS
213
-
214
- 7. **Modular Brainstorm (`modular_brainstorm_v1`)**
215
-
216
- - **Inputs**:
217
- - `problem_or_domain`
218
- - `goal`
219
-
220
- - **Outputs**:
221
- - OBJECTIVE
222
- - CURRENT
223
- - MODULES
224
- - CHECKERS
225
- - DATA_NEEDS
226
- - NEXT_STEPS
227
-
228
- ---
229
-
230
- ### Checker modules
231
-
232
- Checkers are “reviewers” that inspect generated outputs.
233
-
234
- Examples:
235
-
236
- 1. **Analysis Note Checker (`analysis_note_checker_v1`)**
237
-
238
- - **Inputs**:
239
- - `original_task`
240
- - `draft_output`
241
-
242
- - **Outputs**:
243
- - VERDICT
244
- - STRUCTURE
245
- - CLARITY
246
- - ALIGNMENT
247
- - GAPS
248
- - FIXES
249
-
250
- 2. **Document Explainer Checker (`document_explainer_checker_v1`)**
251
 
252
- - VERDICT
253
- - ACCURACY
254
- - STRUCTURE
255
- - AUDIENCE_FIT
256
- - MISSING
257
- - FIXES
 
 
 
258
 
259
- 3. **Strategy Memo Checker (`strategy_memo_checker_v1`)**
260
-
261
- - VERDICT
262
- - OBJECTIVE_ALIGNMENT
263
- - CONSTRAINT_HANDLING
264
- - OPTION_QUALITY
265
- - RISKS
266
- - FIXES
267
-
268
- 4. **Style & Voice Checker (`style_voice_checker_v1`)**
269
-
270
- - VERDICT
271
- - STYLE_MATCH
272
- - TONE
273
- - REDUNDANCY
274
- - SUGGESTIONS
275
 
276
- 5. **Profile Checker (`profile_checker_v1`)**
277
 
278
- - VERDICT
279
- - ALIGNMENT
280
- - SIGNAL
281
- - CLARITY
282
- - FIXES
283
 
284
- 6. **System Checker (`system_blueprint_checker_v1`)**
 
 
 
 
285
 
286
- - VERDICT
287
- - COHERENCE
288
- - GAPS
289
- - FLOW_ISSUES
290
- - RISKS
291
- - FIXES
292
 
293
  ---
294
 
295
- ## How to use this model (simple)
296
-
297
- You can treat this model like any GPT-2 text generator, **but** if you want Modular Intelligence behaviour:
298
 
299
- 1. Pick a module (e.g. `strategy_memo_v1`).
300
- 2. Build a prompt that:
301
- - States the module name
302
- - Lists the inputs clearly
303
- - Lists the required output sections
304
 
305
- 3. Ask the model to **fill in each section in order**.
306
- 4. Optionally call the corresponding checker with:
307
- - Original task
308
- - Draft output
309
-
310
- A reference implementation and UI are provided in the accompanying Hugging Face Space (if linked), but the pattern can be re-implemented in any environment.
311
 
312
  ---
313
 
314
- ## Limitations
315
-
316
- - GPT-2 is **small and outdated** by modern standards.
317
- - It will:
318
- - Hallucinate
319
- - Get facts wrong
320
- - Sometimes ignore structure
321
- - Struggle with long contexts
322
 
323
- The goal is to demonstrate the **architecture**, not to claim state-of-the-art performance.
324
 
325
- Do **not** use this model for high-stakes decisions or any application where mistakes could cause real harm.
 
 
326
 
327
  ---
328
 
329
- ## License and IP
330
-
331
- - Code and configuration: **MIT License**.
332
- - The **Modular Intelligence architecture, module definitions, and checker patterns** are a conceptual layer that can be reused and extended, but the name and approach may be treated as separate intellectual property by the author.
333
-
334
- Always review the base model’s license (`openai-community/gpt2`) for any additional constraints.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Modular Intelligence
2
+ A Small but Complete Reasoning System Built on Top of a Language Model
3
 
4
+ ## System-Level View (60 Seconds)
5
 
6
+ This repository is not a standard GPT-2 model.
7
+ It is a compact reasoning system built on top of an LLM, using:
8
 
9
+ - Modules structured reasoning lenses
10
+ - Checkers – strict second-pass reviewers
11
+ - Contracts fixed output sections for every module
12
+ - Optional Router – automatic module selection from free-form tasks
13
 
14
+ Pipeline:
15
 
16
+ **TaskLens (Module) → Structured OutputChecker (Optional)**
17
 
18
+ The LLM engine is replaceable; the architecture is the system.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  ---
21
 
22
+ ## Architecture
23
+
24
+ +—————————————————————+
25
+ | MODULAR INTELLIGENCE |
26
+ +—————————————————————+
27
+ | User Task |
28
+ | | |
29
+ | v |
30
+ | [Auto-router or manual module selection] |
31
+ | | |
32
+ | v |
33
+ | +———————–+ +————————+ |
34
+ | | GENERATOR MODULE | ––> | CHECKER MODULE | |
35
+ | | (structured output) | | (optional verification)| |
36
+ | +———————–+ +————————+ |
37
+ | | ^ |
38
+ | v | |
39
+ | Structured Output Feedback / Fix Ideas |
40
+ +—————————————————————+
41
 
42
  ---
43
 
44
+ ## Repository Contents
45
 
46
+ - `modules.json` all modules, inputs, sections, checkers
47
+ - `app.py` — Gradio UI with optional auto-routing
48
+ - Model card
49
+ - GPT-2 base model (fully swappable)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  ---
52
 
53
+ ## Problem This Solves
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ Standard LLMs: unstructured text, drift, no audit trail.
56
+ Modular Intelligence: task decomposition, structured reasoning, verification, consistency, interpretability.
 
 
 
 
 
57
 
58
  ---
59
 
60
+ ## Modules (Lenses)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
+ | Module | Use |
63
+ |--------|-----|
64
+ | Analysis Note | Explain or break down text/situations |
65
+ | Document Explainer | Summaries of contracts/policies/articles |
66
+ | Strategy Memo | Options → Recommendation → Risks → Next Steps |
67
+ | Message/Post Reply | Structured replies |
68
+ | Profile/Application | Bios, cover letters, statements |
69
+ | System Blueprint | Design or improve systems and workflows |
70
+ | Modular Brainstorm | Decompose problems into modules/checkers |
71
 
72
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
+ ## Checker Layer
75
 
76
+ Checkers produce:
 
 
 
 
77
 
78
+ - VERDICT
79
+ - ALIGNMENT
80
+ - STRUCTURE
81
+ - GAPS
82
+ - FIXES
83
 
84
+ Implements: **Reason → Critique → Refine**.
 
 
 
 
 
85
 
86
  ---
87
 
88
+ ## End-to-End Example
 
 
89
 
90
+ Task: “Should we expand into a new city in 6 months?”
 
 
 
 
91
 
92
+ 1. Select `strategy_memo_v1`
93
+ 2. Fill: context, objective, constraints
94
+ 3. Run → structured memo with required sections
95
+ 4. Run checker → verdict + issues + fixes
 
 
96
 
97
  ---
98
 
99
+ ## Auto-Routing (Optional)
 
 
 
 
 
 
 
100
 
101
+ The provided `app.py` includes an **Auto-Route** tab:
102
 
103
+ 1. Paste free-form task
104
+ 2. Zero-shot classifier ranks modules
105
+ 3. Jump directly to best lens
106
 
107
  ---
108
 
109
+ ## Code Usage
110
+
111
+ ```python
112
+ from transformers import AutoTokenizer, AutoModelForCausalLM
113
+
114
+ tok = AutoTokenizer.from_pretrained("botbottingbot/Modular_Intelligence")
115
+ model = AutoModelForCausalLM.from_pretrained("botbottingbot/Modular_Intelligence")
116
+
117
+ prompt = """
118
+ MODULE: Strategy Memo
119
+ INPUTS:
120
+ CONTEXT: We are expanding to City X.
121
+ OBJECTIVE: Decide whether to enter within 6 months.
122
+ CONSTRAINTS: Budget limits; regulatory uncertainty.
123
+
124
+ OUTPUT SECTIONS:
125
+ - CONTEXT
126
+ - OBJECTIVE
127
+ - CONSTRAINTS
128
+ - OPTIONS
129
+ - RECOMMENDATION
130
+ - RISKS
131
+ - NEXT_ACTIONS
132
+ """
133
+
134
+ inp = tok(prompt, return_tensors="pt")
135
+ out = model.generate(**inp, max_new_tokens=250)
136
+ print(tok.decode(out[0], skip_special_tokens=