Skip to content
Dashboard

Qwen3 Embedding 4B

Qwen3 Embedding 4B is a mid-tier 4-billion-parameter text embedding model producing 2560-dimensional vectors over a context of 32.8K tokens, designed for multilingual semantic search and code retrieval that balances quality with operational cost.

Input price
Input $0.02, Per 1M tokens
import { embed } from 'ai';
const result = await embed({
model: 'alibaba/qwen3-embedding-4b',
value: 'Sunny day at the beach',
})
Read docs

Copy link to headingProviders

Route requests across multiple providers. Copy a provider slug to set your preference. Visit the docs for more info. Using a provider means you agree to their terms, listed under Legal.

Provider
Context
Input
Capabilities
ZDR
No Training
Free Tier
Release Date
33K
$0.02/M
06/05/2025

Copy link to headingMore models by Alibaba Cloud

Model
Context
Latency
Throughput
Input
Output
Cache
Web Search
Capabilities
Providers
ZDR
No Training
Free Tier
Release Date
991K4.0 s50 tps
$2/M
$6/M
Read$0.25/M
Write$2.50/M
+2
alibaba logo
09/01/2026
991K1.1 s96 tps
$0.16/M
$0.47/M
Read$0.02/M
Write$0.20/M
+2
alibaba logo
08/26/2026
1M0.6 s133 tps
$0.10/M
$0.40/M
Read$0.01/M
Write$0.63/M
+1
alibaba logo
deepinfra logo
morph logo
+3
08/14/2026
1M2.5 s160 tps
$2/M
$6/M
Read$0.25/M
Write$2.50/M
+1
alibaba logo
fireworks logo
08/02/2026
991K2.5 s140 tps
$0.03/M+2 more
$0.13/M+2 more
Read$0.006/M
Write$0.04/M
+2
alibaba logo
07/28/2026
1M2.0 s58 tps
$0.40/M+1 more
$1.60/M+1 more
Read$0.08/M
Write$0.50/M
+2
alibaba logo
06/02/2026

Copy link to headingAbout Qwen3 Embedding 4B

Qwen3 Embedding 4B represents the middle tier of the Qwen3 Embedding family, balancing retrieval quality against operational cost. Its 2560-dimensional output space captures richer semantic structure than the 0.6B variant, which translates to measurably better performance on dense retrieval benchmarks and multilingual similarity tasks without reaching the full resource requirements of the 8B model.

The embeddings handle asymmetric retrieval tasks where a short user query must match longer documents, and support user-defined instruction prefixes to adapt the embedding space to a specific domain or retrieval intent. Cross-lingual transfer is stable across the 100+ natural languages and multiple programming languages the Qwen3 Embedding family covers.

The context window of 32.8K tokens allows Qwen3 Embedding 4B to embed substantial passages in one shot, reducing the need for aggressive chunking in document-heavy workflows. Combined with Matryoshka Representation Learning (MRL), dimension counts can be adjusted at query time to trade off storage against precision, giving teams flexibility when scaling a vector index.

Copy link to headingWhat To Consider When Choosing a Provider

  • Configuration: Provider selection is most consequential when your use case combines high query volume with data-sovereignty requirements, verify each provider's regional availability before finalizing your architecture.
  • Zero Data Retention: Zero Data Retention is available for this model. It is offered on a per-provider and model basis. See the documentation for details.
  • Authentication: AI Gateway authenticates requests using an API key or OIDC token. You do not need to manage provider credentials directly.

Copy link to headingWhen to Use Qwen3 Embedding 4B

Best for

  • Enterprise multilingual search: Applications that require high multilingual precision but can't justify the full cost of an 8B model
  • Semantic similarity and clustering: Datasets that span many languages or mix natural language with code
  • Quality-sensitive RAG: Pipelines serving diverse user populations where retrieval quality visibly affects answer accuracy
  • Cross-lingual alignment: Document alignment tasks where 2560-dimensional vectors provide better discriminability than smaller alternatives

Consider alternatives when

  • Throughput and cost first: Dominant constraints where slightly lower recall is acceptable make the 0.6B variant sufficient
  • Maximum retrieval precision: Specialized domains with dense, technical vocabulary may be better served by the 8B model
  • Generative output required: This model produces embeddings only; use a generative model when you need text output

Qwen3 Embedding 4B is a well-positioned middle-ground choice for teams building multilingual retrieval systems that need better-than-baseline precision without committing to the full resource footprint of larger models. Its 2560-dimensional output and flexible dimension truncation via MRL give engineers a range of tradeoff points across the storage-vs-quality curve.

Copy link to headingFrequently Asked Questions

  • What output dimensionality does Qwen3 Embedding 4B produce?

    The model outputs 2560-dimensional vectors by default. Matryoshka Representation Learning allows prefix truncation to smaller sizes if storage or query-speed budgets require it.

  • How does the 4B model differ architecturally from the 0.6B and 8B variants?

    All three variants use a dual-encoder structure and share the same context window of 32.8K tokens. The 4B model uses 36 layers (compared to 28 in the 0.6B) and produces 2560-dimensional vectors, wider than the 0.6B's 1024 dimensions but narrower than the 8B's 4096.

  • What multilingual coverage does Qwen3 Embedding 4B support?

    Qwen3 Embedding 4B covers more than 100 natural languages plus multiple programming languages, enabling cross-lingual and code-retrieval tasks within a single embedding space.

  • Can instruction prefixes change what the model retrieves?

    Yes. The model supports custom instruction prefixes at query time to guide the embedding toward a specific retrieval task, such as legal document search vs. general knowledge retrieval.

  • Is this model appropriate for code-retrieval tasks alongside natural language?

    Yes. The Qwen3 Embedding models explicitly include code in their language coverage, so hybrid corpora of code and prose can be embedded in the same vector space.

  • How does chunking strategy affect retrieval quality at context of 32.8K tokens?

    Longer passages embedded as single units can yield better recall for complex queries, but very long inputs near the ceiling of 32.8K tokens may dilute specificity. Experiments with paragraph-level vs. section-level chunking are worthwhile for your specific domain.

Your use is subject to Alibaba Cloud's Terms & Privacy Policies.