首页 理论 架构 工程 文档 白皮书 著作 研究 案例 下载 博客 关于 开始使用 →

第42章 ShortMemory

第42章 ShortMemory

第42章承接第41章 Memory

第41章定义了 ICAI 的总体记忆机制:

Understanding
      ↓
Memory
      ↓
Write / Read / Update / Delete

第42章进一步把 Memory 按照信息存在时间和当前认知用途进行划分,首先建立 ShortMemory(短期记忆)

短期记忆解决的问题是:

ICAI 当前正在处理什么信息、处于什么场景、对象当前是什么状态,以及这些临时信息在当前任务结束前如何保持。

核心关系:

当前输入
   ↓
Perception
   ↓
Cognition
   ↓
Understanding
   ↓
ShortMemory
   ↓
当前推理 / 决策 / 行动

42.1 短期记忆

ShortMemory 是 ICAI 在当前认知任务或当前场景生命周期内保存临时信息的记忆结构。

它主要服务于:

当前任务
当前对话
当前场景
当前对象
当前状态
当前推理
当前行动

因此:

ShortMemory
=
Current Information
+
Current Context
+
Current State
+
Temporary Data

短期记忆的特点:

1. 生命周期短
2. 与当前任务相关
3. 变化频繁
4. 可被更新
5. 可被清理
6. 不一定永久保存

例如用户当前提出:

“深圳到香港家具送货上门。”

ICAI 当前需要记住:

起点 = 深圳
终点 = 香港
对象 = 家具
服务 = 送货
方式 = 上门

这些信息首先可以进入 ShortMemory。


42.2 当前信息

当前信息是 ShortMemory 最基础的组成部分。

例如用户输入:

“我需要把家具从深圳送到香港。”

当前信息:

深圳
香港
家具
运输

经过 Perception:

Elements

经过 Cognition:

Objects

经过 Understanding:

Origin = Shenzhen
Destination = Hong Kong
Object = Furniture
Action = Delivery

然后形成:

ShortMemory
{
    origin: Shenzhen,
    destination: Hong Kong,
    object: Furniture,
    action: Delivery
}

这些信息之所以进入短期记忆,是因为它们正在参与当前任务


当前信息不是永久事实

例如:

用户当前要求:
“帮我查深圳到香港的家具运输。”

ShortMemory:

task = furniture_delivery
origin = Shenzhen
destination = Hong Kong

任务完成以后:

task = completed

这些当前任务参数就可能失去继续保留的必要。

因此:

Current Information
≠
Permanent Memory

42.3 当前场景

ShortMemory 不应该只保存孤立的数据。

它还需要保存当前场景。

例如:

用户:
“深圳到香港家具送货上门多少钱?”

当前场景可以表示为:

Scene
├── origin
│   └── Shenzhen
│
├── destination
│   └── Hong Kong
│
├── object
│   └── Furniture
│
├── action
│   └── Delivery
│
├── mode
│   └── Door-to-door
│
└── intent
    └── Price Inquiry

ShortMemory 保存:

CurrentScene

这样后面的推理就不会把信息拆散。

例如下一句话:

“那大概需要多少钱?”

单独看:

那
大概
需要
多少钱

信息是不完整的。

但是 ShortMemory 中仍然保存:

CurrentScene:
Furniture Delivery
Shenzhen → Hong Kong
Door-to-door

因此可以理解:

“多少钱?”

实际上是在询问:

深圳 → 香港
家具
送货上门
的价格

这就是短期记忆对当前场景连续性的作用。


42.4 当前状态

ShortMemory 还需要保存当前状态。

例如一个任务:

Task:
Furniture Delivery

状态变化:

NEW
 ↓
ANALYZING
 ↓
MATCHING
 ↓
UNDERSTANDING
 ↓
READY
 ↓
EXECUTING
 ↓
COMPLETED

ShortMemory 可以保存:

task_state = ANALYZING

同时保存对象状态:

delivery_state = pending

例如:

ShortMemory
{
    task_state: "analyzing",
    delivery_state: "pending"
}

当前状态会不断变化

例如:

初始:

payment = unpaid

之后获得新信息:

payment = paid

ShortMemory 更新:

payment = paid

再之后:

delivery = shipping

于是:

ShortMemory
{
    payment: paid,
    delivery: shipping
}

因此 ShortMemory 特别适合保存:

CurrentState

而长期稳定的信息则不应该全部依赖 ShortMemory。


42.5 临时数据

临时数据是当前任务中产生、但没有必要永久保存的数据。

例如:

匹配分数
中间计算值
临时变量
当前步骤
临时对象
临时条件
临时路径

例如 Matching:

ObjectScore = 1.00
PropertyScore = 0.90
RelationScore = 0.95

最终:

MatchScore = 0.96

这些中间值可以放入:

ShortMemory

供当前认知流程使用。

任务结束后:

ObjectScore
PropertyScore
RelationScore

