跳到正文
cccskills
免费在 GitHub 公开

embeddings-guide

Work with text embeddings — choosing models, pooling, similarity measures, evaluation, and multilingual considerations. Use when building semantic search, clustering, or any similarity-based feature.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md3.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Embeddings Guide

Embeddings turn text into vectors where similarity means relatedness. They're the foundation of semantic search, RAG retrieval, clustering, and recommendations. The skill is choosing the right model, using it correctly, and evaluating on your data.

Overview

An embedding model maps text to a dense vector; cosine similarity (usually) measures relatedness. Quality varies by domain, language, and text length — a model great at English Wikipedia may fail on your support tickets. Key choices: the model itself, how you handle long texts (chunk + pool), whether to use task-specific instructions (asymmetric search: query vs. document phrasing differs), and how you evaluate (on your data, not the leaderboard).

When to use

  • Semantic search or RAG retrieval over your corpus.
  • Clustering, deduplication, or topic discovery on text.
  • Recommendation: "similar items" features.
  • Anywhere you need "find text like this text."

Core concepts

  • Model selection: size/quality/speed trade-offs; domain fit matters more than leaderboard rank. Evaluate candidates on your own query-document pairs.
  • Asymmetric vs. symmetric: search queries differ from documents (short question vs. long passage). Instruction-tuned models handle this with task prefixes; test whether yours needs them.
  • Pooling long texts: embed chunks and aggregate (mean, max) or retrieve at chunk level. Don't truncate long documents to the model's limit and hope.
  • Similarity measures: cosine (standard, normalize vectors), dot product (with unnormalized, scale-sensitive), Euclidean (less common for text). Be consistent between indexing and querying.
  • Normalization: L2-normalize vectors so cosine = dot product; many vector DBs assume this. Mismatched normalization silently breaks ranking.
  • Evaluation: build a small set of query → known-relevant documents from your corpus. Measure recall@k per candidate model. This beats any public benchmark for your decision.

Practical workflow

  1. Collect 30–50 representative queries with known-relevant documents from your corpus.
  2. Shortlist 3–4 embedding models (varying size); embed your corpus with each.
  3. Measure recall@k and MRR on your eval set; also measure embedding latency and cost.
  4. Decide chunking: chunk documents first, embed chunks, retrieve chunks — tune chunk size on the eval set.
  5. Normalize consistently; verify the similarity metric matches between index and query time.
  6. Monitor: sample production queries periodically; re-evaluate when the corpus or model changes.
Embedding eval template:
QUERIES:  30-50 real queries + known-relevant docs
MODELS:   3-4 candidates (note dims, latency, cost)
METRICS:  recall@5, recall@20, MRR
DECIDE:   best quality within latency/cost budget

Common pitfalls

  • Leaderboard shopping: picking the top benchmark model without testing on your data. Domain mismatch is common.
  • Truncating long documents: embedding only the first 512 tokens of a 10-page doc. Chunk properly.
  • Ignoring the query/document asymmetry: same embedding approach for both when the model expects task prefixes. Read the model's docs.
  • Normalization mismatch: indexing normalized, querying unnormalized (or vice versa). Ranking breaks silently.
  • No eval set: "embeddings feel good." Build the query-relevance set; it's a day's work that pays forever.
  • Embedding everything at query time: precompute document embeddings; embed only the query live. Obvious but often missed under deadline.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Master 1Password: vaults, Watchtower, passkeys, SSH agent, CLI, and family/team administration. Use when getting full value from 1Password personally or administering it for others.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills252026年10月10日 更新

Create 3D visuals with modeling, texturing, lighting, rendering, and optimization for web and product.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills252026年10月10日 更新

Create 3D web experiences: scene setup, models, materials, lighting, animation, scroll-driven scenes, and performance budgets. Use when adding 3D to websites beyond basic demos.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills252026年10月10日 更新

Writing abstracts that get papers read — structured content, the 5-sentence core, and journal-specific constraints.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills252026年10月10日 更新

Learn effectively from courses and academies: choosing programs, studying actively, and converting courses into skills. Use when investing time/money in structured learning.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills252026年10月10日 更新

Audit designs for accessibility with WCAG checklists covering color, type, focus, motion, and content.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills252026年10月10日 更新

查看 aicodedecode 的全部技能

报告此技能的问题