1. Your team implements a Vertex AI Pipeline that trains a recommendation model. The model training component takes as input a parameter `num_epochs` set to 50. After several production runs, you discover that due to changes in data distribution, 50 epochs often leads to overfitting. You want to modify the pipeline to automatically reduce `num_epochs` if the validation loss does not improve after 10 epochs (early stopping). Which approach best implements this without modifying the pipeline definition repeatedly?
- A. Implement early stopping logic inside the training component code itself, configurable via a component parameter.✓ Correct
- B. Create a separate pipeline that runs the training component with different epoch values and selects the best result.
- C. Manually monitor training runs and change the num_epochs parameter before each run.
- D. Use a Cloud Composer DAG to wrap the Vertex AI Pipeline and implement dynamic parameter adjustment between runs.
Explanation
The correct answer is to implement early stopping logic within the training component code, configurable via parameters (e.g., `early_stop_patience=10`). This keeps the logic where it belongs—in the training logic—and is parameterizable. The pipeline definition does not change; only component code evolves. Option B (separate pipeline with grid search) is overkill and expensive. Option C (manual intervention) defeats automation. Option D (Cloud Composer wrapper) adds unnecessary orchestration layer when the logic should be in the component. Component-level early stopping is standard ML practice and integrates naturally with Kubeflow Pipelines.