079project 3.0.0 → 5.0.0
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.
- package/GroupStarter.cjs +396 -30
- package/forwarder.js +312 -55
- package/main_Serve.cjs +583 -105
- package/main_Study.cjs +581 -68
- package/notes.txt +241 -0
- package/package.json +7 -1
- package/note.txt +0 -5
- package/notebook.txt +0 -8
package/notes.txt
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
//这是开发者自行创建的开发提示,没有任何用处,尽量不用关注
|
|
2
|
+
/*
|
|
3
|
+
0.实验目的:
|
|
4
|
+
I.尝试探究在推理类问题,论述类问题和思考类(文科)问题中的思维链
|
|
5
|
+
II.找出在物质层不存在,但在模因层可能存在的概念,比如[集体,国家]等概念,同时探究其运行方式及其组成部分
|
|
6
|
+
III.(有一定的危险性)通过硬件设备,尝试着实现基于意识的边缘计算,它呢能够通过人脑进行辅助计算
|
|
7
|
+
1.开发灵感:
|
|
8
|
+
I.灵魂之海已经昭示命运的轨迹,安息之灵已经告知历史的碎片
|
|
9
|
+
II.模因论
|
|
10
|
+
III.天演系统
|
|
11
|
+
2.也就是说,我们能够通过对宏观的模拟来实现更为精准的模拟,而不是专注于个体的模拟或描述
|
|
12
|
+
换句话说,这个系统对于个体的模拟可以是粗糙的甚至是不准确的,但不可能是错误的
|
|
13
|
+
3.下一步:
|
|
14
|
+
I.实现分批训练,也就是说,当我们需要一个模型集群的时候,我们要学会将一部分的模型训练好后存储为硬盘格式,尝试着进行向量化
|
|
15
|
+
这样能够大幅度的减少再次训练的时间,这些模型将会在需要的时候激活
|
|
16
|
+
II.实现基于有效碰撞的视觉分析,结合一些硬件部分和线上的已经标注的图片集,真正实现多模态,
|
|
17
|
+
从现在开始,这个AI开始有了“眼睛”
|
|
18
|
+
它的视觉是连贯的,而不是基于图片的,也就是说,它的视觉和读写IO是有重叠的,而不是直接进行图片转化
|
|
19
|
+
从而我们需要引出有效碰撞的概念,也就是说,AI是在一个空间内随机游走,之后随机的,基于场景的,基于当前碰撞箱的产生对话
|
|
20
|
+
最终,我么们会通过一种RNN来通过最后的交谈或者进化结果和最初始的AI状态来观察中间的过程和交谈逻辑(目的 II)
|
|
21
|
+
III.线性代数化
|
|
22
|
+
它目前的图结构可以看作一个二维的,只有01的邻接矩阵,但是,这种矩阵是效率不高的,我们可以通过将矩阵转换为一个基于float32的,高维的张量来进行计算
|
|
23
|
+
这样能够提高计算效率,同时我建议提供一个高维-二维的转换模块,能够将高维数据点转换为二维数据点,从而重新转换为图结构,甚至最终导入另外的一个分析程序
|
|
24
|
+
找出实际上的思维链
|
|
25
|
+
这个时候,我们就可以将三个serve和一个study看作一个3维张量
|
|
26
|
+
即tensor[memes][memes][4],对于每一个坐标tensor[a][b],描述的是这两个点之前的单向权重值a->b
|
|
27
|
+
同时,每一个点都有别名,对应另外的词语表,这样,我们能够期望在一个时间周期内完成计算,而不是在多个单步内完成计算
|
|
28
|
+
IV.实体化
|
|
29
|
+
a.软硬件结合,给AI一个躯体
|
|
30
|
+
b.模拟出一个元宇宙,在元宇宙中,AI间会进行交互
|
|
31
|
+
但是,无论ab,最后AI的实体化后会实现趋利避害,遗传变异等特性
|
|
32
|
+
*/
|
|
33
|
+
Meme Graph & Concept Layer
|
|
34
|
+
Classes:
|
|
35
|
+
MemeGraph: partition-aware, supports dynamic activation routing.
|
|
36
|
+
Fields: partitions (Map<PartitionID, Partition>), adjacency (CompressedSparseRow), memeIndex (Map<MemeID, MemeNode>), activationCache (LRU).
|
|
37
|
+
MemeNode: id, tokens[], embeddings (Float32Array d), edges (Array<Edge>), lastAccessTs, decayFactor.
|
|
38
|
+
Edge: weight (float), targetId, directionFlag, semanticTag.
|
|
39
|
+
MemeStore: on-disk shard manager (write-ahead log + snapshot).
|
|
40
|
+
Core Functions:
|
|
41
|
+
addMeme(id, tokens[]): token normalization + embedding compute + edge synthesis.
|
|
42
|
+
linkMemes(srcId, dstId, weight, directionFlag).
|
|
43
|
+
activate(seedIds[], strategy): multi-source propagation with selectable activation/transfer functions.
|
|
44
|
+
decaySweep(): scheduled attenuation of stale nodes.
|
|
45
|
+
exportSparseMatrix(): builds CSR/COO for linear algebra backend.
|
|
46
|
+
foldHighDimTo2D(embeddingsMatrix): dimensionality reduction (UMAP or t-SNE fallback) for chain visualization.
|
|
47
|
+
Data Structures:
|
|
48
|
+
CSR: { rowPtr: Uint32Array, colIdx: Uint32Array, values: Float32Array }.
|
|
49
|
+
ActivationTrace: Map<MemeID, { value, parents: MemeID[] }>.
|
|
50
|
+
Algorithms:
|
|
51
|
+
SignalPropagation: priority queue (value max-heap), early cut when below threshold.
|
|
52
|
+
EdgeReweighting: temporal delta rule: w' = w + alpha*(hitFrequency / (1 + age)).
|
|
53
|
+
MemeMerging: locality sensitive hashing on embeddings to deduplicate near duplicates.
|
|
54
|
+
Batch Training & Cold/Warm Activation Pool
|
|
55
|
+
Classes:
|
|
56
|
+
ModelShard: encapsulates a trained lightweight model (text classifier / responder).
|
|
57
|
+
Fields: statePath, lastLoadedTs, refCount, embeddingCentroid.
|
|
58
|
+
ShardLoader: async load/unload with memory cap (LRU eviction).
|
|
59
|
+
BatchTrainer: schedules incremental training on buffered examples.
|
|
60
|
+
Core Functions:
|
|
61
|
+
scheduleTraining(shardId, examples[]): append to shard queue.
|
|
62
|
+
flushToDisk(shardId): serialize weights (binary float32).
|
|
63
|
+
reviveShard(shardId): lazy load when referenced by meme graph activation.
|
|
64
|
+
Data Structures:
|
|
65
|
+
TrainingQueue: Map<ShardID, RingBuffer<Example>>.
|
|
66
|
+
Example: { inputTokens[], targetText, meta }.
|
|
67
|
+
Algorithms:
|
|
68
|
+
MiniBatch SGD with gradient clipping.
|
|
69
|
+
Shard Selection: nearest centroid to current prompt embedding.
|
|
70
|
+
WarmPool Management: maintain top-K shards by recent activation score.
|
|
71
|
+
Multi-Modal Vision Stream (Effective Collision Space)
|
|
72
|
+
Classes:
|
|
73
|
+
CollisionWorld: maintains active objects with bounding volumes.
|
|
74
|
+
Fields: objects (Map<ObjectID, CollisionObject>), spatialIndex (BVH), eventBus.
|
|
75
|
+
CollisionObject: id, bbox (AABB), velocity, semanticTags[], lastFrameEmbedding.
|
|
76
|
+
VisionStream: frame ingestion + temporal stitching.
|
|
77
|
+
SceneMemory: sequence of frame descriptors (rolling window).
|
|
78
|
+
Core Functions:
|
|
79
|
+
ingestFrame(rawFrame): detect objects -> update CollisionWorld -> compute embeddings.
|
|
80
|
+
performCollisionStep(dt): discrete simulation; generate collision events (enter, stay, exit).
|
|
81
|
+
generateDialogueSeed(collisionEvent): map event participants to meme IDs.
|
|
82
|
+
temporalStitch(prevFrame, currentFrame): optical flow or centroid matching to maintain identity.
|
|
83
|
+
Data Structures:
|
|
84
|
+
BVH: nodes { bbox, left, right, objectIds[] }.
|
|
85
|
+
FrameDescriptor: { timestamp, objectSummaries[], globalEmbedding }.
|
|
86
|
+
Algorithms:
|
|
87
|
+
Object Tracking: Hungarian assignment between detections and prior objects.
|
|
88
|
+
Collision Detection: sweep and prune -> narrow phase AABB test.
|
|
89
|
+
Event Trigger: state machine per object pair (NONE->ENTER->STAY->EXIT).
|
|
90
|
+
Dialogue Seed Selection: rank events by novelty score (semantic distance vs recent context).
|
|
91
|
+
Reasoning Chain Extraction (Text + Vision Fusion)
|
|
92
|
+
Classes:
|
|
93
|
+
ChainRecorder: logs sequence of activated memes across time slices.
|
|
94
|
+
RNNTracer: lightweight recurrent model to compress chain into latent vector.
|
|
95
|
+
ChainAnalyzer: post-process latent sequence for causal motif detection.
|
|
96
|
+
Core Functions:
|
|
97
|
+
recordActivationStep(activeMap): push ordered meme IDs by value descending.
|
|
98
|
+
buildSequence(window): returns padded sequence for RNN ingestion.
|
|
99
|
+
analyze(sequenceLatents): cluster transitions; output candidate reasoning motifs.
|
|
100
|
+
Data Structures:
|
|
101
|
+
ActivationSequence: Array<MemeID>; parallel values[] (Float32).
|
|
102
|
+
LatentChain: Float32Array (T x dHidden).
|
|
103
|
+
Algorithms:
|
|
104
|
+
RNN Forward: GRU or minimal gated cell (custom C++ layer optional).
|
|
105
|
+
Motif Detection: sliding window n-gram embedding + cosine similarity threshold.
|
|
106
|
+
Chain Compression: reservoir sampling for long sessions.
|
|
107
|
+
High-Dimensional Algebra Backend
|
|
108
|
+
Classes:
|
|
109
|
+
TensorEngine: wraps BLAS-like ops (matmul, normalize, reduce).
|
|
110
|
+
GraphTensorBridge: build tensors from CSR, update weights post-computation.
|
|
111
|
+
Core Functions:
|
|
112
|
+
toTensor(batchMemes[]): stack embeddings -> Float32Array (batch x dim).
|
|
113
|
+
adjacencyMat(): returns sparse handle for multiplication.
|
|
114
|
+
computeAttention(queryVector, tensorBatch): softmax over similarity.
|
|
115
|
+
reduceActivation(signalMap): parallel sum via typed arrays.
|
|
116
|
+
Data Structures:
|
|
117
|
+
Float32Matrix(dims), SparseHandle { csr }.
|
|
118
|
+
Algorithms:
|
|
119
|
+
Similarity: approximate via product quantization for large dims.
|
|
120
|
+
Dimensionality Reduction: iterative PCA warm start -> optional UMAP refinement.
|
|
121
|
+
Edge Update: w = w * (1 - decayK) + beta * normalizedActivationPair.
|
|
122
|
+
Embodiment & Environment Simulation
|
|
123
|
+
Classes:
|
|
124
|
+
AgentBody: actuators (move, rotate, grasp), sensors (vision, proximity, text IO).
|
|
125
|
+
Environment: grid or continuous space with objects, physics integrator.
|
|
126
|
+
BehaviorPolicy: maps latent reasoning + current sensory state -> action distribution.
|
|
127
|
+
Core Functions:
|
|
128
|
+
stepPhysics(dt): integrate motion, apply collisions.
|
|
129
|
+
perceive(agentId): produce sensor packet -> meme activation.
|
|
130
|
+
decideAction(agentId): sample from policy (RL or heuristic blend).
|
|
131
|
+
applyAction(agentId, action): mutate AgentBody state & environment.
|
|
132
|
+
Data Structures:
|
|
133
|
+
SensorPacket: { visionEmbedding, nearbyMemes[], energyLevel }.
|
|
134
|
+
Action: { type, params }.
|
|
135
|
+
Algorithms:
|
|
136
|
+
Policy Blending: w * RL_policy + (1-w) * heuristic (novelty seeking vs safety).
|
|
137
|
+
Safety Constraint: override dangerous actions (risk score from meme associations).
|
|
138
|
+
Genetic Variation: mutation of policy parameters across generations; selection on reward traces.
|
|
139
|
+
Concept Layer for Abstract Entities (Collective / Nation etc.)
|
|
140
|
+
Classes:
|
|
141
|
+
AbstractEntity: emergent node composed of constituent MemeNodes (aggregation).
|
|
142
|
+
Fields: id, members[], emergentEmbedding, influenceScore.
|
|
143
|
+
Aggregator: builds abstract entities when cohesion score crosses threshold.
|
|
144
|
+
Core Functions:
|
|
145
|
+
detectEmergent(groups): cluster memes by co-activation frequency.
|
|
146
|
+
updateEntityEmbedding(entity): mean + attention weighting on member embeddings.
|
|
147
|
+
propagateInfluence(entity): push influence edges into MemeGraph for diffusion.
|
|
148
|
+
Data Structures:
|
|
149
|
+
CoActivationMatrix (sparse): counts pairwise co-occurrences.
|
|
150
|
+
Algorithms:
|
|
151
|
+
Clustering: community detection (Louvain modularity).
|
|
152
|
+
Cohesion Score: normalized internal edge weight density vs external boundary.
|
|
153
|
+
Influence Diffusion: modified PageRank biased by entity centrality.
|
|
154
|
+
Parameter & Function Registry (Activation / Transfer)
|
|
155
|
+
Classes:
|
|
156
|
+
FunctionRegistry: stores built-in and custom compiled functions.
|
|
157
|
+
ParamManager: versioned parameter snapshots with rollback.
|
|
158
|
+
Core Functions:
|
|
159
|
+
registerActivation(name, fnSpec).
|
|
160
|
+
registerTransfer(name, fnSpec).
|
|
161
|
+
applySnapshot(snapshotId).
|
|
162
|
+
evaluateTransfer(value, weight, decayK, context).
|
|
163
|
+
Data Structures:
|
|
164
|
+
Snapshot: { id, timestamp, params { decayK, activationType, ... } }.
|
|
165
|
+
Algorithms:
|
|
166
|
+
Rollback: maintain ring buffer, reclaim old snapshots beyond depth N.
|
|
167
|
+
Stability Check: sandbox eval with synthetic signals, compute deviation bounds.
|
|
168
|
+
Persistence & Serialization
|
|
169
|
+
Classes:
|
|
170
|
+
SnapshotWriter: periodic dump (graph shards, model shards, chain traces).
|
|
171
|
+
BinarySerializer: pack float arrays into compressed blocks (LZ4 / zstd optional).
|
|
172
|
+
Core Functions:
|
|
173
|
+
writeGraphShard(partitionId).
|
|
174
|
+
writeShardModel(shardId).
|
|
175
|
+
writeChain(sequenceLatents, meta).
|
|
176
|
+
loadShard(shardId).
|
|
177
|
+
Data Structures:
|
|
178
|
+
ShardHeader: { id, version, counts, checksum }.
|
|
179
|
+
Algorithms:
|
|
180
|
+
Incremental Snapshot: copy-on-write for changed partitions.
|
|
181
|
+
Checksum: CRC32 or xxHash for fast integrity.
|
|
182
|
+
Monitoring & Introspection
|
|
183
|
+
Classes:
|
|
184
|
+
MetricsCollector: counters, gauges, histograms.
|
|
185
|
+
ChainInspector: query API for last N reasoning chains and activation maps.
|
|
186
|
+
Core Functions:
|
|
187
|
+
recordMetric(name, value, type).
|
|
188
|
+
getActivationHeatmap(window).
|
|
189
|
+
listEmergentEntities().
|
|
190
|
+
Data Structures:
|
|
191
|
+
TimeSeriesStore: ring buffer per metric.
|
|
192
|
+
Algorithms:
|
|
193
|
+
Heatmap Aggregation: bucket activation values by meme cluster membership.
|
|
194
|
+
Anomaly Detection: EWMA + z-score > threshold -> flag unusual reasoning drift.
|
|
195
|
+
APIs (High-Level Endpoints Mapping to Functions)
|
|
196
|
+
Endpoints:
|
|
197
|
+
/graph/add_meme -> MemeGraph.addMeme
|
|
198
|
+
/graph/activate -> AdversaryScheduler or Runtime.propagateSignalMultiSource
|
|
199
|
+
/train/batch -> BatchTrainer.scheduleTraining
|
|
200
|
+
/shard/save /shard/load -> ShardLoader + SnapshotWriter
|
|
201
|
+
/vision/frame -> VisionStream.ingestFrame
|
|
202
|
+
/chain/latest -> ChainRecorder export
|
|
203
|
+
/entity/list -> Aggregator output
|
|
204
|
+
/params/update -> ParamManager.applySnapshot
|
|
205
|
+
/functions/register -> FunctionRegistry.registerActivation / registerTransfer
|
|
206
|
+
/embody/step -> Environment.stepPhysics + AgentBody.perceive + BehaviorPolicy.decideAction
|
|
207
|
+
Core Algorithms Summary
|
|
208
|
+
Multi-Source Propagation: BFS-like expansion with activation + transfer function pairing; priority queue to favor high signal; early termination on low magnitude.
|
|
209
|
+
Emergent Entity Detection: community detection over co-activation subgraph; refine with embedding centroid compactness.
|
|
210
|
+
Reasoning Chain Compression: GRU encoding + motif mining (n-gram semantic hashing).
|
|
211
|
+
Effective Collision Dialogue Trigger: event novelty score = semanticDistance(lastDialogContext, collisionPairEmbedding).
|
|
212
|
+
Dimensional Folding: iterative PCA (warm start) -> refine with UMAP for chain visualization export.
|
|
213
|
+
Genetic Policy Update: selection of top reward trajectories; mutate Gaussian noise on parameters; re-evaluate behavior safety constraints.
|
|
214
|
+
Scheduling & Orchestration
|
|
215
|
+
Classes:
|
|
216
|
+
Scheduler: tick-based; slots for vision ingest, graph decay, shard training, snapshotting, entity refresh.
|
|
217
|
+
Functions:
|
|
218
|
+
runTick(): ordered stage execution.
|
|
219
|
+
enqueueTask(type, payload).
|
|
220
|
+
Data Structures:
|
|
221
|
+
TaskQueue: priority queue by (deadline, importance).
|
|
222
|
+
Algorithms:
|
|
223
|
+
Adaptive Interval: shorten interval for tasks with rising backlog (linear scaling).
|
|
224
|
+
Safety & Malicious Barrier
|
|
225
|
+
Classes:
|
|
226
|
+
MemeBarrier: evaluates new memes for malicious score.
|
|
227
|
+
Functions:
|
|
228
|
+
scoreMeme(tokens[], embeddings): classifier or heuristic (keyword density, semantic outlier).
|
|
229
|
+
gateInsertion(score): reject or quarantine.
|
|
230
|
+
Algorithms:
|
|
231
|
+
Outlier Detection: Mahalanobis distance in embedding space.
|
|
232
|
+
Quarantine Management: periodic reevaluation after decay.
|
|
233
|
+
Data Flow Example for Prompt
|
|
234
|
+
Steps:
|
|
235
|
+
Input tokens -> tokenize -> MemeGraph activation seeds.
|
|
236
|
+
propagateSignalMultiSource -> ActivationTrace.
|
|
237
|
+
selectShards -> generate candidate responses (Shard inference).
|
|
238
|
+
fuseVisionContext (if available) -> adjust response ranking.
|
|
239
|
+
recordChain -> update ReasoningChain latent.
|
|
240
|
+
updateCoActivationMatrix -> potential entity emergence.
|
|
241
|
+
snapshot partial state asynchronously.
|
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "079project",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "a GNN-GA BASED ai that might pass the turing test,which use little resources.its startpoint initialize it and you can start it as ```node mainStarter.cjs```",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
7
7
|
"gat",
|
|
8
|
+
"backend",
|
|
8
9
|
"gnn",
|
|
9
10
|
"artificial",
|
|
10
11
|
"intelligence",
|
|
11
12
|
"turing",
|
|
12
13
|
"test"
|
|
13
14
|
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://gitee.com/mumu2009/079-project.git"
|
|
18
|
+
},
|
|
14
19
|
"license": "LGPL-3.0",
|
|
15
20
|
"author": "mumu2009",
|
|
16
21
|
"type": "commonjs",
|
|
@@ -43,6 +48,7 @@
|
|
|
43
48
|
"redis": "^5.8.3",
|
|
44
49
|
"synaptic": "^1.1.4",
|
|
45
50
|
"tensorflowjs": "^0.6.8",
|
|
51
|
+
"umap-js": "^1.4.0",
|
|
46
52
|
"workerpool": "^9.3.3"
|
|
47
53
|
},
|
|
48
54
|
"devDependencies": {}
|
package/note.txt
DELETED