Semantic Group Inference: Narrowing the search space
Once the intent is known, the vector space is narrowed down thematically. That's handled by the SemanticGroupInferer.
The six groups
Each section in the Kompendium carries its group as a prefix during embedding:
"SG: Wirkung_und_Entwicklung\n\n<text content>".
This is the crucial point: the vectors in the index are embedded with SG context.
For retrieval to work, the query itself also has to be embedded with the same context — otherwise you're comparing structurally different representations.
Scoring: words, phrases, intent bias
Phrases like "what's the benefit" count 2.5× as much as single words. A why-question automatically gets a strong bias toward Wirkung_und_Entwicklung (Impact and Development) — even if the question doesn't contain a single keyword from that group.
Symmetric embedding
The top 2 groups by score form the context string that gets prepended to the question:
This enriched string gets embedded — not the raw question. The result is a query vector that sits in the same subspace as the sections that were embedded with the same prefix when the index was built.
Intent and SG working together
Intent controls how the search happens. Semantic Group controls where it happens.
The question catalog as a test track
Each of the ~40 shortcut rules has a story: a question that was misclassified, a retrieval that then searched in the wrong direction, and a test run that made the error visible. The question catalog — generated directly from the Kompendium, one question per section — was the most important tool here. The WARN lines in the test runs didn't just improve the classifier, they also exposed gaps in the Kompendium itself: sections that sat thematically isolated or contained too little context.
Conclusion
Intent classification for German knowledge questions isn't a capability problem — a local llama3 is big enough to fundamentally understand the task. It's a precision problem that arises from the ambiguity of German question phrasing. The shortcut-layer rules encode this contextual knowledge deterministically. The LLM handles the rest. Semantic Group Inference complements this approach at the content level: it ensures that the query vector lands in the same thematic subspace as the sections that could contain an answer.