cpu-llm 1.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cpu_llm-1.7.0/PKG-INFO +368 -0
- cpu_llm-1.7.0/README.md +334 -0
- cpu_llm-1.7.0/pyproject.toml +63 -0
- cpu_llm-1.7.0/setup.cfg +4 -0
- cpu_llm-1.7.0/src/cpu_llm/__init__.py +3 -0
- cpu_llm-1.7.0/src/cpu_llm/agents/__init__.py +5 -0
- cpu_llm-1.7.0/src/cpu_llm/agents/deep_search.py +67 -0
- cpu_llm-1.7.0/src/cpu_llm/agents/discovery.py +138 -0
- cpu_llm-1.7.0/src/cpu_llm/agents/gather.py +184 -0
- cpu_llm-1.7.0/src/cpu_llm/agents/imagine.py +149 -0
- cpu_llm-1.7.0/src/cpu_llm/agents/reply.py +334 -0
- cpu_llm-1.7.0/src/cpu_llm/agents/summarize.py +85 -0
- cpu_llm-1.7.0/src/cpu_llm/assembly.py +93 -0
- cpu_llm-1.7.0/src/cpu_llm/audit/__init__.py +3 -0
- cpu_llm-1.7.0/src/cpu_llm/audit/entailment.py +110 -0
- cpu_llm-1.7.0/src/cpu_llm/catalog.py +144 -0
- cpu_llm-1.7.0/src/cpu_llm/channels.py +409 -0
- cpu_llm-1.7.0/src/cpu_llm/checkpoints/vectorprism.pt +0 -0
- cpu_llm-1.7.0/src/cpu_llm/checkpoints/vectorprism.pt.json +31 -0
- cpu_llm-1.7.0/src/cpu_llm/classifier.py +143 -0
- cpu_llm-1.7.0/src/cpu_llm/clauses.py +138 -0
- cpu_llm-1.7.0/src/cpu_llm/cognition/__init__.py +13 -0
- cpu_llm-1.7.0/src/cpu_llm/cognition/adapter.py +416 -0
- cpu_llm-1.7.0/src/cpu_llm/comparison.py +153 -0
- cpu_llm-1.7.0/src/cpu_llm/consolidation/__init__.py +5 -0
- cpu_llm-1.7.0/src/cpu_llm/consolidation/sleep.py +357 -0
- cpu_llm-1.7.0/src/cpu_llm/cortex_sleep.py +211 -0
- cpu_llm-1.7.0/src/cpu_llm/cpu_guard.py +19 -0
- cpu_llm-1.7.0/src/cpu_llm/data/artificial-intelligence.md +139 -0
- cpu_llm-1.7.0/src/cpu_llm/data/wikitext-2-raw-v1/PROVENANCE.txt +17 -0
- cpu_llm-1.7.0/src/cpu_llm/data/wikitext-2-raw-v1/test-PROVENANCE.txt +21 -0
- cpu_llm-1.7.0/src/cpu_llm/data/wikitext-2-raw-v1/test.parquet +0 -0
- cpu_llm-1.7.0/src/cpu_llm/data/wikitext-2-raw-v1/validation.parquet +0 -0
- cpu_llm-1.7.0/src/cpu_llm/documents.py +301 -0
- cpu_llm-1.7.0/src/cpu_llm/geometry/__init__.py +19 -0
- cpu_llm-1.7.0/src/cpu_llm/geometry/poincare.py +144 -0
- cpu_llm-1.7.0/src/cpu_llm/grounding.py +109 -0
- cpu_llm-1.7.0/src/cpu_llm/ingest.py +89 -0
- cpu_llm-1.7.0/src/cpu_llm/ir/__init__.py +41 -0
- cpu_llm-1.7.0/src/cpu_llm/ir/schema.py +240 -0
- cpu_llm-1.7.0/src/cpu_llm/manifest_spans.py +83 -0
- cpu_llm-1.7.0/src/cpu_llm/measurements.py +480 -0
- cpu_llm-1.7.0/src/cpu_llm/pipeline.py +1746 -0
- cpu_llm-1.7.0/src/cpu_llm/proposition_catalog.py +40 -0
- cpu_llm-1.7.0/src/cpu_llm/realizer/__init__.py +3 -0
- cpu_llm-1.7.0/src/cpu_llm/realizer/inflect.py +95 -0
- cpu_llm-1.7.0/src/cpu_llm/realizer/surface.py +232 -0
- cpu_llm-1.7.0/src/cpu_llm/relations.py +310 -0
- cpu_llm-1.7.0/src/cpu_llm/retrieval.py +264 -0
- cpu_llm-1.7.0/src/cpu_llm/source.py +113 -0
- cpu_llm-1.7.0/src/cpu_llm/stack.py +67 -0
- cpu_llm-1.7.0/src/cpu_llm/taxonomy.py +95 -0
- cpu_llm-1.7.0/src/cpu_llm/thinker_pool.py +395 -0
- cpu_llm-1.7.0/src/cpu_llm/word_taxonomy.py +325 -0
- cpu_llm-1.7.0/src/cpu_llm.egg-info/PKG-INFO +368 -0
- cpu_llm-1.7.0/src/cpu_llm.egg-info/SOURCES.txt +86 -0
- cpu_llm-1.7.0/src/cpu_llm.egg-info/dependency_links.txt +1 -0
- cpu_llm-1.7.0/src/cpu_llm.egg-info/entry_points.txt +2 -0
- cpu_llm-1.7.0/src/cpu_llm.egg-info/requires.txt +18 -0
- cpu_llm-1.7.0/src/cpu_llm.egg-info/top_level.txt +1 -0
- cpu_llm-1.7.0/tests/test_assembly.py +147 -0
- cpu_llm-1.7.0/tests/test_catalog.py +34 -0
- cpu_llm-1.7.0/tests/test_channels.py +156 -0
- cpu_llm-1.7.0/tests/test_clauses.py +52 -0
- cpu_llm-1.7.0/tests/test_comparison.py +135 -0
- cpu_llm-1.7.0/tests/test_cortex_sleep.py +179 -0
- cpu_llm-1.7.0/tests/test_deep_search.py +73 -0
- cpu_llm-1.7.0/tests/test_descriptive_regime.py +66 -0
- cpu_llm-1.7.0/tests/test_documents.py +138 -0
- cpu_llm-1.7.0/tests/test_gather.py +107 -0
- cpu_llm-1.7.0/tests/test_imagine.py +75 -0
- cpu_llm-1.7.0/tests/test_invariants.py +579 -0
- cpu_llm-1.7.0/tests/test_lexical_relations.py +171 -0
- cpu_llm-1.7.0/tests/test_libraries.py +44 -0
- cpu_llm-1.7.0/tests/test_measurements.py +213 -0
- cpu_llm-1.7.0/tests/test_payment_policy.py +46 -0
- cpu_llm-1.7.0/tests/test_pipeline.py +556 -0
- cpu_llm-1.7.0/tests/test_proposition_catalog.py +19 -0
- cpu_llm-1.7.0/tests/test_relations.py +161 -0
- cpu_llm-1.7.0/tests/test_reply.py +189 -0
- cpu_llm-1.7.0/tests/test_resonance_amplitude.py +27 -0
- cpu_llm-1.7.0/tests/test_review.py +161 -0
- cpu_llm-1.7.0/tests/test_source.py +35 -0
- cpu_llm-1.7.0/tests/test_summarize.py +128 -0
- cpu_llm-1.7.0/tests/test_textbook.py +34 -0
- cpu_llm-1.7.0/tests/test_upload.py +131 -0
- cpu_llm-1.7.0/tests/test_vectorprism.py +25 -0
- cpu_llm-1.7.0/tests/test_word_taxonomy.py +77 -0
cpu_llm-1.7.0/PKG-INFO
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cpu-llm
|
|
3
|
+
Version: 1.7.0
|
|
4
|
+
Summary: CPU epistemic text engine. Answers from stored paragraphs, with no GPU decoder.
|
|
5
|
+
Author-email: Amin Parva <parvaamin@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/insightitsGit/cpullm
|
|
7
|
+
Project-URL: Repository, https://github.com/insightitsGit/cpullm
|
|
8
|
+
Keywords: cpu,epistemic,retrieval,pgvector,vectorprism
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: numpy>=1.26
|
|
17
|
+
Requires-Dist: pydantic>=2
|
|
18
|
+
Requires-Dist: vectorprism[encoder,postgres]==0.1.3
|
|
19
|
+
Requires-Dist: psycopg[binary]>=3.1
|
|
20
|
+
Requires-Dist: pgvector>=0.2
|
|
21
|
+
Requires-Dist: chorusgraph==1.3.0
|
|
22
|
+
Requires-Dist: prismguard==0.1.10
|
|
23
|
+
Requires-Dist: prismcognition==2.1.0
|
|
24
|
+
Requires-Dist: prismrag-patch==0.2.1
|
|
25
|
+
Requires-Dist: prismresonance==0.3.0
|
|
26
|
+
Requires-Dist: prismcortex==0.4.1
|
|
27
|
+
Requires-Dist: prismmanifest==0.3.4
|
|
28
|
+
Requires-Dist: prismshine==0.2.2
|
|
29
|
+
Requires-Dist: prismthinker==1.2.0
|
|
30
|
+
Requires-Dist: prismagenticpay==1.4.1
|
|
31
|
+
Requires-Dist: pypdf>=5
|
|
32
|
+
Requires-Dist: python-docx>=1.1
|
|
33
|
+
Requires-Dist: openpyxl>=3.1
|
|
34
|
+
|
|
35
|
+
# cpu-llm
|
|
36
|
+
|
|
37
|
+
**A CPU epistemic text engine. It answers from paragraphs it has already stored.**
|
|
38
|
+
|
|
39
|
+
[](https://www.python.org/)
|
|
40
|
+
[](src/cpu_llm/cpu_guard.py)
|
|
41
|
+
[](https://github.com/insightitsGit/cpullm)
|
|
42
|
+
|
|
43
|
+
> One question in. A sentence rebuilt from a stored proposition and checked against the retrieved paragraphs. No decoder, no API key, no GPU.
|
|
44
|
+
|
|
45
|
+
**Author:** [Amin Parva](mailto:parvaamin@gmail.com), independent engineer · **Retrieval plane:** [VectorPrism](https://github.com/insightitsGit/VectorPrism)
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## What cpu-llm is
|
|
50
|
+
|
|
51
|
+
cpu-llm is not a quantized chat model. A chat model writes the next token. cpu-llm retrieves a stored paragraph, rebuilds one sentence from a proposition cut out of that paragraph, and says that sentence only when the rebuild matches the stored text and the auditor accepts it.
|
|
52
|
+
|
|
53
|
+
The encoder is VectorPrism, frozen `all-mpnet-base-v2` plus the projection checkpoint, writing one 1024-dimensional tensor per paragraph into PostgreSQL with pgvector. Deliberation is PrismCognition. The turn graph is ChorusGraph. The sentence itself comes from the realizer in this package. If a paragraph does not round-trip, it stays in the index as text and is not given an invented triple.
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
stored paragraphs → VectorPrism 1024-d index
|
|
57
|
+
→ cpu-llm ask
|
|
58
|
+
→ checked sentence, plus any extra section the question asked for
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
prompt → GPU chat model → free-form tokens
|
|
63
|
+
prompt → “CPU LLM” GGUF decode
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The second picture is a different product. There is no Gemini client, no OpenAI client, and no neural decoder in this package.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## What a question does
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
prompt
|
|
74
|
+
→ PrismGuard
|
|
75
|
+
→ VectorPrism dense shortlist
|
|
76
|
+
→ PrismResonance on the dense core
|
|
77
|
+
→ six channel readings of that shortlist
|
|
78
|
+
→ PrismThinker
|
|
79
|
+
→ PrismCognition, the realizer, and the entailment auditor
|
|
80
|
+
→ PrismShine
|
|
81
|
+
→ optional agents, in this order: deep search, creative writing, comparison, brief
|
|
82
|
+
→ reply
|
|
83
|
+
→ discovery only when ask(..., discover=True)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
A blocked prompt stops at the reply. Think goes straight to cognize. Imagine is not inserted between them.
|
|
87
|
+
|
|
88
|
+
The checked sentence is `answer`. The reply prints that sentence first. Extra sections are added only when the question asked for them, in this order: summary or explanation or list or sources, then comparison, then an imagined passage, then deep-search possibilities. Preface, follow-ups, and next steps are not spoken.
|
|
89
|
+
|
|
90
|
+
| Question | What runs | What the reply adds |
|
|
91
|
+
|----------|-----------|---------------------|
|
|
92
|
+
| What is the European lobster? | The fixed chain | The checked sentence only |
|
|
93
|
+
| Deep search the European lobster. | Every tagged paragraph of the seeds, plus relation-hand neighbors | A possibility list. The checked sentence stays |
|
|
94
|
+
| Imagine the European lobster. | Stored sentences from the article, a different subset each run | An imagined passage after the checked sentence |
|
|
95
|
+
| Compare the European lobster and Robert Boulter. | Each side's own stored article or tagged paragraphs | A comparison section. No invented "X differs from Y" sentence |
|
|
96
|
+
| Summarize the European lobster. | PrismCognition ranks the stored sentences | Up to three sentences. A contradiction withholds the summary |
|
|
97
|
+
| Why is the European lobster fished with pots? | Only stored sentences that state a cause | An explanation, or "No stored sentence states a cause." |
|
|
98
|
+
| List the European lobster. | The same ranking, kept longer | Up to eight sentences |
|
|
99
|
+
| Cite sources for the European lobster. | The paragraph ids that were used | A source list |
|
|
100
|
+
|
|
101
|
+
Those agents chain. "Deep search and compare the European lobster and Robert Boulter" gathers the possibilities first, then splits them by topic. "Summarize that" with no new topic words reuses the previous turn's paragraph ids. A normal follow-up such as "what about the claws?" does not.
|
|
102
|
+
|
|
103
|
+
Discovery stays off until `discover=True`. A why question does not turn it on.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## The default corpus
|
|
108
|
+
|
|
109
|
+
Two sources ship inside the package.
|
|
110
|
+
|
|
111
|
+
**WikiText-2 raw**, the Salesforce validation and test splits. They are English Wikipedia articles that editors marked Good or Featured. The validation split is 60 articles and 1,841 paragraphs, stored under `wikitext2-`. The test split is a second set of articles with no shared title, stored under `wikitext2test-`. A proposition is stored only when the realizer can repeat the paragraph's first sentence. The rest stay text. License of that text: CC BY-SA 3.0 and GFDL, as stated in the provenance file next to the parquet.
|
|
112
|
+
|
|
113
|
+
**An original primer on artificial intelligence**, `src/cpu_llm/data/artificial-intelligence.md`, 70 paragraphs. It is text written for this package. It is not a copy of another textbook. Each paragraph's first sentence is one the realizer can repeat, so a question about search, learning, a transformer, or cpu-llm itself can be answered from those paragraphs. Its ids start with `artificial-intelligence-md-`, so loading it does not delete WikiText.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
cpu-llm-ingest
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
That command loads the WikiText validation split and then the primer. The same entry point is `python -m cpu_llm.ingest`.
|
|
120
|
+
|
|
121
|
+
| Command | What it writes |
|
|
122
|
+
|---------|----------------|
|
|
123
|
+
| `cpu-llm-ingest` | WikiText validation, then the primer |
|
|
124
|
+
| `cpu-llm-ingest --textbook` | The primer only. Use this when WikiText is already in the index |
|
|
125
|
+
| `cpu-llm-ingest --test` | The WikiText test split only |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Install
|
|
130
|
+
|
|
131
|
+
Python 3.11 or newer. The GitHub repository is public. The package name on PyPI is `cpu-llm`. Install from a checkout:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
git clone https://github.com/insightitsGit/cpullm.git
|
|
135
|
+
cd cpullm
|
|
136
|
+
python -m venv .venv
|
|
137
|
+
.venv\Scripts\activate
|
|
138
|
+
pip install -U pip
|
|
139
|
+
pip install -e .
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`pip install -e .` installs the package, the trained checkpoint, the WikiText parquet files, and the primer. On Windows, import `pyarrow` before `torch` or VectorPrism. `cpu_llm.retrieval` already does that.
|
|
143
|
+
|
|
144
|
+
The appliance talks to PostgreSQL with the `vector` extension:
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
image pgvector/pgvector:pg16
|
|
148
|
+
port localhost:5433
|
|
149
|
+
user vectorprism
|
|
150
|
+
password vectorprism
|
|
151
|
+
database vectorprism
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
postgresql://vectorprism:vectorprism@localhost:5433/vectorprism
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`VECTORPRISM_PG_DSN` overrides that DSN.
|
|
159
|
+
|
|
160
|
+
Pinned libraries in `pyproject.toml`:
|
|
161
|
+
|
|
162
|
+
| Package | Role |
|
|
163
|
+
|---------|------|
|
|
164
|
+
| vectorprism 0.1.3 | 1024-d encode and dense-slice search |
|
|
165
|
+
| chorusgraph 1.3.0 | Turn graph |
|
|
166
|
+
| prismguard 0.1.10 | Prompt check |
|
|
167
|
+
| prismcognition 2.1.0 | Deliberation and summary ranking |
|
|
168
|
+
| prismrag-patch 0.2.1 | Article label from the document id |
|
|
169
|
+
| prismresonance 0.3.0 | Dense-core resonance |
|
|
170
|
+
| prismcortex 0.4.1 | Graph memory behind the sqlite store |
|
|
171
|
+
| prismmanifest 0.3.4 | Numeric span grammar on the CPU |
|
|
172
|
+
| prismshine 0.2.2 | Retrieval and sentence gate, judge off |
|
|
173
|
+
| prismthinker 1.2.0 | Sufficiency: answer, gather, refuse, escalate |
|
|
174
|
+
| prismagenticpay 1.4.1 | Payment check when both a proposal and an authority are passed |
|
|
175
|
+
|
|
176
|
+
A clean install works when those pins can be downloaded from PyPI. PrismThinker 1.2.0 and PrismAgenticPay 1.4.1 are both published. PrismAgenticPay 1.4.1 requires PrismThinker 1.2.0, and both are imported at startup.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Runtime
|
|
181
|
+
|
|
182
|
+
cpu-llm runs on a CPU. It does not use a GPU. Startup clears `CUDA_VISIBLE_DEVICES`. If PyTorch was already imported and CUDA is available, the process refuses to continue.
|
|
183
|
+
|
|
184
|
+
| Requirement | This release |
|
|
185
|
+
|-------------|----------------|
|
|
186
|
+
| Python | 3.11 or newer |
|
|
187
|
+
| Processor | A 64-bit CPU. No CUDA device |
|
|
188
|
+
| Encoder | `sentence-transformers/all-mpnet-base-v2`, about 418 MiB, downloaded on first use and run on the CPU |
|
|
189
|
+
| Checkpoint | `vectorprism.pt`, about 3.6 MB, shipped inside the package |
|
|
190
|
+
| Database | PostgreSQL 16 with the `vector` extension |
|
|
191
|
+
| Questions | One `ask` at a time on the calling thread |
|
|
192
|
+
|
|
193
|
+
The five PrismThinker heads are separate processes, started once when the appliance loads. They do not let two questions run together.
|
|
194
|
+
|
|
195
|
+
### Measured latency
|
|
196
|
+
|
|
197
|
+
These times are from one machine on 13 October 2026: an Intel Core Ultra 9 275HX with 24 cores and 64 GB of RAM, Windows 11, Python 3.12. One appliance, three runs of each prompt, after the model was already loaded and after one warmup question. Load time is not included in the question times.
|
|
198
|
+
|
|
199
|
+
Starting the appliance took 9.8 seconds on the six-mode run and 10.2 seconds on the deep-search rerun. The warmup question took 233 ms.
|
|
200
|
+
|
|
201
|
+
| Mode | Prompt | Median | Three runs |
|
|
202
|
+
|------|--------|--------|------------|
|
|
203
|
+
| Normal | What is the European lobster? | 66 ms | 83, 56, 66 |
|
|
204
|
+
| Explain | Why is the European lobster fished with pots? | 60 ms | 87, 60, 59 |
|
|
205
|
+
| Summarize | Summarize the European lobster. | 63 ms | 72, 60, 63 |
|
|
206
|
+
| Compare | Compare the European lobster and Robert Boulter. | 61 ms | 87, 61, 61 |
|
|
207
|
+
| Creative | Imagine the European lobster. | 66 ms | 67, 66, 66 |
|
|
208
|
+
| Deep search | Deep search the European lobster. | 593 ms | 577, 593, 629 |
|
|
209
|
+
|
|
210
|
+
Deep search kept 582 possibilities and wrote a 32,639-character reply. Creative writing returned a different passage on each run. Ingesting a two-sentence note took 4.50 s, then 2.07 s, then 2.40 s, because each paragraph is encoded. A later upload of a 9-paragraph PDF stored every paragraph and answered from that file.
|
|
211
|
+
|
|
212
|
+
This machine is the one that was measured. It is not a minimum specification.
|
|
213
|
+
|
|
214
|
+
### Next release
|
|
215
|
+
|
|
216
|
+
The next release is working on serving multiple threads, so one process can answer concurrent questions under heavy load. This release keeps each question on the calling thread.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Quickstart
|
|
221
|
+
|
|
222
|
+
Load the shipped sources, then ask.
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
cpu-llm-ingest
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
from cpu_llm.pipeline import Appliance
|
|
230
|
+
|
|
231
|
+
with Appliance() as appliance:
|
|
232
|
+
result = appliance.ask("What is artificial intelligence?")
|
|
233
|
+
|
|
234
|
+
print(result["answer"])
|
|
235
|
+
print(result["reply"]["text"])
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
`answer` is the checked sentence. Shine and the auditor see `answer` only.
|
|
239
|
+
|
|
240
|
+
### Index your own source
|
|
241
|
+
|
|
242
|
+
A source is a file, a folder, or paragraphs you already split. `ingest` stores those paragraphs in the same index, and a later `ask` reads them with the WikiText rows and the primer. Accepted files are `.txt`, `.md`, `.html`, `.pdf`, `.docx`, `.csv`, `.xlsx`, `.xlsm`, and `.epub`. A legacy `.doc` or `.xls` file is refused. Save it as `.docx` or `.xlsx`.
|
|
243
|
+
|
|
244
|
+
```python
|
|
245
|
+
from cpu_llm.documents import SourceDocument
|
|
246
|
+
from cpu_llm.pipeline import Appliance
|
|
247
|
+
|
|
248
|
+
guide = SourceDocument(
|
|
249
|
+
"field-guide",
|
|
250
|
+
(
|
|
251
|
+
"The European lobster is Homarus gammarus.",
|
|
252
|
+
"Homarus gammarus is a species of clawed lobster.",
|
|
253
|
+
),
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
with Appliance() as appliance:
|
|
257
|
+
appliance.ingest(guide)
|
|
258
|
+
appliance.ingest("notes/lobster.pdf")
|
|
259
|
+
appliance.ingest("notes")
|
|
260
|
+
result = appliance.ask("What is the European lobster?")
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Reading the same source again replaces that source's paragraphs. A spreadsheet with `from` and `to` columns stores each row as a paragraph and stores the pair as a connection. Other sheets become `column: value` rows and do not invent a connection.
|
|
264
|
+
|
|
265
|
+
`catalog_chunks` is the lower-level call when you already have `(document_id, paragraph)` pairs. Pass `propositions=` when you already have an `EIRProposition` whose subject and object are slices of the chunk. `ask(..., propositions=...)` overrides that turn. The normal path reads the proposition stored with the chunk.
|
|
266
|
+
|
|
267
|
+
Leave `ObjectiveSpec`, policy rules, and causal edges empty unless you are supplying them. The appliance does not invent them from prose.
|
|
268
|
+
|
|
269
|
+
### Tests
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
python -m pytest
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## How the checked sentence is chosen
|
|
278
|
+
|
|
279
|
+
VectorPrism searches once. The six channel nodes read that shortlist. They do not run six more database queries.
|
|
280
|
+
|
|
281
|
+
| Channel | What the node reports | Used to pick the passage |
|
|
282
|
+
|---------|----------------------|--------------------------|
|
|
283
|
+
| Dense | Cosine on the trained dense core | Yes |
|
|
284
|
+
| Relational | A stored proposition that shares the prompt's words | No |
|
|
285
|
+
| Disentangled | Words that appear in only one passage | No |
|
|
286
|
+
| Hyperbolic | Poincaré distance, inside the open unit ball | No |
|
|
287
|
+
| Identity | Names and title tokens shared with the prompt | No |
|
|
288
|
+
| Causal | A sentence that already says *because*, *due to*, *caused*, or *therefore* | No |
|
|
289
|
+
|
|
290
|
+
A quoted cause is not turned into a graph edge. The detail node prints all six. It does not replace the checked sentence.
|
|
291
|
+
|
|
292
|
+
The current checkpoint trained the dense channel. Relational, disentangled, hyperbolic, and causal heads are still at initialization. cpu-llm does not pretend those slices rank the search.
|
|
293
|
+
|
|
294
|
+
PrismThinker can return `answer`, `gather`, `refuse`, or `escalate`. A gather result still realizes the grounded sentence when a proposition exists. The open questions stay on `gather_questions`.
|
|
295
|
+
|
|
296
|
+
Creative writing runs when the prompt says imagine, what if, story, poem, fiction, or creative writing, or when `ask(..., imagine=True)`. It realizes stored sentences from the article and draws a different subset each time more than one sentence passed the auditor. One eligible sentence cannot vary. `answer` stays the checked sentence.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Numeric spans
|
|
301
|
+
|
|
302
|
+
`amount_min` is set only from a money span.
|
|
303
|
+
|
|
304
|
+
| Written span | Recorded as |
|
|
305
|
+
|--------------|-------------|
|
|
306
|
+
| `4,399 m` | Length in metres. Not money |
|
|
307
|
+
| `14,440 feet`, `14,440-foot` | Length in feet |
|
|
308
|
+
| `10 million`, `exceeds 10 million`, `five million` | `amount_min = 10000000` or `5000000` |
|
|
309
|
+
| `$5 m`, `£ 1.7 million`, `CZK 8 million`, `$ 2.5 million in grants` | Money, scaled by one million |
|
|
310
|
+
| `28 million years`, `15 million copies`, `20 million men` | Not money. The noun is what was counted |
|
|
311
|
+
| `a viewership of 8.69 million` | Not money. The noun before `of` is what was counted |
|
|
312
|
+
| `4,399 m` and `$ 10 million` in one paragraph | Length and money, both kept |
|
|
313
|
+
| `. m` | Ignored. One bad paragraph does not drop the rest of the batch |
|
|
314
|
+
|
|
315
|
+
A height in the retrieved text can still select PrismThinker's empirical regime. The questions `no numeric threshold on hypothesis or objective` and `causal_graph is required` mean the caller did not supply those inputs. They are not a request for cpu-llm to invent a target.
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## What this package does not do
|
|
320
|
+
|
|
321
|
+
It does not rewrite a passage in a new style, translate it, write code, or pick a winner the store does not state. It does not expose an HTTP upload API or a per-customer tenant. The tenant on this appliance is `cpu-llm`, and every source shares one pgvector index. Concurrent questions are the work of the next release.
|
|
322
|
+
|
|
323
|
+
A paragraph that does not round-trip is stored and can be retrieved. It is not spoken.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Layout
|
|
328
|
+
|
|
329
|
+
```text
|
|
330
|
+
src/cpu_llm/pipeline.py turn graph and Appliance.ask / ingest
|
|
331
|
+
src/cpu_llm/checkpoints/vectorprism.pt trained projection shipped in the package
|
|
332
|
+
src/cpu_llm/ingest.py WikiText and the primer loader
|
|
333
|
+
src/cpu_llm/data/wikitext-2-raw-v1/ shipped WikiText parquet files
|
|
334
|
+
src/cpu_llm/data/artificial-intelligence.md shipped primer
|
|
335
|
+
src/cpu_llm/documents.py file, folder, and spreadsheet readers
|
|
336
|
+
src/cpu_llm/source.py paragraph cuts for the shipped sources
|
|
337
|
+
src/cpu_llm/clauses.py first-sentence propositions
|
|
338
|
+
src/cpu_llm/realizer/ controlled English from a proposition
|
|
339
|
+
src/cpu_llm/audit/ lexical entailment check
|
|
340
|
+
src/cpu_llm/cognition/ deliberation adapter
|
|
341
|
+
src/cpu_llm/agents/ deep search, creative writing, reply
|
|
342
|
+
src/cpu_llm/comparison.py two-topic split
|
|
343
|
+
src/cpu_llm/classifier.py which optional agent the prompt asked for
|
|
344
|
+
src/cpu_llm/measurements.py lengths, money spans, qualifiers
|
|
345
|
+
src/cpu_llm/channels.py six readings and the detail template
|
|
346
|
+
docs/cpu-llm-v1.6.1-architecture-spec.md
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Citation
|
|
352
|
+
|
|
353
|
+
```bibtex
|
|
354
|
+
@software{cpullm2026,
|
|
355
|
+
title = {cpu-llm: A CPU Epistemic Text Engine on VectorPrism},
|
|
356
|
+
author = {Amin Parva, independent engineer},
|
|
357
|
+
year = {2026},
|
|
358
|
+
url = {https://github.com/insightitsGit/cpullm}
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Links
|
|
365
|
+
|
|
366
|
+
- Author: **Amin Parva**, independent engineer ([parvaamin@gmail.com](mailto:parvaamin@gmail.com))
|
|
367
|
+
- This repository: [https://github.com/insightitsGit/cpullm](https://github.com/insightitsGit/cpullm)
|
|
368
|
+
- Retrieval engine: [https://github.com/insightitsGit/VectorPrism](https://github.com/insightitsGit/VectorPrism)
|