跳转到内容

相位与旋转坐标框架

ARTI 的相位坐标把观察者框架显式化。该机制是确定性的张量几何:它不会旋转 token ID、解码文本,也不会推断调用方未提供的相位。

**Alpha 集成表面:**张量反演在 1.7.0 中仍为公开接口,但参与者语义与观察者参考系集成仍取决于任务。ARTI 不会自动发现说话者、来源或授权规则。

来源、读取者与观察者是三个不同维度

Section titled “来源、读取者与观察者是三个不同维度”

调用方提供 token 归属与参与者坐标表。active_participant 是 viewer/recipient,决定可读性;observer_participant 是当前将被续写的角色,决定使用哪个逆参考系。普通 assistant 续写中,二者可以分别是“最近的非 assistant 参与者”和“assistant”;训练其他角色的目标 token 时,应显式指定 observer。

import arti
ctx = arti.build_participant_context(
participant_ids, participant_coord, readable_by,
assistant_id=0,
)
layer = arti.nn.Layer(
dim=hidden_dim,
coord_dim=participant_coord.shape[-1],
coord_frame_mode="operator_bank",
)
out = layer(
x, coord=ctx.coord, mask=ctx.mask,
visibility=ctx.visibility,
observer_coord=ctx.observer_coord,
frame_operators=inverse_bank,
)

paired_rotation 把相邻隐通道视为二维对。coord[..., :2] 必须是 [sin(theta), cos(theta)],隐维 D 必须为偶数。逆旋转在不改变 shape 的情况下把观测映射回规范框架。

import torch
from arti.torch import apply_coord_frame_inverse
theta = torch.tensor([[0.25, -0.75]]) # [B, N]
coord = torch.stack([theta.sin(), theta.cos()], dim=-1) # [B, N, 2]
observed = torch.randn(1, 2, 8) # [B, N, D],D 为偶数
canonical = apply_coord_frame_inverse(
observed, coord, mode="paired_rotation"
)
assert canonical.shape == observed.shape

对每个 (even, odd) 通道对,ARTI 应用 [[cos, sin], [-sin, cos]]。坐标是运行时证据,不是学习得到的标签。

x [B,N,D] + 相位坐标 [B,N,C]
→ 选择 token 自身框架或 observer 框架
→ 成对逆旋转或加权算子库
→ 规范化通道 [B,N,D]

operator_bank 把相位推广为 K 个外部提供的通道算子。coord[B,N,K]frame_operators[K,D,D]x[B,N,D]observer_coord 可为整段上下文选择观察者框架,也可逐 token 指定。

import torch
from arti.torch import apply_coord_frame_inverse
x = torch.randn(2, 5, 4) # [B, N, D]
coord = torch.nn.functional.one_hot(
torch.tensor([[0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]), num_classes=2
).float() # [B, N, K]
operators = torch.stack([torch.eye(4), torch.eye(4)]) # [K, D, D]
observer = torch.tensor([[1.0, 0.0], [0.0, 1.0]]) # [B, K]
y = apply_coord_frame_inverse(
x, coord, mode="operator_bank",
frame_operators=operators, observer_coord=observer,
)
assert y.shape == (2, 5, 4)

observer_coord 接受 [B,K][B,1,K][B,N,K]。省略时,每个 token 自身的 coord 驱动逆变换。算子库由调用方提供且必须真实表达所需逆变换;ARTI 不验证其物理正确性。

若来源产生 x = A_owner · canonical,观察者接收 A_observer⁻¹ · A_owner · canonical。同参考系回到规范表示,不同参考系保留相对变换。soft coordinate 只是算子加权混合,不自动构成严格数学逆。

外部赋义的来源或参与者 phase 应放在 token 与来源仍一一对应的位置——通常是 embedding 之后、attention 等跨 token 混合之前。多个来源已被 attention 或 pooling 混合后,再指定一个原始参与者参考系可能不再严格。fallback coordinate 只是隐空间脚手架,不是被发现的身份。

ARTIPhaseMixer 是另一种学习型特征混合层。它拼接当前 hidden state 与 coordinate,为每个 token 预测多个学习型 MLP 算子的 softmax 权重,再使用坐标条件化的 receptor gain 调制候选特征,最后返回加权混合:

z + coord
→ 算子 softmax
→ 坐标条件化 receptor gain
→ 学习型 MLP 算子候选
→ 特征加权混合

它的诊断包括 operator_weightsphase_receptor_gain。它不会反演调用方提供的参考系、发现观察者、识别来源、融合物理传感器或恢复物理相位。确定性的观察者参考系几何应使用 apply_coord_frame_inverse;需要让已训练模型学习坐标条件化特征算子时,才使用 ARTIPhaseMixer

import torch
from arti import ARTIPhaseMixer
mixer = ARTIPhaseMixer(hidden_dim=64, coord_dim=4, operator_count=3)
mixed, operator_weights, receptor_gain = mixer(
torch.randn(2, 12, 64),
torch.randn(2, 12, 4),
)
assert mixed.shape == (2, 12, 64)
assert operator_weights.shape == (2, 12, 3)
assert receptor_gain.shape == (2, 12, 3, 64)

arti.nn.Layer(..., coord_frame_mode="paired_rotation") 暴露成对旋转路径。Fit 的 observer-phase profile 使用 operator_bank 并要求运行时提供 frame operators;缺失时会直接报错,而不是静默关闭机制。

  • apply_coord_frame_inverse 在 1.7.0 中仍通过 arti.torch 公开;observer-phase Fit profile 可配置,但效果依赖具体任务。
  • ARTIPhaseMixer 仍从包根目录公开导出,但其任务行为来自训练,必须与确定性参考系反演分别评估。
  • PyTorch 支持两种模式;安装 JAX 后,其后端遵循相同 functional 契约。
  • shape 校验严格:paired_rotation 要求偶数 D;算子库坐标最后一维必须恰好等于 K
  • 规范化只保留已提供的相对相位,无法恢复未知或错误的相位。