Introduction To Generative AI On Databricks
What is generative AI, and why do enterprises use Databricks for it?
- Generative AI (GenAI) uses models to produce text, code, summaries and other content from prompts; businesses use it to improve productivity, automate tasks and create new products.
- Foundation models provide general capabilities but may not know an organisation’s private data, policies or current facts. They can also hallucinate plausible but incorrect answers.
- Mosaic AI provides Databricks capabilities for building, evaluating, governing and serving GenAI applications using enterprise data.
- The Data Intelligence Platform combines lakehouse data management with AI capabilities; Unity Catalog supplies centralised discovery, access control, lineage and governance.
- The difficult part is often moving from a working proof of concept to a reliable production system: evaluate answer quality, protect sensitive data, control costs, manage versions and monitor behaviour.
How do you prepare the course environment and sample data?
- Open the course setup notebook and run its cells in order on serverless compute before attempting later exercises.
- Set the serverless Environment version to 4 as required by this course; the required version can change with course revisions.
- Install the course dependencies, then restart Python when prompted:
%pip install databricks-vectorsearch databricks-langchain langchain databricks-agents
# Restart Python if the notebook prompts you to do so.- The setup creates the Unity Catalog namespace
dbacademy.get_started_genai:dbacademyis the catalog andget_started_genaiis its schema. - It also creates
dbacademy.get_started_genai.e_commerce_product_listings_dataset, a 200-row sample product dataset. - Check Catalog Explorer → dbacademy → get_started_genai to confirm the schema and tables exist. Use the setup notebook’s exact commands and generated names rather than guessing missing configuration values.
- You need permissions to create catalog/schema objects and provision the course’s Vector Search and Model Serving resources.
How does Vector Search support retrieval-augmented generation (RAG)?
- RAG (retrieval-augmented generation) retrieves relevant information from your data and supplies it as context to an LLM before it generates an answer. This can improve factual grounding without retraining the model.
- The course creates a
product_textDelta table, enables Change Data Feed (CDF), and builds a Vector Search index calledproduct_embeddings. - Embeddings represent text as numeric vectors; similar vectors tend to represent semantically related content. The setup uses the
databricks-gte-large-enembedding model. - A Vector Search endpoint serves similarity searches; a delta-sync index keeps indexed content aligned with its Delta source using the configured sync process.
- CDF records changes to the source Delta table, allowing supported index synchronisation workflows to process updates.
- A typical RAG request follows: question → embed/search relevant product text → add retrieved context to prompt → model generates answer.
- Retrieval reduces, but does not eliminate, hallucinations. Inspect source passages and evaluate whether answers actually follow the retrieved evidence.
How do you provision and verify the Vector Search and RAG endpoints?
- Run the setup notebook’s Databricks SDK cells to create the Vector Search endpoint, delta-sync index, and Mosaic AI Model Serving endpoint hosting the sample RAG application.
- Expect the Vector Search index to take approximately 20 minutes to become ready; provisioning time varies. You can study conceptual lessons while it builds, but dependent exercises require readiness.
- Verify the index and its status under Compute → Vector Search (or the corresponding workspace UI), and verify the RAG endpoint under Serving.
- The source table, Vector Search endpoint/index, and serving endpoint are different resources: creating one does not mean the others are ready.
- A serving endpoint exposes the RAG application for requests; the application retrieves documents from Vector Search and uses a model to compose an answer.
- Databricks Free Edition limits the number of Vector Search and Model Serving resources. If creation fails, inspect existing endpoints and quotas before rerunning setup; avoid accidentally provisioning duplicates.
What GenAI application approaches can Databricks support?
- Prompt engineering: improve instructions, examples and context without changing model weights; usually the simplest starting point.
- RAG: add up-to-date or private knowledge at request time through retrieval; useful for product catalogs, documents and knowledge bases.
- Fine-tuning: train an existing model further on task-specific examples when prompting or retrieval alone cannot achieve the required behaviour; needs curated data and evaluation.
- Pre-training: train a foundation model on a very large corpus; usually much more expensive and complex than the alternatives.
- Choose the least complex approach that meets quality, privacy, latency and cost requirements. RAG and fine-tuning address different needs and can be combined.
How do you make an enterprise GenAI application production-ready?
- Quality: build representative test questions, check groundedness and accuracy, and review hallucinations and harmful or inappropriate outputs.
- Security and governance: apply Unity Catalog permissions, restrict sensitive information, manage credentials and review data exposure in prompts, logs and model responses.
- Reliability: monitor latency, failures, endpoint availability and retrieval quality; plan for retries and infrastructure limits.
- Cost and scale: track model inference, embedding, indexing and serving costs; test realistic request volumes before launch.
- Lifecycle: version prompts, data, indexes and model configurations; evaluate changes before deployment and monitor continuously afterward.
- The central principle: general model intelligence is not a substitute for accurate enterprise context, governance and evaluation.