← All models

feature-extraction Β· text Β· WASM Β· ~139 MB

Jina v2 β€” the embedder that reads the whole document

Most sentence embedders stop at 512 tokens β€” feed them a long document and they quietly ignore everything after the first few paragraphs. Jina embeddings v2 swaps learned positional embeddings for ALiBi, so a single 768-number vector can represent up to 8192 tokens β€” a whole article. Type passages to build a live similarity matrix, search long text by meaning, and watch Jina catch an answer buried in a tail that a 512-token model never even reads. Nothing leaves your device.

At a glance

ModelXenova/jina-embeddings-v2-base-en (ONNX of jinaai/jina-embeddings-v2-base-en)
Task / pipelinefeature-extraction
ArchitectureJinaBERT (BERT + ALiBi, ~137M params) β†’ 768-dimensional embedding
Context length8192 tokens β€” vs the usual 512 (this is the whole point)
Poolingmask-aware mean pooling, then L2-normalize; no instruction prefix
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~139 MB, cached after first load
LicenseApache-2.0
Web APIsWebAssembly, Web Workers β€” all Baseline widely available

Run it

Put one passage per line (they can be long β€” full paragraphs), then embed. The matrix is the cosine similarity between every pair; the scatter is a 2D PCA map where near = similar. Then type a query to rank the passages by meaning.

Cosine similarity matrix

2D map (PCA)

See inside β€” the vector, and the long-context advantage

The encoder emits one 768-number vector per token; Jina mean-pools them (mask-aware) and L2-normalizes, so each passage becomes a unit-length arrow and cosine is a dot product. Embed above, then pick a passage to see its real vector and pre-normalization magnitude.

Embed some passages above to inspect a vector.

The tail a 512-token model never reads

Here is a long document whose answer to the query below sits in the final paragraph β€” past the 512-token cutoff of a standard encoder. We embed it with Jina (full document) and with MiniLM-L6 (which truncates at 512 tokens), then score each against the query. Jina saw the tail; MiniLM didn't. Watch the cosine gap.

Why it matters

Long context changes what you can embed. Instead of chopping a document into 512-token chunks and hoping the right chunk survives, you embed the whole thing once β€” fewer vectors, no lost tail, and a representation that actually reflects the full text. All private, because nothing leaves the tab.

Use cases

Basics

Do two passages mean the same thing? One cosine number β€” even for long text.

Practical

Long-document semantic search and near-duplicate detection over full paragraphs.

Wild

Cluster a pile of passages into themes with k-means over the embeddings.

Multi-model

Jina retrieves a shortlist, then a cross-encoder reranker re-scores the top hits.

How the API works

Feature-extraction with mean pooling β€” and no prefix, no 512-token ceiling:

import { pipeline } from "@huggingface/transformers";

const extract = await pipeline(
  "feature-extraction",
  "Xenova/jina-embeddings-v2-base-en",
); // downloads + caches ~139 MB once

// Jina uses MEAN pooling and needs NO prefix β€” and accepts up to 8192 tokens:
const out = await extract([longDocument, query], { pooling: "mean", normalize: true });
const [doc, q] = out.tolist();

// unit-length vectors β†’ cosine similarity is just the dot product:
const sim = q.reduce((s, x, i) => s + x * doc[i], 0);

This page pools with normalize:false so "See inside" can show the real pre-normalization magnitude, then normalizes in JS. Inference runs in a Web Worker, so the matrix, projection and long-context test never jank the page.

References