Introduction
Building Retrieval-Augmented Generation (RAG) applications today is often a bespoke and brittle process. Unlike traditional software development, which relies on stable libraries like libc or numpy, LLM development lacks a standardized pattern for reusable components. Prompts that work for one model frequently fail on another, and the industry lacks standard APIs for the critical sub-tasks that make RAG effective.
To address this, IBM researchers have introduced a library of "LLM Intrinsics"—standardized, modular capabilities designed to bring software engineering rigor to the RAG pipeline. By implementing common tasks as specialized Low-Rank Adaptation (LoRA) adapters with stable APIs, this framework improves performance, reliability, and interoperability across different systems.
The LLM Intrinsics Framework
The paper defines an LLM Intrinsic as a capability invoked through a stable API, independent of its specific implementation. This abstraction allows developers to treat LLM functions like compiler intrinsics: common functions with stable interfaces that remain consistent even if the underlying model or code changes.
The library currently consists of eight specialized intrinsics categorized by their role in the RAG lifecycle:
- Pre-Retrieval: Query Rewrite (QR) and Query Expansion (QE).
- Pre-Generation: Context Relevance (CR), Answerability Determination (AD), and Passage Reranking (PRR).
- Post-Generation: Uncertainty Quantification (UQ), Hallucination Detection (HD), and Citation Generation (CG).
Technically, six of these are implemented as LoRA adapters fine-tuned on the IBM Granite 3.3 8b model. These are served via Granite IO Processing, a software layer built on vLLM that ensures structured JSON input/output and manages the communication between the model and the application logic.
Experimental Setup and Datasets
The library was trained and evaluated using a comprehensive suite of benchmarks to ensure robustness across diverse tasks:
- Retrieval & Multi-turn: MT-RAG and BEIR.
- Answerability: SQUAD and SQUADRun.
- Hallucination: RAGTruth.
- Citations: ALCE and LongBench-Cite.
- Uncertainty: MMLU.
The training data comprised a mix of technical documentation, government corpora, and synthetic data generated via Mixtral to provide a broad knowledge base for the adapters.
Key Insights: Composition and Specialization
A major finding of the research is that modular improvements compound. While individual intrinsics like Query Rewrite (QR) improve retrieval, and Answerability Determination (AD) prevents hallucinations, using them in tandem creates a significantly more robust system. This synergy is measured by the Joint Answerability-Faithfulness Score (JAFS), which rewards models for correctly answering when information is available and remaining silent when it is not.
Furthermore, the study demonstrates that specialization beats scale. Small, specialized 8B parameter LoRA adapters frequently outperformed much larger general-purpose models, such as Llama-3 70B, on specific tasks like citation generation and hallucination detection. By standardizing the interface (e.g., using specific roles like <|start_of_role|>rewrite), developers can swap underlying models without rewriting application logic.
Performance Results
The quantitative gains across the library are substantial, particularly in complex retrieval scenarios:
- Query Rewrite: On the non-standalone subset of the MT-RAG benchmark, the QR intrinsic provided a massive 22 percentage point jump in Recall compared to using the raw user query, effectively bridging the gap between ambiguous user input and the information needed for retrieval.
- Hallucination Detection: The HD intrinsic achieved an F1 score of 68.6 on the RAGTruth benchmark, significantly outperforming prompted GPT-4, which scored 45.6.
- Citation Generation: On the LongBench-Cite benchmark, the Granite-3.3-8B LoRA achieved an average F1 of 68.6, nearly 26 points higher than Llama-3.1-70B (42.0) when prompted for the same task.
- Composite Performance: Chaining QR and AD improved the JAFS score from a baseline of 49 to 66, proving that "knowing what you don't know" is a critical capability for reliable RAG systems.
Limitations and Future Work
While the concept of LLM intrinsics is general, the current library is primarily optimized for the IBM Granite family. The researchers acknowledge that the Uncertainty Quantification (UQ) intrinsic is currently "self-evaluating," meaning it is most effective at predicting the certainty of its own base model rather than third-party models. Future work will focus on extending these intrinsics to other model families, improving reranking efficiency, and developing more complex composite flows to further automate the RAG pipeline.
Summary updated