arrowspace
它能做什么
ArrowSpace 能帮你在大型数据集中查找信息。它考虑的不只是直接的相似度,还包括各项内容之间的关联方式。它采用基于图的方法,来理解你数据中隐藏的结构。
适用场景
- ✓当普通搜索漏掉了看似相关的信息时。
- ✓如果你想找到在数据整体结构中很重要的条目,而不仅仅是最相似的那些。
- ✓在构建搜索系统时,如果你需要理解一条信息的“角色”,而不只是它的内容。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/arrowspace/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“帮我找出那些对理解人工智能整体背景很重要的文档,而不只是直接讨论这个话题的文档。”
每周 5 个新技能,1 分钟读完。
工作原理
它会创建一个网络(图),其中每个条目是一个节点,连线表示它们之间的关系。然后它分析这个网络的属性,找出在结构上很重要、同时在语义上也相似的条目。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
ArrowSpace
Spectral vector search that augments nearest-neighbour search with graph Laplacian features. Computes a Laplacian over the item graph and uses the Rayleigh quotient to produce a λτ (lambda-tau) score per item, enabling search that respects both semantic similarity and structural role.
When to Use This Skill
- Cosine or L2 similarity misses latent structure in your embeddings
- You want graph-based retrieval with spectral awareness
- You need to characterise the spectral properties of an embedding space
- You are building RAG pipelines where contextual role matters alongside semantic content
How It Works
Step 1: Install and import
python3 -m pip install "arrowspace==0.28.1" numpy # review/pin remaining dependencies in an isolated environment
from arrowspace import ArrowSpaceBuilder
import numpy as np
Step 2: Prepare your data
Pass an (N, d) float64 NumPy array of embedding vectors:
rng = np.random.default_rng(7)
items = rng.normal(size=(32, 8)).astype(np.float64)
items /= np.linalg.norm(items, axis=1, keepdims=True)
Step 3: Configure graph parameters
graph_params = {"eps": 0.5, "k": 6, "topk": 3, "p": 2.0, "sigma": None}
aspace, graph = ArrowSpaceBuilder().build(graph_params, items)
Step 4: Query
lambdas = aspace.lambdas() # array indexed by insertion order
sorted_res = aspace.lambdas_sorted() # (score, index) pairs ascending
These are per-item spectral signatures, not graph eigenvalues or query-dependent relevance scores. Sorting them alone is not nearest-neighbor retrieval; do not infer closeness to a query or graph centrality from a large signature.
Examples
Example 1: Basic spectral retrieval
# Reuse the normalized corpus and graph above; verify degenerate scores first.
if np.any(np.abs(aspace.lambdas()) < 1e-12):
raise ValueError("Tune graph parameters for this corpus before searching")
query = items[0].copy()
hits = aspace.search(query, graph, tau=0.7, k=5)
# hits contains query-dependent (item_index, score) pairs, not a lambda-only ranking.
Example 2: Compare spectral vs cosine ranking
from sklearn.metrics.pairwise import cosine_similarity
cos_sim = cosine_similarity(items)
cosine_order = np.argsort(cos_sim[0])[::-1][:5]
spectral_order = [index for index, score in aspace.search(items[0], graph, tau=0.7, k=5)]
# For retrieval evaluation, exclude self-matches and use held-out relevance labels.
Best Practices
- ✅ Normalise embeddings to unit norm before passing to ArrowSpace
- ✅ Treat graph parameters as corpus-dependent; inspect disconnected/degenerate scores and tune using an explicitly selected objective
- ✅ Choose k relative to the actual corpus and library constraints; N/50 is not a universal quality guarantee
- ✅ In the reviewed 0.28 API, sigma=None uses the eps-dependent default; it is not automatic distribution fitting
- ✅ Small corpora can illustrate the API, but retrieval quality requires corpus-appropriate evaluation; ten items is not a mathematical validity threshold
- ❌ Don't use for real-time streaming data (ArrowSpace is batch-oriented)
Limitations
- API examples target the reviewed 0.28 interface; immutable upstream skill documents the builder, graph return value and query-aware search. These examples were checked against source documentation, not executed here.
- Fit graph parameters and tau on held-out retrieval evidence; λτ signatures alone do not prove better recall or structural importance.
- ArrowSpace is batch-oriented and not designed for real-time indexing of streaming data.
Common Pitfalls
Problem: eps is too small, producing a disconnected graph Solution: Inspect graph connectivity and degenerate scores, then tune eps against the actual data; no dimension-only formula is guaranteed
Problem: k is too large, producing a dense graph with washed-out spectral features Solution: Keep k ≤ 25 for most datasets
Related Skills
vector-database-engineer— General vector database expertiseembedding-strategies— Embedding model selection and chunkingsimilarity-search-patterns— Semantic search implementation patternshybrid-search-implementation— Combined semantic + keyword search
常见问题
什么是“嵌入(embeddings)”?
嵌入是把文本、图片等信息转换成计算机能够理解的数字表示。数字越接近,对应的原始信息就越相似。
为什么不直接用普通的相似度搜索(比如 cosine)?
普通搜索可能无法捕捉更细微的关系,也无法体现某个条目在大型数据集中的结构性重要程度。
我能用它处理实时数据吗?
不太适合。ArrowSpace 是为批处理设计的,对于不断实时变化的数据并不理想。
详情
作者的原始描述
Spectral vector search using graph Laplacian eigenstructure. Use when cosine/L2 similarity misses latent structure in your embeddings.
热度
- GitHub 星标
- 48k
- 排名
- #3817
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。