build-context-token-vectors

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Build context token vectors

构建上下文令牌向量

A benchmark is only as good as what it compares against, and
tools/token_bench.py
takes its comparison set by hand. This derives one.
基准测试的质量取决于其对比对象,而
tools/token_bench.py
需要手动指定对比集。本工具可自动生成对比集。

Run it

运行方式

bash
python3 -m venv /tmp/vectors
/tmp/vectors/bin/pip install evoc model2vec matplotlib
/tmp/vectors/bin/python check/build-context-token-vectors/scripts/vectors.py --serve
--serve
starts a loopback companion, opens it, and stays alive until Ctrl-C. Change any EVoC parameter in the page and press Retune: the companion fits EVoC again while reusing the loaded corpus, embeddings, projection, and nearest peers.
--port
changes its default port,
8932
.
--out <file>
writes a read-only snapshot instead. With neither flag, the tables print to the terminal.
matplotlib
is required and not declared by
evoc
:
evoc.label_propagation
imports it at module scope, so
import evoc
fails on a clean install without it. Report that upstream rather than patching around it here.
--root
points at another skills directory, default
~/.agents/skills
.
--model
names another model2vec static model, default
minishlab/potion-base-8M
.
-k
sets how many neighbours each skill reports.
bash
python3 -m venv /tmp/vectors
/tmp/vectors/bin/pip install evoc model2vec matplotlib
/tmp/vectors/bin/python check/build-context-token-vectors/scripts/vectors.py --serve
--serve
参数会启动一个环回配套工具,打开该工具并保持运行直到按下Ctrl-C。在页面中修改任意EVoC参数后点击重新调整:配套工具会在复用已加载的语料库、嵌入、投影和最近邻数据的前提下重新拟合EVoC。
--port
可修改默认端口8932。
--out <file>
会生成一个只读快照。如果不使用这两个参数,结果表格将打印到终端。
matplotlib
是必需依赖,但未在
evoc
的依赖声明中列出:
evoc.label_propagation
会在模块层面导入它,因此在全新环境中安装后直接
import evoc
会失败。请向上游反馈该问题,而非在此处进行补丁修复。
--root
可指定其他skill目录,默认路径为
~/.agents/skills
--model
可指定其他model2vec静态模型,默认使用
minishlab/potion-base-8M
-k
用于设置每个skill返回的邻居数量。

Tune it

参数调优

Every EVoC parameter is both a flag and a live control. Only values you set are passed, so a run that changed nothing says
EVoC defaults
rather than looking tuned. Empty live controls restore the corresponding default.
FlagTurns
--base-min-cluster-size
How many points make a cluster. Lower splits, higher merges.
--n-neighbors
The kNN graph's width. Lower sees local structure, higher sees global.
--min-samples
The density estimate.
--noise-level
How readily a point is called noise.
--n-epochs
,
--neighbor-scale
,
--min-similarity-threshold
The node embedding, and where layers separate.
The useful act is comparing two settings, never trusting one:
EVoC defaults                            8 clusters, 49 noise
--base-min-cluster-size 3 --n-neighbors 10   9 clusters, 53 noise
--noise-level 0.2                        7 clusters, 39 noise
The page prints the settings behind its current result, so a screenshot still says what produced it.
所有EVoC参数既可用作命令行标志,也可作为实时控制项。仅会传递你设置的值,因此未做任何修改的运行会显示
EVoC defaults
而非已调优状态。清空实时控制项将恢复对应参数的默认值。
标志作用
--base-min-cluster-size
构成一个聚类所需的点数。值越小聚类越分散,值越大聚类越集中。
--n-neighbors
kNN图的宽度。值越小越关注局部结构,值越大越关注全局结构。
--min-samples
密度估计值。
--noise-level
判定点为噪声的阈值。
--n-epochs
,
--neighbor-scale
,
--min-similarity-threshold
节点嵌入参数,以及层分隔的阈值。
有效的做法是对比两种设置,而非轻信单一结果:
EVoC defaults                            8 clusters, 49 noise
--base-min-cluster-size 3 --n-neighbors 10   9 clusters, 53 noise
--noise-level 0.2                        7 clusters, 39 noise
页面会打印当前结果对应的设置参数,因此截图也能说明该结果的生成条件。

