Skip to main content

heart-fusion

用对偶共存(Dual $z = a + i \cdot b$)替换 Transformer argmax 的融合函数库。

核心思想

Transformer 末步 argmax「挑最大值」= 剔除变量:选了一个方向,另一个方向整个消失。 本库用融合函数让两个相反方向一起留下,合成一个不丢失任何一方的新整体。

铁律:禁止损失函数、禁止梯度下降、禁止奖励/惩罚、不寻求最优解、不允许剔除任何输入变量。

安装

pip install heart-fusion

快速示例

from heart_fusion import fuse, settle, fusion_decode, Pole

# 两极共存
d = fuse(0.8, 0.9)       # 理智0.8 + 慈爱0.9
print(d.balance)         # 0.99 (接近完美平衡)
print(d.is_harmonious()) # True

# 失衡 → 再合一自动收敛进和谐带
cold = fuse(1.0, 0.1)    # 偏理智
settled, rounds = settle(cold)
print(settled.balance)   # 0.56 (已进和谐带)

# 四极共存 (四元数扩展)
from heart_fusion import fuse_multi
q = fuse_multi(0.9, 0.8, 0.7, 0.6)  # 理智/慈爱/逻辑/共情
print(q.balance)         # ~0.99

# 替换 Transformer 末层 argmax
pole_a = Pole("理智", 0.85, "客观建议:建议你...")
pole_b = Pole("慈爱", 0.92, "温暖陪伴:我在你身边...")
result = fusion_decode(pole_a, pole_b)
print(result.output)     # 两极共存, 没有任何一方被剔除

API

函数 说明
fuse(a, b) 两极合一 → Dual
settle(dual) 收敛进和谐带 → (Dual, rounds)
fuse_multi(*poles) n 极合一 → MultiDual
settle_multi(dual) n 极收敛 → (MultiDual, rounds)
fusion_decode(pole_a, pole_b) 替换 argmax 的融合输出层
argmax_decode(pole_a, pole_b) 旧范式(对比用)

License

MIT

Metadata

Release files for heart-fusion 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for heart-fusion 2.0.0
File Interpreter ABI Platform
heart_fusion-2.0.0-py3-none-any.whl Python 3 none any Details

Release files / heart_fusion-2.0.0-py3-none-any.whl

Download URL heart_fusion-2.0.0-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f063699da71ca889110305edc97996f28f37f80690da418eccf966a1f295900
BLAKE2b-256 checksum
How to use checksums
6bc3a3fa9c78afa6b3d7a6222d8c304ab428dd3ac7ecfd3736cf2a54584014b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Release history Release notifications | RSS feed

2.0.1

1 release file

This release

2.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page