Skip to content
Agentmart
Submit a tool

flag-embedding

Use FlagEmbedding for embedding, reranking, retrieval evaluation, and fine-tuning workflows.

Skill by VectorSpaceLab

IndexedMIT★ 341
Write a review

Chalk Labs

Need help deploying flag-embedding?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/vectorspacelab-flag-embedding

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use FlagEmbedding for embedding, reranking, retrieval evaluation, and fine-tuning workflows.

Use cases: ml

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/flag-embedding

What's inside

Skill name
flag-embedding
Description
Use FlagEmbedding for embedding, reranking, retrieval evaluation, and fine-tuning workflows.
License
MIT
Metadata
disco-role: operating
Instructions
117 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (22)

  • SKILL.md
  • model-overview.md · references/
  • repo-provenance.md · references/
  • repo-routing-metadata.json · references/
  • troubleshooting.md · references/
  • check_flag_embedding_env.py · scripts/
  • SKILL.md · sub-skills/evaluation/
  • cli-reference.md · sub-skills/evaluation/references/
  • data-formats.md · sub-skills/evaluation/references/
  • troubleshooting.md · sub-skills/evaluation/references/
  • create_tiny_retrieval_dataset.py · sub-skills/evaluation/scripts/
  • SKILL.md · sub-skills/fine-tuning/
  • data-formats.md · sub-skills/fine-tuning/references/
  • training-commands.md · sub-skills/fine-tuning/references/
  • troubleshooting.md · sub-skills/fine-tuning/references/
  • split_jsonl_by_text_length.py · sub-skills/fine-tuning/scripts/
  • validate_train_jsonl.py · sub-skills/fine-tuning/scripts/
  • SKILL.md · sub-skills/inference/
  • api-reference.md · sub-skills/inference/references/
  • troubleshooting.md · sub-skills/inference/references/
  • workflows.md · sub-skills/inference/references/
  • smoke_inference_api.py · sub-skills/inference/scripts/

SKILL.md (first lines)

# FlagEmbedding

Use this repo skill when a task involves FlagEmbedding, BGE embedding models,
BGE-M3 dense/sparse/ColBERT retrieval, BGE rerankers, retrieval evaluation, or
FlagEmbedding fine-tuning data and launch commands.

Read `references/repo-provenance.md` when checking whether this skill matches a
current checkout or package version. Read `references/model-overview.md` when
choosing model families or deciding whether automatic model routing is likely to
work. Read `references/troubleshooting.md` for install/import, optional
dependency, backend, model-cache, and remote-code problems.

## Install And Import

Base package install:

```bash
python -m pip install -U FlagEmbedding
```

Fine-tuning extras:

```bash
python -m pip install -U "FlagEmbedding[finetune]"
```

Evaluation workflows also need retrieval metric/index dependencies that are not
always installed by the base package metadata:

```bash
python -m pip install faiss-cpu pytrec_eval
```

Use GPU-specific FAISS, CUDA PyTorch, DeepSpeed, or flash-attn only after the
runtime backend is deliberately prepared. Do not treat a CPU import as proof of
GPU training or flash-attn compatibility.

Minimal import check:

```bash
python - <<'PY'
from FlagEmbedding import FlagAutoModel, FlagAutoReranker
print(FlagAutoModel, FlagAutoReranker)
PY
```

Bundled environment/API probe from this skill directory:

```bash
python scripts/check_flag_embedding_env.py
```

## Route Map

Use `sub-skills/inference/SKILL.md` when the task is to load embedders or
rerankers, encode queries/corpus, compute BGE-M3 dense/sparse/ColBERT scores,
rerank query-passage pairs, choose `model_class`, handle instructions, or
smoke-check inference APIs without running training or benchmark jobs.

Use `sub-skills/fine-tuning/SKILL.md` when the task is to prepare or validate
training JSONL, mine or reason about hard negatives, add teacher-score fields,
split long data, choose an embedder/reranker fine-tuning module, build a
`torchrun` command, or diagnose DeepSpeed/flash-attn/training-data issues.

Use `sub-skills/evaluation/SKILL.md` when the task is to run or prepare
retrieval evaluation with FlagEmbedding, create custom `corpus.jsonl` /
`test_queries.jsonl` / `test_qrels.jsonl`, choose MTEB/BEIR/MSMARCO/MIRACL/MLDR
/MKQA/AIR-Bench/BRIGHT commands, add a reranker to evaluation, or interpret
metrics and output directories.

## Common Decisions

Prefer auto loaders for mapped checkpoints:

```python
from FlagEmbedding import FlagAutoModel, FlagAutoReranker

embedder = FlagAutoModel.from_finetuned(
    "BAAI/bge-base-en-v1.5",
    query_instruction_for_retrieval="Represent this sentence for searching relevant passages:",
    devices="cpu",
    use_fp16=False,
)

reranker = FlagAutoReranker.from_finetuned(
    "BAAI/bge-reranker-base",
    devices="cpu",
    use_fp16=False,
)
```

For custom or unmapped checkpoints, set `model_class` explicitly instead of
retrying the same auto call. Embedder ids include `encoder-only-base`,
`encoder-only-m3`, `decoder-only-base`, `decoder-only-icl`, and
`decoder-only-pseudo_moe`. Reranker ids include `encoder-only-base`,
`decoder-only-base`, `decoder-only-layerwise`, and `decoder-only-lightweight`.

Use CPU and full precision for cheap smoke checks. Move to CUDA, fp16, bf16,
large batch sizes, remote model ids, or benchmark downloads only after the user
approves the runtime, cache, and budget.

## Verification Anchors

The generated skill is grounded in these public surfaces:

- Public imports and mappings under `FlagEmbedding.inference`.
- Fine-tuning module entry points under `FlagEmbedding.finetune`.
- Evaluation module entry points under `FlagEmbedding.evaluation`.
- Maintained package examples distilled into bundled references and scripts.
- Small native candidates and synthetic fixtures recorded in the integration
  reports under the review/test artifact directory.

Runtime files do not require the original checkout. Source examples and scripts
were distilled into the generated skill references or adapted as bundled helper
scripts.

From VectorSpaceLab/AREX-Skill, MIT.

Signals

Stars
341
Forks
26
Open issues
0
Last commit (this folder)
Aug 26, 2026 (2 months ago)
Last release
Sep 2, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from VectorSpaceLab

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get flag-embedding running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying flag-embedding?

CallGet help
Cite this page

flag-embedding skill. Agent Mart. https://agentmart.dev/skills/vectorspacelab-flag-embedding (last updated 2026-10-24)