home
diamond Go Premium
Data Engineering Path  ·  Data & AI

Module 4 Theoretical & Architecture Interview Quiz

10 technical interview questions for Senior AI Engineers and LLM Application Architects.


Q1: What is LangChain Expression Language (LCEL), and what problem does it solve over legacy chains?

👉 Reveal Answer & Architectural Deep Dive **Answer**: Legacy LangChain relied on deep class inheritance hierarchies (`LLMChain`, `TransformChain`, `SequentialChain`) where intermediate data structures were obscured, custom logic required subclassing, and adding streaming was difficult. **LCEL** replaces this with a functional, declarative pipeline protocol built on the Unix pipe operator (`|`). Every component implements the **Runnable Protocol**, which guarantees: 1. Universal asynchronous (`ainvoke`) and synchronous (`invoke`) execution. 2. Built-in streaming (`stream`) of partial token responses. 3. Parallel batching (`batch`) with automatic thread pool management. 4. Seamless integration with LangSmith distributed tracing.

Q2: How does RunnableParallel differ from RunnablePassthrough in LCEL?

👉 Reveal Answer & Architectural Deep Dive **Answer**: - **`RunnablePassthrough`**: Takes input data and passes it through unchanged, or adds a new computed key while preserving the original input. It is commonly used in RAG chains to keep the user's raw question available alongside retrieved document context. - **`RunnableParallel`**: Executes a dictionary of multiple independent Runnables concurrently on separate threads and returns a single merged dictionary once all branches complete. Commonly used to search multiple vector stores or external APIs in parallel.

Q3: What is the architectural difference between a Document and a Node in LlamaIndex?

👉 Reveal Answer & Architectural Deep Dive **Answer**: - **Document**: Represents an entire ingested container of data (e.g., a complete PDF file, database row, or Confluence page) with file-level metadata. - **Node**: The atomic unit of data in LlamaIndex (a chunk of a Document). Crucially, Nodes are **relational graph objects**: each Node retains explicit metadata pointers to its parent Document (`ref_doc_id`), its preceding paragraph (`prev_node_id`), and its succeeding paragraph (`next_node_id`). This enables advanced retrieval patterns like **Sentence Window Retrieval** and **Auto-Merging Retrieval**.

Q4: When should an enterprise data team choose LlamaIndex over LangChain?

👉 Reveal Answer & Architectural Deep Dive **Answer**: Choose **LlamaIndex** when the primary complexity of the application is **data ingestion, document parsing, and retrieval accuracy**: 1. Deep document hierarchies (financial prospectuses, contracts, research papers). 2. Advanced multi-stage RAG techniques (sub-question decomposition, auto-merging tree indexes). 3. Rich enterprise data connector requirements (300+ readers on LlamaHub). Choose **LangChain / LangGraph** when the primary complexity is **complex agent orchestration, multi-turn state machines, and autonomous tool calling**.

Q5: How do you stream LLM completions to a web browser using FastAPI and LangChain?

👉 Reveal Answer & Architectural Deep Dive **Answer**: 1. Use an asynchronous LCEL chain: `chain.astream(input_data)`. 2. Wrap the async generator in a FastAPI `StreamingResponse`. 3. Set the response media type to Server-Sent Events (`media_type="text/event-stream"`). 4. The client browser connects using the standard JavaScript `EventSource` API, rendering tokens dynamically as they arrive without waiting for the full response to complete.

Q6: What is a Router Query Engine in LlamaIndex?

👉 Reveal Answer & Architectural Deep Dive **Answer**: A **Router Query Engine** uses an LLM selector to dynamically route incoming user questions to the most appropriate specialized query engine or index: - If the question asks for a broad summary (*"Give me an executive summary of our 2026 data strategy"*), it routes to a **SummaryIndex**. - If the question asks for specific technical facts (*"What is the maximum allowed batch size in our Kafka topic?"*), it routes to a **VectorStoreIndex**.

Q7: What is the function of an Output Parser in LangChain?

👉 Reveal Answer & Architectural Deep Dive **Answer**: Output Parsers take the raw string or `AIMessage` emitted by an LLM and convert it into a strictly typed, downstream-usable format: - `StrOutputParser`: Extracts raw string content from the message. - `JsonOutputParser`: Parses JSON strings into Python dictionaries. - `PydanticOutputParser`: Validates and serializes LLM completions into strongly typed Pydantic models with automated schema instructions.

Q8: What is LangSmith, and why is it essential for production LLM observability?

👉 Reveal Answer & Architectural Deep Dive **Answer**: **LangSmith** is a dedicated monitoring, debugging, and evaluation platform for LLM applications. In production: 1. **Traceability**: Visualizes the exact execution tree (which prompt was rendered, what was retrieved, which model was called). 2. **Cost & Latency Tracking**: Tracks exact token usage, API expenses, and latency across every step. 3. **Dataset Evaluation**: Enables regression testing against golden test datasets before deploying prompt changes to production.

Q9: How does the "Auto-Merging Retriever" work in LlamaIndex?

👉 Reveal Answer & Architectural Deep Dive **Answer**: During ingestion, LlamaIndex builds a hierarchy of nodes: small leaf nodes (e.g., 200 tokens) linked to parent nodes (e.g., 800 tokens), which in turn link to larger parent nodes (e.g., 3,000 tokens). During retrieval, search runs against the small leaf nodes for high precision. If a threshold of leaf nodes (e.g., 60%) belonging to the same parent are retrieved, LlamaIndex **automatically merges them and returns the complete parent node** instead, giving the LLM full, coherent context.

Q10: How do you build a hybrid LangChain + LlamaIndex system?

👉 Reveal Answer & Architectural Deep Dive **Answer**: 1. Ingest, parse, and index enterprise documentation using LlamaIndex: `index = VectorStoreIndex.from_documents(docs)`. 2. Wrap the LlamaIndex query engine into a standard LangChain `Tool`: ```python from llama_index.core.langchain_helpers.agents import IndexToolConfig, LlamaIndexTool tool = LlamaIndexTool.from_query_engine(query_engine, name="DocumentationSearch", description="...") ``` 3. Pass that tool to a LangChain / LangGraph agent alongside database executors and API tools.
Find this content helpful? ☕ Buy me a coffee

Entity Details

Create New Item

help

Submit Technical Query

Have a question or run into an issue? Describe it below, upload an optional screenshot, and our engineering team will answer it!

image Attach image (optional)

Submit Feedback

build Free Developer Utility Free Tool
gavel

Privacy & Legal Disclaimer

1. Client-Side Browser Processing

All utility tools on DeepEngineerHub (including Image to PDF, Text Formatters, JSON Converters, and Encryptors) execute 100% locally within your client browser using WebAssembly and JavaScript. No uploaded images, text, or documents are transmitted, collected, or stored on remote servers.

2. Limitation of Liability ("As-Is" Provision)

Tools and services are provided free of charge for convenience and educational purposes "as-is" without warranties of any kind. DeepEngineerHub shall not be held liable for any data loss, formatting inconsistencies, or indirect damages resulting from tool usage.

3. Open Source & Third-Party Software

Certain utilities utilize open-source client libraries (such as jsPDF, Mermaid.js, Pyodide) licensed under MIT, Apache, or BSD open licenses. All intellectual property remains with their respective copyright holders.