nerdexam
Databricks

GENERATIVE-AI-ENGINEER-ASSOCIATE · Question #22

What is an effective method to preprocess prompts using custom code before sending them to an LLM?

The correct answer is D. Write a MLflow PyFunc model that has a separate function to process the prompts. MLflow PyFunc (option D) provides a flexible model wrapper that allows engineers to define a custom predict method containing arbitrary Python code - including prompt preprocessing logic - before the call is forwarded to an LLM. This is a standard production pattern for…

Generative AI MLOps

Question

What is an effective method to preprocess prompts using custom code before sending them to an LLM?

Options

  • ADirectly modify the LLM's internal architecture to include preprocessing steps
  • BIt is better not to introduce custom code to preprocess prompts as the LLM has not been trained
  • CRather than preprocessing prompts, it's more effective to postprocess the LLM outputs to align
  • DWrite a MLflow PyFunc model that has a separate function to process the prompts

How the community answered

(24 responses)
  • A
    4% (1)
  • B
    8% (2)
  • C
    4% (1)
  • D
    83% (20)

Explanation

MLflow PyFunc (option D) provides a flexible model wrapper that allows engineers to define a custom predict method containing arbitrary Python code - including prompt preprocessing logic - before the call is forwarded to an LLM. This is a standard production pattern for encapsulating preprocessing, validation, and transformation steps in a deployable, versioned artifact. Option A (modifying LLM internal architecture) is neither feasible nor appropriate for this use case. Option B is incorrect - custom preprocessing is a valid and common practice. Option C (postprocessing instead of preprocessing) addresses a different concern and doesn't solve upstream prompt preparation needs.

Topics

#Prompt Engineering#MLOps#MLflow#LLM Application Development

Community Discussion

No community discussion yet for this question.

Full GENERATIVE-AI-ENGINEER-ASSOCIATE Practice