Skip to content
Quantoros

Why is calling setparams inside each shared-model prediction request unsafe even when XGBoost prediction is thread-safe?

Classic MLLevel: IntermediateXGBoost · Prediction

Why is calling set_params inside each shared-model prediction request unsafe even when XGBoost prediction is thread-safe?

Hints
  • Read-only safety is narrower than arbitrary concurrent use.
  • Configuration writes race with readers.

Answer

Prediction-only safety does not cover concurrent mutation of the shared model. Configure an immutable serving instance before requests, and swap fully prepared instances rather than modifying parameters during inference.

Source and licence: XGBoost · Prediction · Apache-2.0 · answer: Quantoros editorial

Related questions