This prompt is designed for search engineers and RAG developers who need to improve retrieval recall when users query in one language but relevant documents exist in another, and the source language uses compound nouns extensively. Germanic languages (German, Dutch, Swedish, Danish, Norwegian), agglutinative languages (Finnish, Turkish, Hungarian), and technical domains in any language frequently concatenate multiple concepts into single tokens. A German user searching for 'Kinderbetreuungseinrichtung' (childcare facility) will miss English documents that mention 'childcare facility' or 'daycare center' unless the compound is decomposed into its constituent parts and translated into multi-word phrases in the target retrieval language. Direct translation alone often fails because the compound noun does not exist as a single token in the target language's index, and naive translation may produce a single unnatural word that retrieves nothing.
Prompt
Cross-Lingual Compound Noun Decomposition Prompt

When to Use This Prompt
Defines the job, reader, and constraints for cross-lingual compound noun decomposition in retrieval pipelines.
Use this prompt when your retrieval pipeline includes a Germanic or agglutinative source language and a target index language that prefers multi-word phrases. The prompt expects a source compound noun, the source language, and the target retrieval language as inputs. It returns a structured decomposition showing the individual morphemes, their meanings, and one or more equivalent multi-word phrases in the target language suitable for keyword, BM25, or dense retrieval queries. Do not use this prompt for languages that do not form compound nouns (e.g., Romance languages like Spanish or French), for single-word non-compound queries, or when the compound noun already has a direct dictionary translation in the target language's index. The prompt is a pre-retrieval expansion step, not a replacement for query translation or synonym expansion.
Before deploying this prompt in production, validate that your retrieval index actually contains the multi-word phrases the decomposition produces. A common failure mode is generating correct decompositions that still return zero results because the target corpus uses different terminology. Pair this prompt with a query relaxation fallback that broadens terms if the initial decomposition yields no matches. For high-stakes applications such as legal or medical retrieval, always log the decomposition output alongside the original query for auditability, and consider human review of the decomposition mapping for domain-specific compound terms that may have non-compositional meanings. The next section provides the copy-ready prompt template you can adapt for your language pair and retrieval backend.
Use Case Fit
Where the Cross-Lingual Compound Noun Decomposition Prompt works, where it fails, and what inputs it assumes.
Good Fit: Germanic & Agglutinative Languages
Use when: the source query is in a language like German, Dutch, Swedish, Finnish, Turkish, or Korean where compound nouns are common. Why: direct translation of a compound like 'Haustürschlüssel' to 'house door key' is a decomposition step that dramatically improves retrieval recall against an English index.
Bad Fit: Isolating or Analytic Languages
Avoid when: the source language is English, Chinese, or Vietnamese, where multi-word phrases are already separate tokens. Risk: the prompt will hallucinate non-existent compounds or over-segment legitimate phrases, introducing noise and reducing precision.
Required Input: Language Pair & Domain Context
Guardrail: the prompt must receive the source language, target retrieval language, and an optional domain (e.g., 'legal', 'medical'). Why: decomposition rules differ by language pair, and domain context prevents splitting a technical compound like 'Datenschutzerklärung' into semantically incorrect fragments.
Operational Risk: Over-Decomposition into Noise
What to watch: the model may split a compound into too many atomic parts, generating a long, low-precision keyword list. Guardrail: set a maximum decomposition depth (e.g., 3 segments) and always rank the original compound as the primary query variant to anchor the retrieval.
Integration Point: Pre-Retrieval Rewrite Stage
Use when: this prompt sits in a query rewriting pipeline before the retrieval engine. Guardrail: the output must be a structured list of query strings, not free text. Validate that the output is a JSON array before passing it to the search backend to avoid runtime errors.
Failure Mode: Semantic Drift in Decomposition
What to watch: a literal decomposition can lose the original meaning (e.g., German 'Kindergarten' is not 'child garden'). Guardrail: always include the original compound as a query variant and use a back-translation check on the decomposed phrase to flag semantic drift before retrieval.
Copy-Ready Prompt Template
A reusable prompt for decomposing compound nouns in a source language and generating equivalent multi-word retrieval phrases in a target language.
This template is designed to be copied directly into your prompt management system or codebase. It accepts a compound noun in a source language (such as German, Dutch, or Finnish) and decomposes it into its constituent semantic parts. It then generates equivalent multi-word phrases in the target retrieval language that capture the same meaning, improving match rates against keyword and vector indexes that would otherwise miss the compound form. The prompt includes placeholders for the input term, source and target language codes, domain context, and output format constraints.
textYou are a linguistic retrieval specialist. Your task is to decompose a compound noun from a source language into its semantic components and generate equivalent multi-word retrieval phrases in a target language. INPUT: - Source compound noun: [COMPOUND_NOUN] - Source language (ISO 639-1): [SOURCE_LANG] - Target retrieval language (ISO 639-1): [TARGET_LANG] - Domain context (optional): [DOMAIN_CONTEXT] INSTRUCTIONS: 1. Decompose the source compound noun into its constituent semantic parts. Identify the head noun and any modifiers. 2. For each part, provide a brief gloss in English to confirm your decomposition. 3. Generate 3-5 equivalent multi-word phrases in the target language that capture the full meaning of the original compound. Prioritize phrases that are natural in the target language and likely to appear in indexed documents. 4. If the compound has multiple plausible interpretations, generate phrases for each interpretation and flag them. 5. If [DOMAIN_CONTEXT] is provided, bias your target phrases toward terminology used in that domain. OUTPUT_SCHEMA: { "source_compound": "string", "source_language": "string", "target_language": "string", "decomposition": [ { "part": "string", "gloss_en": "string", "role": "head|modifier" } ], "interpretations": [ { "interpretation_label": "string", "target_phrases": ["string"], "is_primary": true|false } ], "confidence": "high|medium|low", "notes": "string or null" } CONSTRAINTS: - Do not produce a literal word-for-word translation. Generate phrases that a native speaker would use in a search query or document. - If the compound is already a common term with a standard translation, include that standard form as the primary phrase. - Set confidence to "low" if the decomposition is ambiguous or the domain is unknown. Flag the ambiguity in notes. - Return ONLY valid JSON. No markdown, no commentary outside the JSON object.
To adapt this template, replace the square-bracket placeholders with your application's runtime values. The [DOMAIN_CONTEXT] field is optional but strongly recommended for specialized corpora—a medical compound like Herzkranzgefäßverengung requires different target phrases in a cardiology index than in a general-health index. For production use, validate the output JSON against the schema before sending phrases to your retrieval backend. If the confidence field returns low, route the output for human review or fall back to a direct translation query. When integrating with a RAG pipeline, pass each generated phrase as a separate query variant to your hybrid or multi-query retrieval step to maximize recall.
Prompt Variables
Inputs the prompt needs to work reliably. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to check the input at runtime before incurring inference cost.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[SOURCE_QUERY] | The user's original query containing compound nouns to decompose | Donaudampfschifffahrtsgesellschaftskapitän | Non-empty string. Must contain at least one candidate compound noun. Reject if length < 3 characters or > 2000 characters. |
[SOURCE_LANGUAGE] | ISO 639-1 code for the language of [SOURCE_QUERY] | de | Must be a valid ISO 639-1 code. Must be a Germanic or agglutinative language (de, nl, sv, da, no, fi, hu, tr, et). Reject unsupported language families with a clear error. |
[TARGET_RETRIEVAL_LANGUAGE] | ISO 639-1 code for the language in which decomposed multi-word phrases should be generated | en | Must be a valid ISO 639-1 code. Must differ from [SOURCE_LANGUAGE] for cross-lingual mode. Null allowed only for monolingual decomposition. |
[DOMAIN_CONTEXT] | Optional domain label to constrain decomposition vocabulary and term selection | legal, maritime, medical, mechanical_engineering | Must match a predefined domain enum if provided. Null allowed. When provided, decomposition should prefer domain-specific terminology over general-language splits. |
[MAX_DECOMPOSITIONS] | Maximum number of alternative decompositions to return per compound noun | 3 | Integer between 1 and 10. Defaults to 3 if null. Higher values increase token cost and may produce lower-confidence variants. |
[INCLUDE_MORPHEME_GLOSS] | Boolean flag controlling whether the output includes a morpheme-by-morpheme gloss with source-language meaning | Must be true or false. When true, output schema expands to include a gloss array. When false, only the final multi-word phrases are returned. | |
[CONFIDENCE_THRESHOLD] | Minimum confidence score for a decomposition to be included in the output | 0.7 | Float between 0.0 and 1.0. Decompositions below this threshold are dropped. Set to 0.0 to return all candidates. Recommended default: 0.6 for recall, 0.8 for precision. |
Implementation Harness Notes
How to wire the compound noun decomposition prompt into a multilingual retrieval pipeline with validation, retry, and logging.
This prompt operates as a pre-retrieval transformation step in a multilingual RAG pipeline. It receives a user query in a source language (typically German, Dutch, Finnish, or another compound-heavy language) and produces a structured decomposition that includes the original compound, its constituent parts, and a target-language multi-word phrase for retrieval. The prompt should be called before any vector or keyword search against the target-language index. Its output is not shown to the user; it is consumed by the retrieval layer to generate expanded query variants.
Wire the prompt into your query processing chain immediately after language detection and before retrieval dispatch. The input [COMPOUND_NOUN] should be extracted from the user's query using a lightweight parser or a prior LLM call that identifies compound candidates. The [TARGET_LANGUAGE] parameter must match the language of your retrieval index. On the output side, validate the JSON structure strictly: confirm that decomposed_parts is a non-empty array of strings, that target_phrase is a non-empty string, and that confidence is a float between 0.0 and 1.0. If validation fails, retry once with the same input and a stronger constraint instruction appended to the prompt. If the retry also fails, log the failure, skip decomposition for that compound, and fall back to a direct translation of the original compound using a simpler translation prompt. Log every decomposition attempt with the input compound, output structure, validation result, and retrieval backend used, so you can trace recall gaps back to decomposition failures.
For model choice, a mid-tier model like GPT-4o-mini or Claude Haiku is sufficient for this task; the linguistic knowledge required is well-covered by these models and latency matters in a retrieval pipeline. Set temperature to 0.0 or near-zero to maximize deterministic output. If your system handles multiple compound nouns per query, batch them into a single prompt call with an array input to reduce round trips, but keep the batch size under 10 to avoid output truncation. Do not use this prompt for languages that do not form closed compounds (like English or Romance languages); the model may hallucinate decompositions where none exist. Add a pre-check that the source language is in a configured allowlist of compound-forming languages before invoking this prompt.
Expected Output Contract
Each field in the decomposed output must pass these validation rules before the decomposed terms are used for retrieval. Use this contract to build a post-processing validator or retry condition.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
decomposition_id | string (UUID v4) | Must be a valid UUID v4 string. Reject if missing or malformed. | |
source_compound | string | Must exactly match one compound noun from the [INPUT_QUERY] text. Reject if empty or not a substring of the input. | |
source_language | string (ISO 639-1) | Must be a valid two-letter language code. Reject if not in the allowed set from [SUPPORTED_LANGUAGES]. | |
target_language | string (ISO 639-1) | Must be a valid two-letter language code and must differ from source_language. Reject if identical or not in [SUPPORTED_LANGUAGES]. | |
decomposed_terms | array of strings | Array must contain at least 2 non-empty strings. Each term must be in the target_language. Reject if empty array or single term. | |
confidence_score | number (0.0 to 1.0) | Must be a float between 0.0 and 1.0 inclusive. If below [CONFIDENCE_THRESHOLD], flag for human review or retry. | |
literal_translation | string | If present, must be a non-empty string in the target_language. Null allowed when decomposition is idiomatic rather than literal. | |
retrieval_phrases | array of strings | Array must contain at least 1 non-empty string in the target_language. Each phrase should be a valid search query fragment. Reject if empty. |
Common Failure Modes
Compound noun decomposition across languages introduces specific, predictable failures. These cards cover the most common breakages and the operational checks that prevent them from reaching production.
Over-Decomposition of Frozen Compounds
What to watch: The model splits a compound that functions as a single lexical unit in the target domain (e.g., 'Handschuh' → 'hand shoe' instead of 'glove'). This produces retrieval queries with nonsensical multi-word phrases that match nothing. Guardrail: Maintain a domain-specific stop-list of frozen compounds. Validate decomposition output against this list before query generation. Flag any decomposition that produces a phrase not present in the target corpus vocabulary.
Semantic Drift in Decomposed Components
What to watch: Each component of the compound is translated literally, but the combined meaning in the target language diverges from the source intent. For example, 'Kindergarten' decomposed and translated as 'child garden' loses the institutional meaning. Guardrail: After decomposition and translation, run a back-translation of the generated multi-word phrase into the source language. Compare the back-translation to the original compound using a semantic similarity threshold. Reject or flag outputs below 0.85 cosine similarity.
Ambiguous Segmentation Boundaries
What to watch: A compound noun has multiple valid segmentations, and the model selects the wrong one for the retrieval context. 'Staubecken' can be 'Stau-becken' (retention basin) or 'Staub-ecken' (dust corners). The wrong split produces retrieval queries for an entirely different concept. Guardrail: Prompt the model to generate all plausible segmentations with confidence scores. Use a domain glossary or entity linker to disambiguate based on the user's query context. When confidence is low, generate retrieval queries for the top two segmentations and merge results.
Loss of Morphological Markers
What to watch: German and agglutinative languages use morphemes (e.g., 'Fugen-s') that indicate relationships between components. When the model strips these during decomposition, the grammatical relationship is lost, and the target-language phrase becomes a bag of unrelated words. Guardrail: Include explicit instructions in the prompt to preserve and translate relational morphemes as prepositions or case markers in the target language. Validate output structure by checking that the generated phrase contains explicit relational tokens (e.g., 'of', 'for', 'with') when the source compound contained a Fugenmorphem.
Target Language Word Order Violation
What to watch: The model decomposes a compound and translates the components, but keeps the source-language head-modifier order. In German compounds, the head is on the right ('Haustür' = house door), but in Romance languages, the head comes first ('porta di casa'). A literal left-to-right translation produces an unnatural or unsearchable phrase. Guardrail: Add a syntactic reordering step in the prompt that identifies the head component and enforces target-language head-modifier ordering rules. Validate output by checking the phrase against a target-language n-gram frequency list; penalize outputs with zero corpus matches.
Compounding the Decomposition Output
What to watch: The model correctly decomposes a source compound but then re-compounds the translated components into a new single word in the target language, which may not exist or may have a different meaning. This defeats the purpose of multi-word retrieval expansion. Guardrail: Explicitly constrain the output format to require space-separated multi-word phrases. Add a post-processing check that rejects any output where the generated phrase is a single token. If the target language normally compounds, require the output to include both the compound and the decomposed phrase as separate query variants.
Evaluation Rubric
Use this rubric to evaluate the quality of decomposed compound nouns before integrating the prompt into a production retrieval pipeline. Each criterion targets a specific failure mode common in cross-lingual decomposition.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Decomposition Accuracy | All valid constituent morphemes are identified and separated correctly for the source language compound. | Missing a valid constituent, inserting a spurious one, or splitting a word at a non-morpheme boundary. | Compare output against a golden set of 50 expert-decomposed compounds. Require exact match on constituent set. |
Target Language Phrase Quality | Generated multi-word phrase in [TARGET_LANGUAGE] is grammatically correct and idiomatic. | Phrase is a literal, word-for-word gloss that is ungrammatical or unnatural to a native speaker. | Have a native speaker rate a sample of 30 outputs on a 1-5 fluency scale. Fail if average score < 4. |
Semantic Preservation | The meaning of the decomposed phrase in [TARGET_LANGUAGE] is equivalent to the original [SOURCE_LANGUAGE] compound. | The generated phrase introduces, omits, or shifts a core semantic component (e.g., 'river boat' vs 'boat for the river'). | Back-translate the target phrase to the source language using a separate MT model. Fail if cosine similarity between original and back-translated embeddings < 0.95. |
Retrieval Recall Improvement | Using the decomposed phrase as a query against a [TARGET_LANGUAGE] index increases recall@10 by a statistically significant margin over a naive translation baseline. | Recall@10 is equal to or lower than the baseline, or the improvement is not statistically significant (p > 0.05). | Run an offline A/B test on a fixed set of 100 queries against a representative document index. Measure recall@10 for both conditions. |
Output Schema Compliance | The output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed. | JSON is malformed, a required field like | Validate output with a JSON schema validator in a unit test. Fail on any validation error. |
Confidence Score Calibration | The | High confidence (>0.9) is assigned to an incorrect decomposition, or low confidence (<0.5) is assigned to a correct one. | Plot a calibration curve using 100 labeled examples. Fail if Expected Calibration Error (ECE) > 0.1. |
Low-Resource Language Handling | For a [SOURCE_LANGUAGE] with limited training data, the prompt either decomposes correctly or outputs a | The prompt hallucinates a confident but incorrect decomposition for a low-resource language. | Test with 20 compounds from a held-out low-resource language. Fail if any output has confidence > 0.7 and is incorrect. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single target language and a small set of test compounds. Remove strict output schema requirements and focus on getting correct decompositions. Accept plain text output instead of structured JSON.
codeDecompose the compound noun [COMPOUND_NOUN] from [SOURCE_LANGUAGE] into its constituent parts. For each part, provide the equivalent term in [TARGET_LANGUAGE].
Watch for
- Over-decomposition of non-compound words
- Missing morphological boundaries in agglutinative languages
- Literal translations that lose domain meaning
- No confidence signal on ambiguous splits

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us