可能不再需要。

而最终认知结果:

Furniture
Shenzhen
Hong Kong
DoorToDoor

如果具有长期价值,则可以进入:

Memory

甚至进一步形成:

Experience
Knowledge

因此:

临时计算结果
        ↓
ShortMemory
        ↓
任务结束
        ↓
清理

42.6 生命周期

ShortMemory 最重要的特征之一就是生命周期有限

基本生命周期:

Create
  ↓
Active
  ↓
Update
  ↓
Use
  ↓
Complete
  ↓
Clear

可以表示:

当前输入
   ↓
Create ShortMemory
   ↓
Active
   ↓
不断更新
   ↓
当前任务完成
   ↓
判断是否需要保存
   ↓
 ┌──────────────┐
 ↓              ↓
需要保存        不需要保存
 ↓              ↓
Long Memory     Clear

这里非常重要:

ShortMemory 并不意味着所有内容到期后直接删除。

在任务结束时,可以进行一次记忆转移。

例如:

ShortMemory
     ↓
Evaluate
     ↓
 ┌───┴────┐
 ↓        ↓
重要      临时
 ↓        ↓
Memory    Delete

例如:

当前任务:
深圳 → 香港家具运输

任务过程中:

临时匹配分数
临时变量
临时状态

可以清除。

而确认的重要事实:

用户任务
家具
深圳
香港
服务关系

如果符合长期保存条件,可以写入长期 Memory。

所以:

ShortMemory
       ↓
Memory Evaluation
       ↓
Long Memory / Clear

42.7 短期记忆示例

下面把前面的 Perception、Cognition、Matching、Understanding 与 ShortMemory 完整连接起来。

输入

“深圳到香港家具送货上门。”

Perception

提取:

深圳
香港
家具
送货
上门

Cognition

形成对象:

Shenzhen
Hong Kong
Furniture
Delivery

形成关系:

Shenzhen
   ↓ origin
Delivery
   ↓ destination
Hong Kong

形成属性:

Delivery
└── mode = DoorToDoor

Matching

进行匹配:

Object Match = 1.00
Property Match = 1.00
Relation Match = 0.95
Location Match = 1.00

形成:

MatchScore = 0.97

Understanding

形成当前场景:

Scene:
Furniture Door-to-door Delivery

Origin:
Shenzhen

Destination:
Hong Kong

Object:
Furniture

Mode:
DoorToDoor

ShortMemory 写入

ShortMemory
{
    task: "delivery_inquiry",

    scene: "furniture_delivery",

    origin: "Shenzhen",

    destination: "Hong Kong",

    object: "Furniture",

    service: "Delivery",

    mode: "DoorToDoor",

    match_score: 0.97,

    state: "active"
}

用户继续输入

“多少钱?”

系统首先读取 ShortMemory:

task = delivery_inquiry
scene = furniture_delivery
origin = Shenzhen
destination = Hong Kong
object = Furniture
mode = DoorToDoor

于是当前信息被恢复为:

深圳
→
香港
→
家具
→
送货上门
→
价格询问

形成新的认知:

Intent:
Price Inquiry

Target:
Furniture Door-to-door Delivery

Route:
Shenzhen → Hong Kong

这就是:

Current Input
      +
ShortMemory
      ↓
Current Understanding

ShortMemory 与 Memory 的关系

第41章的 Memory 是总体记忆机制。

第42章的 ShortMemory 是其中面向当前任务的记忆层。

可以表示:

Memory
│
├── ShortMemory
│
├── LongMemory
│
├── ExperienceMemory
│
└── ...

其中本章只讨论:

ShortMemory

核心职责:

当前信息
当前场景
当前状态
临时数据
当前任务上下文

第42章核心模型

                 ShortMemory
                      │
        ┌─────────────┼─────────────┐
        ↓             ↓             ↓
 CurrentInfo     CurrentScene   CurrentState
        │             │             │
        └─────────────┼─────────────┘
                      ↓
                 TemporaryData
                      ↓
                   Lifecycle

完整运行链:

Information
    ↓
Perception
    ↓
Cognition
    ↓
Matching
    ↓
Understanding
    ↓
ShortMemory
    ↓
Current Reasoning
    ↓
Decision
    ↓
Action

任务结束:

ShortMemory
      ↓
Memory Evaluation
      ↓
 ┌────┴─────┐
 ↓          ↓
长期有用     临时信息
 ↓          ↓
Memory      Clear

因此第42章最核心的定义是:

ShortMemory 是 ICAI 在当前任务和当前场景生命周期内保存当前信息、当前对象、当前状态、上下文和临时计算结果的短期记忆机制。

它的关键作用不是“存很多东西”,而是保证:

前一步发生了什么
        ↓
当前正在处理什么
        ↓
下一步应该基于什么继续认知

从而让 ICAI 的认知过程具有连续性、上下文和当前状态

Leave a Reply

Your email address will not be published. Required fields are marked *