What you will be able to do
- Explain what an embedding model's context length is and what happens to text beyond it
- Pick between databricks-bge-large-en and databricks-gte-large-en by measuring your longest chunk and your longest query
- Explain why one model has to embed both the corpus and the queries, and what that means for the window you choose
- Choose a set of chunk sizes to test well below the maximum context length instead of filling the window
Key concept
Embedding context length — The maximum number of tokens an embedding model reads from one input. Anything past that limit is cut off before the vector is computed, so the vector says nothing about the text that was dropped.
1.What the token limit does to long inputs
In a RAG pipeline, every chunk passes through an embedding model, which turns it into a dense vector that captures what the chunk means. Retrieval then compares those vectors with the vector of the user's query. Each embedding model has a context length: the most tokens it will read from a single input. Before you choose a model, find out its limit and compare it with the real text you will send it.
Truncation fails quietly, and that is the danger. The pipeline runs, the index fills up, and every chunk has a vector. But in a 6,000-token passage embedded by a 512-token model, more than nine tenths of the text never affects the vector. A clause near the end of that passage can't be found by a query about it, because the vector contains nothing about the clause. You usually notice this the way a retrieval test would show it: questions about content late in long chunks keep missing, while questions about their opening lines work fine.
Databricks Foundation Model APIs serve two embedding models, and their windows are very different. databricks-bge-large-en (BAAI General Embedding) reads up to 512 tokens. databricks-gte-large-en (General Text Embedding) reads up to 8,192. If the passages you need to embed are thousands of tokens long, the fix is a model whose window holds them. Tricks that keep the 512-token model in place don't work. More overlap between neighbouring chunks only copies boundary text into the next chunk, and the over-long chunk is still cut at token 512. Averaging two vectors made from the same truncated input doesn't recover anything either, because both vectors come from the same first 512 tokens.
Checkpoint 1 of 8· Check yourself
A team embeds 3,000-token policy chunks with databricks-bge-large-en. In retrieval tests, questions about a chunk's opening lines succeed, but questions about clauses near the end of the same chunks keep missing. What fixes this?
BGE reads only 512 tokens, so the rest of each 3,000-token chunk is cut off before the vector is computed. A model whose window covers the chunk fixes that. More overlap leaves the over-long chunk cut at token 512. Averaging two vectors of the same truncated input adds nothing. Retrieving more results doesn't help because the vectors hold nothing about the late clauses.
“For example, bge-large-en-v1.5 has a maximum token limit of 512.”Source: docs.databricks.com
2.Context length is not vector size or normalization
A model card lists three numbers that are easy to confuse: how many tokens the model reads, how many dimensions its output vector has, and whether that vector is normalized. Each describes something different. The two Databricks-hosted English embedding models have the same output size and very different input windows.
| Endpoint | Embedding window (input) | Vector dimension (output) | Normalized embeddings |
|---|---|---|---|
| databricks-bge-large-en | 512 tokens | 1024 | Yes |
| databricks-gte-large-en | 8192 tokens | 1024 | No |
The table rules out two tempting arguments. First, a bigger window does not produce a bigger vector. Both models map any text to 1,024 dimensions, so choosing GTE for its 8,192-token window gives you no extra dimensions and no accuracy gain on text that already fits in 512 tokens. Second, normalization is not something you turn on to fix truncation. BGE already returns normalized embeddings, GTE does not, and neither fact changes how many tokens the model reads. When retrieval loses the ends of long chunks, normalized vectors still describe only the truncated text.
Both endpoints return 1,024-dimension vectors. The window only sets how much input the model reads, so for text that already fits in 512 tokens the larger window changes nothing.
Checkpoint 2 of 8· Match them up
A model card for a Databricks embedding endpoint lists three properties. Match each property to what it describes.
Tap a term, then the definition that fits it.
The window limits the input. The dimension and normalization describe the output vector. Both endpoints produce 1,024-dimension vectors, so picking GTE for its larger window adds no dimensions, and normalized vectors still describe only the text that was not truncated.
“map any text to a 1024-dimension embedding vector and an embedding window of 8192 tokens”Source: docs.databricks.com
Checkpoint 3 of 8· Exam question
A team is building a RAG system over lengthy legal contracts averaging 6,000 tokens per semantically chunked passage. Retrieval quality tests show many chunks are silently truncated before embedding, causing key clauses near the end of long chunks to be dropped from the vector representation. The team is currently using the databricks-bge-large-en embedding model. Which change best addresses the root cause?
Correct answer: C — Replace the current embedding model with databricks-gte-large-en, so each 6,000-token chunk fits its 8,192-token context window and is embedded as a single input.
- A. Overlap only repeats a small slice of each chunk's tail at the start of the next chunk.
databricks-bge-large-enhas a 512-token window, so thousands of tokens in every 6,000-token chunk are still dropped. Overlap cannot recover that much text, and the underlying limit stays in place. - B. Each half is still about 3,000 tokens, far above the 512-token window of
databricks-bge-large-en. Both halves are truncated just like the original chunk. Averaging the two vectors therefore still leaves most of the clause text unrepresented, and the model's input limit is untouched. - C. The root cause is the embedding model's input limit.
databricks-gte-large-enaccepts up to 8,192 tokens, so a 6,000-token chunk is embedded whole and clauses near the end of the chunk are no longer dropped from the vector. - D. The input limit is a property of the model itself (512 tokens for
databricks-bge-large-en). The serving endpoint's compute size changes throughput and latency, not how many tokens the model reads. Chunks of 6,000 tokens are still truncated before embedding.
Sources2
3.Sizing the window for documents and queries
The corpus is only half of what the window has to fit. At query time the user's question is embedded too, and it has to be embedded by the same model that embedded the chunks. Vectors are only comparable if they come from the same model. A BGE query vector and a GTE chunk vector are not in the same space, even though both have 1,024 dimensions.
This means you size the context length against the longest input on either side. Start from the source documents: once chunking is done, how long is the longest chunk you will embed? Then look at the expected queries. In a chatbot, a query might be a sentence. In a compliance tool where analysts paste whole regulatory excerpts as the search text, a query can run past 3,000 tokens. The window has to hold the larger of the two, or one side gets truncated.
Here is what that looks like in practice. The index holds 200-token clause chunks embedded with databricks-bge-large-en, and analysts paste 3,000-token excerpts as queries. The chunks fit comfortably, but every query loses everything after token 512, so relevance drops. Three tempting fixes don't work:
- Embedding only the queries with GTE puts query vectors in a different space from the BGE corpus vectors, so the similarity scores mean nothing.
- Cutting each query to 200 tokens to "match" the chunks throws away even more of what the analyst asked. Chunk size and query size don't need to match. Both just need to fit the window.
- Raising the number of results returned brings back more chunks for the same truncated query vector, but the query vector still lacks the content that was dropped.
The fix is to move both sides to a model whose window covers the long queries. That means re-embedding the corpus with databricks-gte-large-en, rebuilding the index on those vectors, and embedding incoming queries with the same endpoint.
Checkpoint 4 of 8· Check yourself
In an internal audit tool, policy text is split into 300-token chunks and embedded with databricks-bge-large-en. Auditors search by pasting 2,500-token report excerpts as their queries. Retrieval relevance is poor. What should the team do?
The 2,500-token queries are cut off at BGE's 512-token limit, so the window has to fit the longest input on either side. Queries must be embedded with the same model as the chunks, so switching to GTE means re-embedding the corpus too. A query-only switch puts the query vectors in a different space from the chunk vectors. Cutting the queries throws away more of the question, and returning more results still uses the same truncated query vector.
“The retrieval query will be transformed at query time using the same embedding model used to embed chunks in the data pipeline.”Source: docs.databricks.com
Checkpoint 5 of 8· Exam question
A compliance search tool lets analysts paste entire multi-paragraph regulatory excerpts, often 3,000+ tokens long, as the search query against a Databricks Vector Search index built over short 200-token clause chunks. The index and its queries both currently use the databricks-bge-large-en embedding model, and because the same model must embed both the corpus and incoming queries for the vector spaces to be comparable, long queries are truncated before embedding, degrading retrieval relevance. What is the best fix?
Correct answer: A — Switch the index to databricks-gte-large-en and re-embed the clause chunks with it, so chunks and pasted queries share one model and its 8,192-token window covers the full excerpt.
- A. Moving the index to the model with the 8,192-token window and re-embedding the chunks with it means chunks and queries come from one model, so their vectors stay comparable. The 3,000+ token excerpts then fit in the window, and the 200-token chunks embed without a problem.
- B. Cutting each excerpt to its first 200 tokens makes the information loss far worse. Most of the analyst's regulatory text is thrown away before embedding, so the clause language needed to find the right chunks is usually gone. Matching the chunk length does not make up for that.
- C. Chunks embedded with one model and queries embedded with another sit in different vector spaces, so similarity scores between them are not meaningful. Removing the truncation does not help, because the corpus and the queries must be embedded by the same model.
- D. Raising the number of results only changes how many chunks come back. The query is still truncated before embedding, so the vector it produces still lacks the dropped text. The relevant clauses can therefore stay outside the larger result set, and only a model with a longer window fixes the cause.
Sources1
4.Why the maximum context length is a ceiling, not a target
A large window is a reason not to worry about truncation. It is not a reason to fill the window. Databricks' own example pipelines show this. GTE and the OpenAI embedding model used with Databricks both read 8,192 tokens, yet the guidance for each is to split the data into smaller chunks, and the OpenAI example sets its chunker to 1,024 tokens.
max_chunk_tokens = 1024
encoding = tiktoken.get_encoding("cl100k_base")There are two reasons, one on each side of the pipeline. On the retrieval side, one vector has to summarize the whole chunk, and long inputs blur it. Research cited in Databricks' retrieval guide (DeepMind's LIMIT) found that embeddings can miss basic information in long contexts. An 8,000-token chunk covering six topics gets one vector that sits somewhere between all six and matches none of them well. Larger chunks keep more context, but they make it harder to pinpoint the relevant information. On the generation side, the retrieved chunks have to fit in the LLM's context window together. Smaller chunks let the retriever pass the LLM a wider variety of examples instead of a few long blocks.
In practice, find the limit first, then test several sizes below it. From the embedding side, the rule that chunk length and overlap must fit the model's limits means the chunk has to fit the window, but the window doesn't tell you the best chunk size. Retrieval evaluation does. Databricks gives these starting configurations:
# Common configurations to test
small_chunks = 256 # Better for precise fact retrieval
medium_chunks = 512 # Balanced approach
large_chunks = 1024 # More context per chunkSometimes you need precise matching and a lot of surrounding context at once. One long embedding window can't give you both, because the long vector loses the precision. Parent-child chunking (search small, return big) handles this differently: it embeds and searches small child chunks, then returns their larger parent to the LLM. In Databricks' example the child size is 512 tokens, which fits even BGE's window, while the 2,048-token parent is stored as text and never embedded.
# Record child and parent chunks in your source table
for parent_chunk in create_chunks(doc, size=2048): # Large for context
for child_chunk in create_chunks(parent_chunk, size=512): # Small for precision
source_table.append({"text": child_chunk, "parent_text": parent_chunk})Checkpoint 6 of 8· Fill the gap
A team on databricks-gte-large-en wants precise matching and enough surrounding context for the LLM. They use parent-child chunking. Which value completes the child chunk size in Databricks' example?
# Record child and parent chunks in your source table
for parent_chunk in create_chunks(doc, size=2048): # Large for context
for child_chunk in create_chunks(parent_chunk, size= ? ): # Small for precision
source_table.append({"text": child_chunk, "parent_text": parent_chunk})Only the child chunks are embedded and searched, so they are kept small (512 tokens) for precision, well under the window. The 2,048-token parent is returned as text for context. Using 8,192 treats the window as a target, and long vectors blur what they capture. Using 2,048 makes the children the same size as the parent, so the precision gain is lost.
Source: docs.databricks.com5.Choosing a context length to match the goal
Choosing the context length means weighing what you measured (the longest chunk, the longest query) against what you are optimizing for. If the goal is recall over long passages, the window has to cover them. If the goal is low cost and low latency on short text, the window only needs to cover the short text. Model size is part of the same trade-off: larger embedding models generally perform better but use more compute, so you balance performance against efficiency for your use case.
Take a support-search app over FAQ entries and troubleshooting snippets that average 180 tokens, none longer than 400. BGE's 512-token window holds every snippet whole, so no text is lost and the 1,024-dimension vectors are the same size GTE would produce. GTE's 8,192-token window would not be wrong, but it adds nothing for inputs this short. Since the goal is cost and latency, it isn't worth choosing. Picking the largest window "to be safe against future content" optimizes for a corpus the team doesn't have, at the expense of the one it does.
| Situation | Longest input | Choice | Why |
|---|---|---|---|
| Short troubleshooting snippets, minimize cost and latency | 400-token snippet | databricks-bge-large-en | The 512-token window holds every snippet; a larger window adds nothing |
| Semantically chunked legal contracts | 6,000-token passage | databricks-gte-large-en | Only the 8192-token window embeds the whole passage without truncation |
| Short clause chunks searched with pasted multi-page excerpts | 3,000-token query | databricks-gte-large-en for corpus and queries | The query is the longest input, and both sides must use the same model |
Checkpoint 7 of 8· Match them up
Each team has measured its longest input and set a goal. Match each situation to the right embedding window decision.
Tap a term, then the definition that fits it.
The window has to cover the longest input on either side, chunk or query, and anything past it is truncated. When everything already fits in 512 tokens and the goal is cost and latency, the larger GTE window adds nothing, because both models produce 1,024-dimension vectors.
“If you pass chunks that exceed this limit, they will be truncated, potentially losing important information.”Source: docs.databricks.com
Checkpoint 8 of 8· Exam question
A support-ticket search application embeds customer FAQ entries and short troubleshooting snippets that average 180 tokens each, with no snippet exceeding 400 tokens. The team wants to minimize serving cost and query latency while keeping retrieval accuracy on these short passages. Which embedding model choice best fits this optimization strategy?
Correct answer: B — Use databricks-bge-large-en with its 512-token window, which holds the longest snippet in full and keeps per-request compute lower than a long-context model.
- A. The 8,192-token window protects against growth that the scenario does not describe. No snippet exceeds 400 tokens, so the long-context model adds embedding compute and latency without improving retrieval on these short passages.
- B. The 512-token window is larger than the 400-token maximum snippet, so each passage is embedded in full. A model built for shorter inputs costs less and responds faster per request than a long-context model, which matches the cost and latency goals.
- C. A 32,000-token custom model is far larger than the 400-token maximum snippet needs. Hosting and querying it raises serving cost and latency, which the team wants to minimize, and the extra context capacity does nothing for passages this short.
- D. Snippets averaging 180 tokens already fit the 512-token window, so splitting them into 64-token chunks gains nothing. It multiplies the number of embedding calls, stored vectors and search candidates, raising cost and latency, and it cuts each FAQ entry into fragments that carry less context.
Sources1
Sources
(5)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/quality-data-pipeline-ragOfficial docs
“If you pass chunks that exceed this limit, they will be truncated, potentially losing important information.”
↩︎ What the token limit does to long inputs“The retrieval query will be transformed at query time using the same embedding model used to embed chunks in the data pipeline.”
↩︎ Sizing the window for documents and queries“Larger embedding models generally perform better but require more computational resources.”
↩︎ Choosing a context length to match the goal“you will need to balance performance and efficiency”
↩︎ Choosing a context length to match the goal“If you pass chunks that exceed this limit, they will be truncated, potentially losing important information.”
↩︎ Key concept“The retrieval query will be transformed at query time using the same embedding model used to embed chunks in the data pipeline.”
↩︎ Exam trap 2“Know the maximum token limit for your chosen embedding model.”
↩︎ Exam trap 4“For example, bge-large-en-v1.5 has a maximum token limit of 512.”
↩︎ Checkpoint“If you pass chunks that exceed this limit, they will be truncated, potentially losing important information.”
↩︎ Checkpoint - 2.https://docs.databricks.com/aws/en/machine-learning/foundation-model-apis/supported-modelsOfficial docs
“map any text to a 1024-dimension embedding vector and an embedding window of 8192 tokens”
↩︎ What the token limit does to long inputs“map any text to a 1024-dimension embedding vector and an embedding window of 512 tokens”
↩︎ What the token limit does to long inputs“This endpoint serves the English version of the model and generates normalized embeddings.”
↩︎ Context length is not vector size or normalization“does not generate normalized embeddings”
↩︎ Context length is not vector size or normalization“map any text to a 1024-dimension embedding vector and an embedding window of 512 tokens”
↩︎ Exam trap 1“map any text to a 1024-dimension embedding vector and an embedding window of 8192 tokens”
↩︎ Checkpoint - 3.https://docs.databricks.com/aws/en/ai-search/vector-search-foundation-embedding-model-gte-exampleOfficial docs
“Databricks recommends that you split the data into smaller context chunks so that you can feed a wider variety of examples”
↩︎ Why the maximum context length is a ceiling, not a target - 4.https://docs.databricks.com/aws/en/ai-search/vector-search-external-embedding-model-exampleOfficial docs
“The OpenAI model supports up to 8192 tokens.”
↩︎ Why the maximum context length is a ceiling, not a target - 5.
“Recent work from DeepMind (LIMIT) shows embeddings can fail to capture basic information in long contexts, making this a nuanced decision.”
↩︎ Why the maximum context length is a ceiling, not a target“Larger chunks: More context preserved, but harder to pinpoint relevant information.”
↩︎ Why the maximum context length is a ceiling, not a target“Recent work from DeepMind (LIMIT) shows embeddings can fail to capture basic information in long contexts, making this a nuanced decision.”
↩︎ Exam trap 3