Glossary/AI, LLMs & Data Integration

Retrieval-Augmented Generation (RAG)

Retrieval-Augmented Generation is a technique where an LLM retrieves relevant external information (documents, database records, schemas) before generating responses, grounding outputs in actual data rather than learned patterns.

Large language models are trained on fixed data and can only recall patterns learned during training. They cannot access real-time or proprietary information without retraining. RAG solves this by augmenting the generation process: before generating a response, the system retrieves relevant information from external sources (databases, document stores, knowledge bases), includes that information in the prompt context, and generates responses grounded in actual data.

In data analytics contexts, RAG is fundamental. When a Data Copilot translates a natural language question to SQL, it uses RAG to retrieve the database schema (tables, columns, relationships, data types). When an LLM generates explanations of query results, it uses RAG to include the actual data points. This retrieval step dramatically improves accuracy compared to the model generating SQL or explanations from learned patterns alone.

RAG introduces new challenges around retrieval quality. If the retrieval system returns irrelevant information, the model's output will be degraded. For data analytics, this means schema descriptions must be accurate and complete. Vector embeddings of schema information must be semantically meaningful so relevant tables and columns are retrieved. RAG is the foundation of modern semantic grounding in analytics systems.

Key Characteristics

  • Retrieves external information before generating responses to ground outputs in real data
  • Uses vector embeddings or traditional retrieval to identify relevant context from large information spaces
  • Includes retrieved information in the LLM prompt context to guide generation
  • Dramatically improves accuracy for domain-specific and real-time information over pure generation
  • Can combine multiple retrieval sources (schemas, sample data, documentation) in a single prompt
  • Enables LLMs to work with information not present in their training data

Why It Matters

  • Grounds AI-assisted analytics in real data, dramatically reducing hallucination and incorrect outputs
  • Enables AI systems to work with proprietary or rapidly-changing schemas without retraining
  • Improves accuracy of Text-to-SQL by providing complete schema context
  • Scales AI analytics to organizations with extensive and complex schemas
  • Enables real-time analytics where AI must reason about current data states
  • Provides a mechanism to inject domain knowledge and business rules into AI systems

Example

A Data Copilot receives the question: "What's our revenue trend?" It uses RAG to retrieve the database schema and recent sample data, then generates SQL using that context: SELECT DATE_TRUNC('month', order_date) as month, SUM(order_total) FROM orders WHERE order_date > NOW() - INTERVAL '12 months' GROUP BY month. The actual schema and data grounded the query, improving accuracy over pure generation.

Coginiti Perspective

Coginiti provides excellent RAG foundations for AI analytics: SMDL semantic definitions (dimensions, measures, relationships with descriptions) can be indexed and retrieved to ground AI systems in business logic, while documentation and metadata provide rich context for LLM prompts. The semantic layer enables RAG systems to retrieve business-meaningful information rather than raw schemas, dramatically improving AI accuracy. Testing via #+test blocks ensures retrieved data quality, enabling confidence in AI systems grounded on Coginiti's verified data. Query tags and lineage information further enhance RAG by providing AI systems with data provenance and governance context.

See Semantic Intelligence in Action

Coginiti operationalizes business meaning across your entire data estate.