LW IT Solutions logo LW IT Solutions logo LW IT Solutions
« Blog Overview /Cloud & AI / AI Search in German and Polish: How...
Read this article in other languages:

AI Search in German and Polish: How to Find Relevant Text Passages

AI Search in German and Polish: How to Find Relevant Text Passages

Summary

An AI assistant answering questions about documents first needs the passage containing the answer. Embeddings turn text into number patterns so a search can find related meanings rather than only identical words. This is useful for German and Polish collections, including questions asked in a different language from the source. The article explains why finding the right document is not enough: the relevant clause and its conditions must be retrieved. Model choice and text organisation both affect the result.

Contents
  1. Summary
  2. Include language in the test
  3. Three models with different limits
  4. The passage must contain the answer
  5. Count the right kind of hit
  6. The comparison must fit the model
  7. Questions and answers
  8. Sources

An AI search first needs to find the passage that answers a question. A language model can then use that passage to write an answer. This approach is called RAG. If the search supplies the wrong section, the language model lacks the necessary evidence, even when the answer appears elsewhere in the same document.

Embedding models support this search. An embedding model turns a question or passage into a list of numbers called a vector. The search compares these lists and puts suitable passages near the top. Similar meanings should produce similar number patterns. Tests are needed to establish whether this works for German and Polish texts. Search can also compare words directly or combine both approaches.

Include language in the test

German and Polish change word forms through inflection. For example, German “Haus”, “Häuser” and “Häusern” can refer to the same concept; Polish includes “ustawa”, “ustawy” and “ustawom”. Useful search should find relevant content despite such differences. This does not imply a fixed quality loss for every English-oriented model. Training data, subject matter, text length and the actual questions also affect results.

A multilingual model is therefore a useful candidate to test, not a guarantee of success. Three tasks need separate checks: German questions with German answer passages, Polish questions with Polish passages, and, for example, Polish questions with German passages. A good result on the first task does not establish performance on the other two.

A notice-period question needs the relevant clause, not a postal address from the same contract.
A notice-period question needs the relevant clause, not a postal address from the same contract. # · WebP

Three models with different limits

The table reports model-card specifications checked on 25 October 2026. The token count limits the input. Tokens are the text pieces processed by a model; one word may contain several tokens. Therefore, 512 tokens do not mean 512 words.

Three models with different limits
Model Input limit Numbers per vector
all-MiniLM-L6-v2 256 word pieces by default 384
multilingual-e5-large 512 tokens 1024
bge-m3 Up to 8192 tokens 1024 for the dense vector

all-MiniLM-L6-v2 focuses on English. The other two models support many languages. A fair test must follow the required input formats: for retrieval, E5 expects query: before a question and passage: before a text, including German and Polish inputs. BGE-M3 does not need this query instruction. BGE-M3 also offers other search methods; the table describes only its single dense vector, a fixed list of numbers per text.

The passage must contain the answer

Long documents are usually split into smaller sections called chunks. For example, a section of 300 tokens does not fit MiniLM’s default input limit. Truncating the remaining text can remove the answer itself. Prefixes and special tokens also need to fit the input. The actual model configuration determines the limit.

Shorter is not always better. A single sentence may give a number without the relevant unit or condition. A very long passage may mix several topics. Useful experiments therefore compare different passage lengths, headings and overlaps. Overlap means repeating part of the text in the next passage. This can preserve context but creates additional vectors and similar results.

Count the right kind of hit

Each test question needs a marked answer passage before testing starts. For example, a question asks about a notice period. A retrieved section containing the postal address from the same contract does not count as an answer hit. Finding the right document can be a useful separate measure, but it must not be confused with finding the answer passage.

Top-5 means the five highest-ranked results. It does not mean a fixed distance in the number space. When each question has exactly one relevant passage, the test can count how often that passage appears among the first five results. When several passages are relevant, the rule must state whether one hit is enough or all pieces of evidence are needed. Different rules produce different measures.

Every model receives the same questions and document version. The record includes model version, input format, passage length, search method and hit count. Response time and memory matter alongside retrieval quality. Public tests such as MTEB or PL-MTEB help select candidates. A high overall score does not establish good results on a particular German or Polish document collection.

The comparison must fit the model

Search needs a rule for comparing lists of numbers. Cosine similarity compares direction and ignores length. A dot product also considers length. This can change the order: for a question represented by (1, 0), the vector (2, 2) has the larger dot product, while (1, 0) has the higher cosine similarity.

Normalization here means scaling a vector to length one without changing its direction. If an index uses dot products to reproduce cosine search, document and question vectors are normalized first. An index is the data structure that makes these comparisons fast. If a model specifies a different comparison method, normalization is not a universal requirement. A zero vector cannot be scaled to length one.

Whether a library already normalizes depends on the model and the actual call. The stored vectors and index setting therefore need checking. Lists from different models must not be mixed in the same comparison, even when both contain 1024 numbers: corresponding positions do not automatically have the same meaning.

Metaphor: Two crane jibs point in exactly the same direction, one long and one short. Likewise, cosine similarity compares only the direction of two lists of numbers, while the dot product also counts their length.
Metaphor: Two crane jibs point in exactly the same direction, one long and one short. Likewise, cosine similarity compares only the direction of two lists of numbers, while the dot product also counts their length. #

Questions and answers

How much memory does a million passages require?

At 4 bytes per number, a million vectors with 384 numbers require exactly 1.536 GB; with 1024 numbers, 4.096 GB, using decimal units. Search structures, text, metadata and model weights add to this. More passages increase storage; overlaps and document boundaries affect the number of passages.

Which model is best for German and Polish?

Language support or a single ranking cannot settle that question. The deciding test is whether the model reliably finds the needed passages for the intended questions within the available resources.

What does an increase from 80 to 81 hits on 100 questions mean?

One additional hit is one percentage point. That alone does not establish a stable advantage. More questions and inspection of the actual errors help determine whether the improvement extends beyond this small sample.

Lukas Wojcik

Lukas Wojcik

Systems architect and technology enthusiast specializing in scalable tracking solutions, GMP Stack (GA4 & GTM), and robust backend architectures. Advocate for clean code and privacy-first design.

Get in touch

A question or an idea for a web project? Tell me a little about it. This form uses reCAPTCHA and formconfirmed to protect against spam.

Write a comment

Experience with other models or providers and questions about the implementation are welcome here.

The email address is not published. Required fields are marked with an asterisk.

LUKASWOJCIK.COM · NEWSLETTER

Fresh ideas in your inbox

New articles, practical tools and updates from the projects.

Choose topics (optional)
No selection: all topics.

Subscription starts after confirmation by email. · Privacy

Privacy · Newsletter

Email address, language, selected topics and subscription/confirmation dates are stored to deliver the newsletter. Double opt-in is required. Every issue includes an immediate unsubscribe link. Formconfirmed checks the signup for spam. No email open or click tracking.

Read the full privacy policy ↗