Databricks-GenAI-Assoc Data Preparation Practice Question
A GenAI engineer is preparing a corpus of HTML product pages stored in a Unity Catalog volume for a RAG application. The pages contain navigation bars, script tags, and boilerplate footers that add noise to embeddings. Which Databricks-native approach best removes this noise while preserving the main article text before chunking?
⚠ Common exam trap
The trap here is assuming that a simple regex tag-stripping step or a larger chunk size is equivalent to semantic HTML cleaning.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use an ai_parse_document or BeautifulSoup-style parser in a PySpark UDF to extract the main content, then write the cleaned text as a Delta table with a content column.
Cleaning HTML before chunking requires a parser that understands document structure, not a regex or a numeric feature transformer. Extracting the main content with a document-aware parser and persisting the cleaned text to Delta produces a reliable, lineage-tracked input for chunking and embedding, which is the goal of data preparation for RAG on Databricks.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Register the volume as a Delta table and run a SQL query using regexp_replace to strip all tags, then tokenize the result with the built-in Databricks tokenizer.
Why it's wrong here
A blanket regexp_replace removes every angle-bracketed substring, including script and style contents that can survive as raw text, and it cannot distinguish navigation from article prose. Registering a volume as a Delta table also adds no parsing capability; the tokenizer then operates on dirty text. This approach neither isolates the main content nor reliably removes boilerplate.
- ✗
Increase the chunk size to 4096 tokens so that boilerplate is a smaller proportion of each chunk, and rely on the embedding model to ignore the noise.
Why it's wrong here
Larger chunks dilute but do not remove boilerplate, and they also reduce retrieval precision because a single vector must represent both navigation and article content. Embedding models do not automatically ignore script or footer text. This is a tuning workaround, not a data preparation fix, and it degrades the quality of the vector index.
- ✗
Load the HTML files with spark.read.text and apply a VectorAssembler to convert the raw strings into dense vectors, then cluster and drop outliers.
Why it's wrong here
VectorAssembler expects numeric feature columns, not raw HTML strings, so it will fail or produce meaningless output. Clustering dense vectors does not remove navigation or script text; it merely groups pages by similarity. This pipeline never cleans the source content, so the resulting embeddings would still encode boilerplate noise.
- ✓
Use an ai_parse_document or BeautifulSoup-style parser in a PySpark UDF to extract the main content, then write the cleaned text as a Delta table with a content column.
Why this is correct
Parsing HTML with a document-aware parser lets you target the main article region and discard navigation, script, and footer nodes before text is written. Storing the cleaned content in Delta makes downstream chunking and embedding reproducible. This is the Databricks-native pattern for turning raw HTML in a volume into analysis-ready text.
About these practice questions
This Databricks-GenAI-Assoc question is part of Courseiva's 330-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Databricks exam blueprint
This Databricks-GenAI-Assoc practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-GenAI-Assoc exam.