|
| 1 | +# Feast for Generative AI |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Feast provides robust support for Generative AI applications, enabling teams to build, deploy, and manage feature infrastructure for Large Language Models (LLMs) and other Generative AI (GenAI) applications. With Feast's vector database integrations and feature management capabilities, teams can implement production-ready Retrieval Augmented Generation (RAG) systems and other GenAI applications with the same reliability and operational excellence as traditional ML systems. |
| 6 | + |
| 7 | +## Key Capabilities for GenAI |
| 8 | + |
| 9 | +### Vector Database Support |
| 10 | + |
| 11 | +Feast integrates with popular vector databases to store and retrieve embedding vectors efficiently: |
| 12 | + |
| 13 | +* **Milvus**: Full support for vector similarity search with the `retrieve_online_documents_v2` method |
| 14 | +* **SQLite**: Local vector storage and retrieval for development and testing |
| 15 | +* **Elasticsearch**: Scalable vector search capabilities |
| 16 | +* **Postgres with PGVector**: SQL-based vector operations |
| 17 | +* **Qdrant**: Purpose-built vector database integration |
| 18 | + |
| 19 | +These integrations allow you to: |
| 20 | +- Store embeddings as features |
| 21 | +- Perform vector similarity search to find relevant context |
| 22 | +- Retrieve both vector embeddings and traditional features in a single API call |
| 23 | + |
| 24 | +### Retrieval Augmented Generation (RAG) |
| 25 | + |
| 26 | +Feast simplifies building RAG applications by providing: |
| 27 | + |
| 28 | +1. **Embedding storage**: Store and version embeddings alongside your other features |
| 29 | +2. **Vector similarity search**: Find the most relevant data/documents for a given query |
| 30 | +3. **Feature retrieval**: Combine embeddings with structured features for richer context |
| 31 | +4. **Versioning and governance**: Track changes to your document repository over time |
| 32 | + |
| 33 | +The typical RAG workflow with Feast involves: |
| 34 | + |
| 35 | +``` |
| 36 | +┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ |
| 37 | +│ Document │ │ Document │ │ Feast │ │ LLM │ |
| 38 | +│ Processing │────▶│ Embedding │────▶│ Feature │────▶│ Context │ |
| 39 | +│ │ │ │ │ Store │ │ Generation │ |
| 40 | +└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ |
| 41 | +``` |
| 42 | + |
| 43 | +### Transforming Unstructured Data to Structured Data |
| 44 | + |
| 45 | +Feast provides powerful capabilities for transforming unstructured data (like PDFs, text documents, and images) into structured embeddings that can be used for RAG applications: |
| 46 | + |
| 47 | +* **Document Processing Pipelines**: Integrate with document processing tools like Docling to extract text from PDFs and other document formats |
| 48 | +* **Chunking and Embedding Generation**: Process documents into smaller chunks and generate embeddings using models like Sentence Transformers |
| 49 | +* **On-Demand Transformations**: Use `@on_demand_feature_view` decorator to transform raw documents into embeddings in real-time |
| 50 | +* **Batch Processing with Spark**: Scale document processing for large datasets using Spark integration |
| 51 | + |
| 52 | +The transformation workflow typically involves: |
| 53 | + |
| 54 | +1. **Raw Data Ingestion**: Load documents or other data from various sources (file systems, databases, etc.) |
| 55 | +2. **Text Extraction**: Extract text content from unstructured documents |
| 56 | +3. **Chunking**: Split documents into smaller, semantically meaningful chunks |
| 57 | +4. **Embedding Generation**: Convert text chunks into vector embeddings |
| 58 | +5. **Storage**: Store embeddings and metadata in Feast's feature store |
| 59 | + |
| 60 | +### Feature Transformation for LLMs |
| 61 | + |
| 62 | +Feast supports transformations that can be used to: |
| 63 | + |
| 64 | +* Process raw text into embeddings |
| 65 | +* Chunk documents for more effective retrieval |
| 66 | +* Normalize and preprocess features before serving to LLMs |
| 67 | +* Apply custom transformations to adapt features for specific LLM requirements |
| 68 | + |
| 69 | +## Use Cases |
| 70 | + |
| 71 | +### Document Question-Answering |
| 72 | + |
| 73 | +Build document Q&A systems by: |
| 74 | +1. Storing document chunks and their embeddings in Feast |
| 75 | +2. Converting user questions to embeddings |
| 76 | +3. Retrieving relevant document chunks |
| 77 | +4. Providing these chunks as context to an LLM |
| 78 | + |
| 79 | +### Knowledge Base Augmentation |
| 80 | + |
| 81 | +Enhance your LLM's knowledge by: |
| 82 | +1. Storing company-specific information as embeddings |
| 83 | +2. Retrieving relevant information based on user queries |
| 84 | +3. Injecting this information into the LLM's context |
| 85 | + |
| 86 | +### Semantic Search |
| 87 | + |
| 88 | +Implement semantic search by: |
| 89 | +1. Storing document embeddings in Feast |
| 90 | +2. Converting search queries to embeddings |
| 91 | +3. Finding semantically similar documents using vector search |
| 92 | + |
| 93 | +### Scaling with Spark Integration |
| 94 | + |
| 95 | +Feast integrates with Apache Spark to enable large-scale processing of unstructured data for GenAI applications: |
| 96 | + |
| 97 | +* **Spark Data Source**: Load data from Spark tables, files, or SQL queries for feature generation |
| 98 | +* **Spark Offline Store**: Process large document collections and generate embeddings at scale |
| 99 | +* **Spark Batch Materialization**: Efficiently materialize features from offline to online stores |
| 100 | +* **Distributed Processing**: Handle gigabytes of documents and millions of embeddings |
| 101 | + |
| 102 | +This integration enables: |
| 103 | +- Processing large document collections in parallel |
| 104 | +- Generating embeddings for millions of text chunks |
| 105 | +- Efficiently materializing features to vector databases |
| 106 | +- Scaling RAG applications to enterprise-level document repositories |
| 107 | + |
| 108 | +## Learn More |
| 109 | + |
| 110 | +For more detailed information and examples: |
| 111 | + |
| 112 | +* [Vector Database Reference](../reference/alpha-vector-database.md) |
| 113 | +* [RAG Tutorial with Docling](../tutorials/rag-with-docling.md) |
| 114 | +* [Milvus Quickstart Example](https://github.com/feast-dev/feast/tree/master/examples/rag/milvus-quickstart.ipynb) |
| 115 | +* [Spark Data Source](../reference/data-sources/spark.md) |
| 116 | +* [Spark Offline Store](../reference/offline-stores/spark.md) |
| 117 | +* [Spark Batch Materialization](../reference/batch-materialization/spark.md) |
0 commit comments