Prepare multimodal data
Extract text passages from PDFs and crop or annotate screenshot regions; store source identifiers so retrieved results can be traced back to their file and page.
Build multimodal RAG. Validate retrieved context.
Multimodal retrieval-augmented generation (RAG) finds context from different input modalities (text, images, documents) and uses that grounded context to support generation. Important practical issues include consistent embedding spaces across modalities, indexing and recall at K, latency for real-time queries, and checking that retrieved context actually supports the final answer.
Learning concept · Not a validated service
Multimodal retrieval-augmented generation (RAG) finds context from different input modalities (text, images, documents) and uses that grounded context to support generation. Important practical issues include consistent embedding spaces across modalities, indexing and recall at K, latency for real-time queries, and checking that retrieved context actually supports the final answer.
A proposed application: answer questions about PDF reports and screenshots by retrieving relevant document passages and image regions, then prompting a language model with those grounded snippets. For healthcare, finance or security uses, a human reviewer must remain in charge and the system should not be used for unreviewed clinical, financial or security decisions.
Extract text passages from PDFs and crop or annotate screenshot regions; store source identifiers so retrieved results can be traced back to their file and page.
Embed text and image regions with a shared or aligned model (for example CLIP or cross-modal encoders) and normalise vectors before indexing.
Build a vector index (FAISS, Annoy) and measure recall at K and grounding: whether retrieved passages actually contain the answer.
Concatenate top retrieved contexts into a prompt for a generative model and evaluate with retrieval-aware metrics plus human usefulness checks.
The supplied starter generates synthetic text and image embeddings with a NumPy random generator, concatenates them into combined multimodal vectors, creates a noisy query from the first item, computes cosine similarity to every combined vector, and prints the top-3 match indices and their scores.
text_embeddings = rng.normal(size=(5, 8))
image_embeddings = rng.normal(size=(5, 8))
combined_embeddings = np.hstack([text_embeddings, image_embeddings])
query_text_embedding = text_embeddings[0] + rng.normal(0, 0.05, 8)
query_image_embedding = image_embeddings[0] + rng.normal(0, 0.05, 8)
query = np.hstack([query_text_embedding, query_image_embedding]).reshape(1, -1)The code uses randomly generated NumPy arrays as embeddings and does not load PDFs, screenshots, real CLIP/encoder models, a vector index, or any generative model. It demonstrates nearest-neighbour similarity on synthetic vectors but does not implement retrieval augmentation, document chunking, modality-specific preprocessing, or grounding checks.
A proposed extension: replace the synthetic embeddings with CLIP or dedicated OCR+text encoders on real PDFs and screenshots, index passages with FAISS, and prompt a language model with the top-k retrieved passages to answer user questions.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its AI Engineer Course, with placement support and hands-on labs.