Skip to main content

Precompute the Semantic Index with vg embed

Use vg embed to precompute the semantic index so your next vg ask is instant. Learn how the local ONNX model works, why it is fully offline, and when to run it.

Vibgrate Docs

Vibgrate Help

Semantic search makes vg ask powerful, but generating embeddings on demand adds latency the first time. vg embed precomputes the semantic index ahead of time so your next query returns instantly. This article explains what it does and when to run it.

Overview

Vibgrate Graph answers questions with hybrid lexical, structural, and semantic search. The semantic component relies on an index of embeddings. vg embed builds that index in advance using a local ONNX model that is downloaded once into a shared cache. After the first run everything is fully offline — no network calls and nothing uploaded.

Prerequisites

Build the code map so there is something to index:

vg build

Precompute the index

vg embed

The first invocation downloads the local model into a shared cache; subsequent runs reuse it. Once the index exists, vg ask skips the embedding step and returns its context block right away:

vg ask

When to run it

  • Before a working session. Run vg embed once so every vg ask during the session is instant.
  • After significant code changes. Rebuild the map and re-embed so semantic search reflects the latest code.
  • In setup scripts. Warm the index as part of project onboarding so teammates get fast queries from the start.

Why it is offline-first

The model lives in a local shared cache and runs on your machine. After the one-time download, embedding and querying need no network access — a good fit for private repositories and air-gapped environments.

Related

  • Ask the code map a question with vg ask.
  • Build the map with vg build.
  • Start the local context server with vg serve.

The semantic index is stored locally and is never transmitted.