关于「布拉赫特与有本:用标准库算护栏的率失真函数」,《护栏压缩的极限》给出的定量结论是什么?
结论:第三章在标准库里实现布拉赫特与有本的算法,与二元信源解析解逐位一致,并显示逐稿规则比率失真曲线多用 0.2620 比特。
数据口径:本书把候选规则写成离散信源、把审稿裁决写成相关变量,用香农的率失真函数、布拉赫特与有本的迭代和提斯比等人的信息瓶颈逐条检验,并修正蓝图:原文没有「断崖」之说;最优曲线是凹的、连续的,越压越陡,示意信源上每删一比特的代价从 0.012 升到 0.592;断崖只在整数条数低于需要区分的裁决组数、解的结构跨过临界点、或用离散计分去量时出现;审稿人不犹豫时代价恰是直线。 书中参数为示意;全部计算由书中程序生成;本书是非个人化经营建议,不构成法律或内容合规意见,任何护栏规则的删并与上线须由主事者人工复核放行。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.2620
| expected cost: one action for all 1.5262, full detail 0.4144 | |
| slope D (cost) R(D) bits rules > | 2^R |
| -0.3 | 1.2776 0.0630 1.04 |
| -0.6 | 1.0403 0.2138 1.16 |
| -1.0 | 0.7505 0.5437 1.46 |
| -1.5 | 0.6050 0.7981 1.74 |
| -2.5 | 0.4966 1.0971 2.14 |
| -4.0 | 0.4427 1.3384 2.53 |
| -8.0 | 0.4170 1.5312 2.89 |
| best per-draft rule maps vs the curve at the same cost: | |
| k cost H(A) bits R(cost) excess | |
| 1 | 1.5262 0.0000 0.0000 0.0000 |
| 2 | 0.6494 0.9710 0.7090 0.2620 |
| 3 | 0.4144 1.5690 1.5690 0.0000 |
查看完整验算程序
# Chapter 3. p32: the rate-distortion curve of a guardrail. Source = the
# eight draft kinds of p11; reproduction = the gate's action (pass,
# revise, block); distortion d(x, a) = expected cost of action a on kind
# x under an illustrative cost table (passing a draft that should be
# blocked costs 10). Blahut-Arimoto gives R(D); a rule set of k distinct
# outputs carries at most log2 k bits, so it needs k >= 2 ** R(D).
# Last part: the best one-draft-at-a-time rule maps (all 3 ** 8) sit
# above the curve; Shannon's R(D) is reached only by coding long blocks.
import itertools
import math
PX = [0.40, 0.18, 0.10, 0.07, 0.10, 0.06, 0.05, 0.04]
PYX = [[0.92, 0.06, 0.02], [0.25, 0.70, 0.05], [0.30, 0.55, 0.15],
[0.10, 0.60, 0.30], [0.05, 0.15, 0.80], [0.03, 0.12, 0.85],
[0.02, 0.08, 0.90], [0.01, 0.04, 0.95]]
COST = [[0.0, 1.0, 3.0], [2.0, 0.0, 1.0], [10.0, 4.0, 0.0]]
DIST = [[math.fsum(PYX[x][y] * COST[y][a] for y in range(3))
for a in range(3)] for x in range(8)]
def blahut(s, iters=50000, tol=1e-14):
r = [1.0 / 3] * 3
for _ in range(iters):
q = []
for x in range(8):
w = [r[a] * math.exp(s * DIST[x][a]) for a in range(3)]
tot = math.fsum(w)
q.append([v / tot for v in w])
new = [math.fsum(PX[x] * q[x][a] for x in range(8))
for a in range(3)]
gap = max(abs(u - v) for u, v in zip(new, r))
r = new
if gap < tol:
break
d = math.fsum(PX[x] * q[x][a] * DIST[x][a]
for x in range(8) for a in range(3))
rate = math.fsum(PX[x] * q[x][a] * math.log2(q[x][a] / r[a])
for x in range(8) for a in range(3) if q[x][a] > 0)
return d, max(rate, 0.0)
def rate_at(target):
lo, hi = -60.0, 0.0
for _ in range(60):
mid = (lo + hi) / 2
if blahut(mid)[0] > target:
hi = mid
else:
lo = mid
return blahut(lo)[1]
dmax = min(math.fsum(PX[x] * DIST[x][a] for x in range(8))
for a in range(3))
dmin = math.fsum(PX[x] * min(DIST[x]) for x in range(8))
print("expected cost: one action for all %.4f, full detail %.4f"
% (dmax, dmin))
print(" slope D (cost) R(D) bits rules >= 2^R")
for s in [-0.3, -0.6, -1.0, -1.5, -2.5, -4.0, -8.0]:
d, rate = blahut(s)
print(" %5.1f %6.4f %6.4f %5.2f" % (s, d, rate, 2 ** rate))
best = {}
for m in itertools.product(range(3), repeat=8):
k = len(set(m))
d = math.fsum(PX[x] * DIST[x][m[x]] for x in range(8))
if k not in best or d < best[k][0] - 1e-12:
best[k] = (d, m)
print("best per-draft rule maps vs the curve at the same cost:")
print(" k cost H(A) bits R(cost) excess")
for k in sorted(best):
d, m = best[k]
pa = [math.fsum(PX[x] for x in range(8) if m[x] == a) for a in range(3)]
ha = 0.0 - math.fsum(p * math.log2(p) for p in pa if p > 0)
rd = rate_at(d) if d < dmax - 1e-9 else 0.0
print(" %d %6.4f %6.4f %6.4f %6.4f" % (k, d, ha, rd, ha - rd))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《信息瓶颈率失真极值、双语专著到全局护栏的极限压缩比与判别力保真母典》第 3 章「布拉赫特与有本:用标准库算护栏的率失真函数」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-250 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026250,
author = {Fan, Yafu},
title = {The Information Bottleneck and Rate-Distortion Limits: How Far a Bilingual Monograph Can Be Compressed into Guardrails before Discriminative Power Falls Away},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}