A Generative AI Engineer is developing a patient-facing healthcare-focused chatbot. If the patient's question is not a medical emergency, the chatbot should solicit more information from the patient to pass to the doctor' s office and suggest a few relevant pre-approved medical articles for reading. If the patient's question is urgent, direct the patient to calling their local emergency services. Given the following user input: "I have been experiencing severe headaches and dizziness for the past two days." Which response is most appropriate for the chatbot to generate?
-
A
Here are a few relevant articles for your browsing. Let me know if you have questions after reading them.
-
B
Please call your local emergency services.
-
C
Headaches can be tough. Hope you feel better soon!
-
D
Please provide your age, recent activities, and any other symptoms you have noticed along with your headaches and dizziness.
Reveal answer details
Close answer details
Correct answerB
ExplanationProblem Context: The task is to design responses for a healthcare-focused chatbot that appropriately addresses the urgency of a patient's symptoms. Explanation of Options: Option A: Suggesting articles might be suitable for less urgent inquiries but is inappropriate for symptoms that could indicate a serious condition. Option B: Given the description of severe symptoms like headaches and dizziness, directing the patient to emergency services is prudent. This aligns with medical guidelines that recommend immediate professional attention for such severe symptoms. Option C: Offering well-wishes does not address the potential seriousness of the symptoms and lacks appropriate action. Option D: While gathering more information is part of a detailed assessment, the immediate need here suggests a more urgent response. Given the potential severity of the described symptoms, Option B is the most appropriate, ensuring the chatbot directs patients to seek urgent care when needed, potentially saving lives.
A Generative Al Engineer is deciding between using LSH (Locality Sensitive Hashing) and HNSW (Hierarchical Navigable Small World) for indexing their vector database Their top priority is semantic accuracy. Which approach should the Generative Al Engineer use to evaluate these two techniques?
-
A
Compare the cosine similarities of the embeddings of returned results against those of a representative sample of test inputs
-
B
Compare the Bilingual Evaluation Understudy (BLEU) scores of returned results for a representative sample of test inputs
-
C
Compare the Recall-Onented-Understudy for Gistmg Evaluation (ROUGE) scores of returned results for a representative sample of test inputs
-
D
Compare the Levenshtein distances of returned results against a representative sample of test inputs
Reveal answer details
Close answer details
A Generative AI Engineer has created a RAG application which can help employees retrieve answers from an internal knowledge base, such as Confluence pages or Google Drive. The prototype application is now working with some positive feedback from internal company testers. Now the Generative Al Engineer wants to formally evaluate the system's performance and understand where to focus their efforts to further improve the system. How should the Generative AI Engineer evaluate the system?
-
A
Use cosine similarity score to comprehensively evaluate the quality of the final generated answers.
-
B
Curate a dataset that can test the retrieval and generation components of the system separately. Use MLflow's built in evaluation metrics to perform the evaluation on the retrieval and generation components.
-
C
Benchmark multiple LLMs with the same data and pick the best LLM for the job.
-
D
Use an LLM-as-a-judge to evaluate the quality of the final answers generated.
Reveal answer details
Close answer details
Correct answerB
ExplanationProblem Context: After receiving positive feedback for the RAG application prototype, the next step is to formally evaluate the system to pinpoint areas for improvement. Explanation of Options: Option A: While cosine similarity scores are useful, they primarily measure similarity rather than the overall performance of an RAG system. Option B: This option provides a systematic approach to evaluation by testing both retrieval and generation components separately. This allows for targeted improvements and a clear understanding of each component's performance, using MLflow's metrics for a structured and standardized assessment. Option C: Benchmarking multiple LLMs does not focus on evaluating the existing system's components but rather on comparing different models. Option D: Using an LLM as a judge is subjective and less reliable for systematic performance evaluation. Option is the most comprehensive and structured approach, facilitating precise evaluations and B improvements on specific components of the RAG system.
A Generative Al Engineer is using an LLM to classify species of edible mushrooms based on text descriptions of certain features. The model is returning accurate responses in testing and the Generative Al Engineer is confident they have the correct list of possible labels, but the output frequently contains additional reasoning in the answer when the Generative Al Engineer only wants to return the label with no additional text. Which action should they take to elicit the desired behavior from this LLM?
-
A
Use few snot prompting to instruct the model on expected output format
-
B
Use zero shot prompting to instruct the model on expected output format
-
C
Use zero shot chain-of-thought prompting to prevent a verbose output format
-
D
Use a system prompt to instruct the model to be succinct in its answer
Reveal answer details
Close answer details
What is an effective method to preprocess prompts using custom code before sending them to an LLM?
-
A
Directly modify the LLM's internal architecture to include preprocessing steps
-
B
It is better not to introduce custom code to preprocess prompts as the LLM has not been trained with examples of the preprocessed prompts
-
C
Rather than preprocessing prompts, it's more effective to postprocess the LLM outputs to align the outputs to desired outcomes
-
D
Write a MLflow PyFunc model that has a separate function to process the prompts
Reveal answer details
Close answer details
Correct answerD
ExplanationThe most effective way to preprocess prompts using custom code is to write a custom model, such as an MLflow PyFunc model . Here's a breakdown of why this is the correct approach: MLflow PyFunc Models:MLflow is a widely used platform for managing the machine learning lifecycle, including experimentation, reproducibility, and deployment. A PyFunc model is a generic Python function model that can implement custom logic, which includes preprocessing prompts. Preprocessing Prompts:Preprocessing could include various tasks like cleaning up the user input, formatting it according to specific rules, or augmenting it with additional context before passing it to the LLM. Writing this preprocessing as part of a PyFunc model allows the custom code to be managed, tested, and deployed easily. Modular and Reusable:By separating the preprocessing logic into a PyFunc model, the system becomes modular, making it easier to maintain and update without needing to modify the core LLM or retrain it. Why Other Options Are Less Suitable: A (Modify LLM's Internal Architecture): Directly modifying the LLM's architecture is highly impractical and can disrupt the model's performance. LLMs are typically treated as black-box models for tasks like prompt processing. B (Avoid Custom Code): While it's true that LLMs haven't been explicitly trained with preprocessed prompts, preprocessing can still improve clarity and alignment with desired input formats without confusing the model. C (Postprocessing Outputs): While postprocessing the output can be useful, it doesn't address the need for clean and well-formatted inputs, which directly affect the quality of the model's responses. Thus, using an MLflow PyFunc model allows for flexible and controlled preprocessing of prompts in a scalable way, making it the most effective method.
Question 6
Multiple choice
Which TWO chain components are required for building a basic LLM-enabled chat application that includes conversational capabilities, knowledge retrieval, and contextual memory?
-
A
-
B
Conversation Buffer Memory
-
C
-
D
-
E
Reveal answer details
Close answer details
A Generative AI Engineer is testing a simple prompt template in LangChain using the code below, but is getting an error.  Assuming the API key was properly defined, what change does the Generative AI Engineer need to make to fix their chain? 
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerD
Explanationfrom langchain.chains import LLMChain from langchain_community.llms import OpenAI from langchain_core.prompts import PromptTemplate prompt_template = "Tell me a {adjective} joke" prompt = PromptTemplate( input_variables=["adjective"], template=prompt_template ) llm = LLMChain(llm=OpenAI(), prompt=prompt)
A Generative AI Engineer has been asked to design an LLM-based application that accomplishes the following business objective: answer employee HR questions using HR PDF documentation. Which set of high level tasks should the Generative AI Engineer's system perform?
-
A
Calculate averaged embeddings for each HR document, compare embeddings to user query to find the best document. Pass the best document with the user query into an LLM with a large context window to generate a response to the employee.
-
B
Use an LLM to summarize HR documentation. Provide summaries of documentation and user query into an LLM with a large context window to generate a response to the user.
-
C
Create an interaction matrix of historical employee questions and HR documentation. Use ALS to factorize the matrix and create embeddings. Calculate the embeddings of new queries and use them to find the best HR documentation. Use an LLM to generate a response to the employee question based upon the documentation retrieved.
-
D
Split HR documentation into chunks and embed into a vector store. Use the employee question to retrieve best matched chunks of documentation, and use the LLM to generate a response to the employee based upon the documentation retrieved.
Reveal answer details
Close answer details
Correct answerD
ExplanationTo design an LLM-based application that can answer employee HR questions using HR PDF documentation, the most effective approach is option D. Here's why: Chunking and Vector Store Embedding:HR documentation tends to be lengthy, so splitting it into smaller, manageable chunks helps optimize retrieval. These chunks are then embedded into avector store (a database that stores vector representations of text). Each chunk of text is transformed into an embedding using a transformer-based model, which allows for efficient similarity-based retrieval. Using Vector Search for Retrieval:When an employee asks a question, the system converts their query into an embedding as well. This embedding is then compared with the embeddings of the document chunks in the vector store. The most semantically similar chunks are retrieved, which ensures that the answer is based on the most relevant parts of the documentation. LLM to Generate a Response:Once the relevant chunks are retrieved, these chunks are passed into the LLM, which uses them as context to generate a coherent and accurate response to the employee's question. Why Other Options Are Less Suitable: A (Calculate Averaged Embeddings): Averaging embeddings might dilute important information. It doesn't provide enough granularity to focus on specific sections of documents. B (Summarize HR Documentation): Summarization loses the detail necessary for HR-related queries, which are often specific. It would likely miss the mark for more detailed inquiries. C (Interaction Matrix and ALS): This approach is better suited for recommendation systems and not for HR queries, as it's focused on collaborative filtering rather than text-based retrieval. Thus, option D is the most effective solution for providing precise and contextual answers based on HR documentation.
A Generative AI Engineer is building an LLM to generate article summaries in the form of a type of poem, such as a haiku, given the article content. However, the initial output from the LLM does not match the desired tone or style. Which approach will NOT improve the LLM's response to achieve the desired response?
-
A
Provide the LLM with a prompt that explicitly instructs it to generate text in the desired tone and style
-
B
Use a neutralizer to normalize the tone and style of the underlying documents
-
C
Include few-shot examples in the prompt to the LLM
-
D
Fine-tune the LLM on a dataset of desired tone and style
Reveal answer details
Close answer details
Correct answerB
ExplanationThe task at hand is to improve the LLM's ability to generate poem-like article summaries with the desired tone and style. Using a neutralizer to normalize the tone and style of the underlying documents (option B) will not help improve the LLM's ability to generate the desired poetic style. Here's why: Neutralizing Underlying Documents:A neutralizer aims to reduce or standardize the tone of input data. However, this contradicts the goal, which is to generate text with a specific tone and style (like haikus). Neutralizing the source documents will strip away the richness of the content, making it harder for the LLM to generate creative, stylistic outputs like poems. Why Other Options Improve Results: A (Explicit Instructions in the Prompt): Directly instructing the LLM to generate text in a specific tone and style helps align the output with the desired format (e.g., haikus). This is a common and effective technique in prompt engineering. C (Few-shot Examples): Providing examples of the desired output format helps the LLM understand the expected tone and structure, making it easier to generate similar outputs. D (Fine-tuning the LLM): Fine-tuning the model on a dataset that contains examples of the desired tone and style is a powerful way to improve the model's ability to generate outputs that match the target format. Therefore, using a neutralizer (option B) is not an effective method for achieving the goal of generating stylized poetic summaries.
Question 10
Single choice
What is the most suitable library for building a multi-step LLM-based workflow?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerD
ExplanationProblem Context: The Generative AI Engineer needs a tool to build amulti-step LLM-based workflow . This type of workflow often involves chaining multiple steps together, such as query generation, retrieval of information, response generation, and post-processing, with LLMs integrated at several points. Explanation of Options: Option A: Pandas: Pandas is a powerful data manipulation library for structured data analysis, but it is not designed for managing or orchestrating multi-step workflows, especially those involving LLMs. Option B: TensorFlow: TensorFlow is primarily used for training and deploying machine learning models, especially deep learning models. It is not designed for orchestrating multi-step tasks in LLM-based workflows. Option C: PySpark: PySpark is a distributed computing framework used for large-scale data processing. While useful for handling big data, it is not specialized for chaining LLM-based operations. Option D: LangChain: LangChain is a purpose-built framework designed specifically for orchestrating multi-step workflows with large language models (LLMs). It enables developers to easily chain different tasks, such as retrieving documents, summarizing information, and generating responses, all in a structured flow. This makes it the best tool for building complex LLM-based workflows. Thus, LangChain is the most suitable library for creating multi-step LLM-based workflows.
|