Update README.md
Browse files
README.md
CHANGED
|
@@ -1,146 +1,63 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
-
language:
|
| 4 |
-
- en
|
| 5 |
-
pipeline_tag: text-generation
|
| 6 |
-
library_name: transformers
|
| 7 |
tags:
|
| 8 |
-
-
|
| 9 |
-
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
This repository is not a standard GPT-2 model.
|
| 17 |
-
It is a compact reasoning system built on top of an LLM, using:
|
| 18 |
-
|
| 19 |
-
- Modules – structured reasoning lenses
|
| 20 |
-
- Checkers – strict second-pass reviewers
|
| 21 |
-
- Contracts – fixed output sections for every module
|
| 22 |
-
- Optional Router – automatic module selection from free-form tasks
|
| 23 |
-
|
| 24 |
-
Pipeline:
|
| 25 |
-
|
| 26 |
-
**Task → Lens (Module) → Structured Output → Checker (Optional)**
|
| 27 |
-
|
| 28 |
-
The LLM engine is replaceable; the architecture is the system.
|
| 29 |
-
|
| 30 |
-
---
|
| 31 |
-
|
| 32 |
-
## Architecture
|
| 33 |
-
|
| 34 |
-
+—————————————————————+
|
| 35 |
-
| MODULAR INTELLIGENCE |
|
| 36 |
-
+—————————————————————+
|
| 37 |
-
| User Task |
|
| 38 |
-
| | |
|
| 39 |
-
| v |
|
| 40 |
-
| [Auto-router or manual module selection] |
|
| 41 |
-
| | |
|
| 42 |
-
| v |
|
| 43 |
-
| +———————–+ +————————+ |
|
| 44 |
-
| | GENERATOR MODULE | ––> | CHECKER MODULE | |
|
| 45 |
-
| | (structured output) | | (optional verification)| |
|
| 46 |
-
| +———————–+ +————————+ |
|
| 47 |
-
| | ^ |
|
| 48 |
-
| v | |
|
| 49 |
-
| Structured Output Feedback / Fix Ideas |
|
| 50 |
-
+—————————————————————+
|
| 51 |
-
|
| 52 |
-
---
|
| 53 |
-
|
| 54 |
-
## Repository Contents
|
| 55 |
-
|
| 56 |
-
- `modules.json` — all modules, inputs, sections, checkers
|
| 57 |
-
- `app.py` — Gradio UI with optional auto-routing
|
| 58 |
-
- Model card
|
| 59 |
-
- GPT-2 base model (fully swappable)
|
| 60 |
-
|
| 61 |
---
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
Standard LLMs: unstructured text, drift, no audit trail.
|
| 66 |
-
Modular Intelligence: task decomposition, structured reasoning, verification, consistency, interpretability.
|
| 67 |
-
|
| 68 |
-
---
|
| 69 |
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|--------|-----|
|
| 74 |
-
| Analysis Note | Explain or break down text/situations |
|
| 75 |
-
| Document Explainer | Summaries of contracts/policies/articles |
|
| 76 |
-
| Strategy Memo | Options → Recommendation → Risks → Next Steps |
|
| 77 |
-
| Message/Post Reply | Structured replies |
|
| 78 |
-
| Profile/Application | Bios, cover letters, statements |
|
| 79 |
-
| System Blueprint | Design or improve systems and workflows |
|
| 80 |
-
| Modular Brainstorm | Decompose problems into modules/checkers |
|
| 81 |
|
| 82 |
---
|
| 83 |
|
| 84 |
-
##
|
| 85 |
-
|
| 86 |
-
Checkers produce:
|
| 87 |
|
| 88 |
-
|
| 89 |
-
-
|
| 90 |
-
|
| 91 |
-
-
|
| 92 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
1. Select `strategy_memo_v1`
|
| 103 |
-
2. Fill: context, objective, constraints
|
| 104 |
-
3. Run → structured memo with required sections
|
| 105 |
-
4. Run checker → verdict + issues + fixes
|
| 106 |
|
| 107 |
---
|
| 108 |
|
| 109 |
-
##
|
| 110 |
-
|
| 111 |
-
The provided `app.py` includes an **Auto-Route** tab:
|
| 112 |
|
| 113 |
-
|
| 114 |
-
2. Zero-shot classifier ranks modules
|
| 115 |
-
3. Jump directly to best lens
|
| 116 |
-
|
| 117 |
-
---
|
| 118 |
-
|
| 119 |
-
## Code Usage
|
| 120 |
|
| 121 |
```python
|
| 122 |
-
from
|
| 123 |
-
|
| 124 |
-
tok = AutoTokenizer.from_pretrained("botbottingbot/Modular_Intelligence")
|
| 125 |
-
model = AutoModelForCausalLM.from_pretrained("botbottingbot/Modular_Intelligence")
|
| 126 |
-
|
| 127 |
-
prompt = """
|
| 128 |
-
MODULE: Strategy Memo
|
| 129 |
-
INPUTS:
|
| 130 |
-
CONTEXT: We are expanding to City X.
|
| 131 |
-
OBJECTIVE: Decide whether to enter within 6 months.
|
| 132 |
-
CONSTRAINTS: Budget limits; regulatory uncertainty.
|
| 133 |
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
- OPTIONS
|
| 139 |
-
- RECOMMENDATION
|
| 140 |
-
- RISKS
|
| 141 |
-
- NEXT_ACTIONS
|
| 142 |
-
"""
|
| 143 |
|
| 144 |
-
|
| 145 |
-
out = model.generate(**inp, max_new_tokens=250)
|
| 146 |
-
print(tok.decode(out[0], skip_special_tokens=
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
+
- modular-intelligence
|
| 5 |
+
- reasoning
|
| 6 |
+
- structure
|
| 7 |
+
- transformers
|
| 8 |
+
- experimental
|
| 9 |
+
base_model: openai-community/gpt2
|
| 10 |
+
pipeline_tag: text-generation
|
| 11 |
+
language: en
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Modular Intelligence
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
Modular Intelligence is a lightweight reasoning framework built on top of a language model.
|
| 17 |
+
It provides **Modules** (task-specific lenses), **Checkers** (second-pass reviewers), **Contracts** (structured output sections), and optional **Routing** (automatic module selection).
|
| 18 |
|
| 19 |
+
The base model is GPT-2, but the architecture is model-agnostic—any LLM can be plugged in.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
---
|
| 22 |
|
| 23 |
+
## Features
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
### Modules
|
| 26 |
+
Task-specific reasoning modes.
|
| 27 |
+
Examples:
|
| 28 |
+
- **Analysis Note** – explanation and breakdown of concepts
|
| 29 |
+
- **Document Explainer** – summaries of contracts, policies, articles
|
| 30 |
+
- **Strategy Memo** – Options → Recommendation → Risks → Next Steps
|
| 31 |
+
- **System Blueprint** – workflow / system design
|
| 32 |
+
- **Brainstorm** – structured idea generation
|
| 33 |
+
- **Message Reply** – concise responses for emails, posts, chats
|
| 34 |
|
| 35 |
+
### Checkers
|
| 36 |
+
A second pass that evaluates:
|
| 37 |
+
- correctness
|
| 38 |
+
- clarity
|
| 39 |
+
- missing pieces
|
| 40 |
+
- contradictions
|
| 41 |
|
| 42 |
+
### Contracts
|
| 43 |
+
Every module produces a fixed output template.
|
| 44 |
+
This ensures reproducible structure and reduces variance.
|
| 45 |
|
| 46 |
+
### Router
|
| 47 |
+
Optional automatic module selection based on prompt classification.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
---
|
| 50 |
|
| 51 |
+
## Usage
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
### Python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
```python
|
| 56 |
+
from app import run_module
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
result = run_module(
|
| 59 |
+
module="StrategyMemo",
|
| 60 |
+
prompt="Should we expand operations to Region X next quarter?"
|
| 61 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
print(result)
|
|
|
|
|
|