Explore it

探索功能

The dashboard is not a report. Switch layer to move between the resolutions EVoC found, coarsest first. Rail organizes known skills as
first
,
build
,
land
,
check
, then the
kit
and
fix
aids; this is display metadata and never changes the vectors. Filter to Local, All, or Noise. Search by skill name, by a peer's name, or by a cluster id such as
c4
. Click any point or row to inspect one skill: its membership strength, its full neighbour list, and every other member of its cluster at the current layer.
该仪表盘并非报告。切换layer可在EVoC识别出的不同分辨率间切换,从最粗粒度开始。Rail将已知skill分为
first
build
land
check
,以及
kit
fix
辅助类;这仅为展示元数据,不会更改向量数据。可筛选Local(本地)、All(全部)或Noise(噪声)。可按skill名称、同类skill名称或聚类ID(如
c4
)进行搜索。点击任意点或行可查看单个skill的详情:其成员强度、完整邻居列表,以及当前层级下所属聚类的所有其他成员。

Read it

结果解读

OutputMeans
Cosine similarityHow close two skills' doctrine sits. Roughly: above 0.80 a real peer, 0.65 to 0.80 a loose one, below 0.65 no peer at all.
A cluster tagThe skill was placed, and the other members of that cluster are its neighbourhood.
noise
It was placed nowhere.
The scatter plotTwo principal components, for orientation only. Clustering ran in full dimensionality, so two points that look adjacent may not be. The neighbour table carries the real numbers.
noise
is not a verdict.
It says the corpus holds no peer. Whether that is novelty or a diluted
SKILL.md
is a judgement this cannot make, for the same reason it cannot rank: clustering observes position, never quality.
输出项含义
Cosine similarity衡量两个skill的规则(doctrine)相近程度。大致标准:0.80以上为真正的同类skill,0.65至0.80为松散同类,0.65以下则无同类skill。
聚类标签该skill被归入某一聚类,该聚类的其他成员为其同类群体。
noise
该skill未被归入任何聚类。
散点图两个主成分,仅用于定位参考。聚类是在全维度空间中运行的,因此看起来相邻的两个点实际可能并不相近。邻居表格中的数据才是真实的相似度数值。
noise
并非负面判定
。它仅表示语料库中没有该skill的同类项。这到底是skill具备创新性,还是其
SKILL.md
内容不够明确,本工具无法做出判断——就像它无法对skill进行排名一样:聚类仅观察位置,不评估质量。

The seed is not tuning

随机种子不属于调优范畴

EVoC is stochastic. Without
random_state
two runs over identical input return different labels, and a comparison set that changes per run is not one.
SEED
is declared in the script and is part of any result worth quoting.
EVoC是随机算法。若未设置
random_state
,对相同输入的两次运行会返回不同的标签,而每次运行都变化的对比集不能称为稳定的对比集。脚本中声明的
SEED
是任何可引用结果的一部分。

What it will not do

不支持的功能

The live companion writes nothing. A deliberate
--out
writes only its page. Neither mode authors a
--flow
, edits
token_bench.py
, ranks a skill, or records a judgement. Reading it may change which comparison you run next; nothing here runs one.
Its three dependencies live in a virtual environment you create. Nothing under
first/aesthetic/scripts/
or
tools/
imports them, and this skill ships none of them.
实时配套工具不会写入任何数据。显式使用
--out
参数仅会生成对应页面的快照。两种模式均不会生成
--flow
、编辑
token_bench.py
、对skill进行排名或记录判断结果。解读结果可能会改变你接下来要运行的对比测试,但本工具本身不会执行任何对比测试。
本工具的三个依赖项需安装在你创建的虚拟环境中。
first/aesthetic/scripts/
tools/
下的任何文件均不会导入这些依赖,且本skill未附带这些依赖项。