Share via

ML.NET model accuracy drops after deployment to production

KIRAN P 0 Reputation points
2026-05-08T05:22:25.76+00:00

I built a classification model with ML.NET in a .NET 8 application. The model performed well during local testing with about 92% accuracy, but after deploying it to production, the predictions became unreliable and the overall accuracy dropped noticeably.
Is PredictionEngine safe for concurrent ASP.NET requests? or I need to use PredictionEnginePool instead?

Developer technologies | .NET | .NET Machine Learning
Developer technologies | .NET | .NET Machine Learning

.NET: Microsoft Technologies based on the .NET software framework. Machine learning: A type of artificial intelligence focused on enabling computers to use observed data to evolve new behaviors that have not been explicitly programmed.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Varsha Dundigalla(INFOSYS LIMITED) 4,945 Reputation points Microsoft External Staff
    2026-05-08T09:40:09.0566667+00:00

    Thank you for reaching out.

    PredictionEngine is not designed to handle multiple requests at the same time. It is meant for simple or single‑prediction scenarios, and it is not thread-safe.

    In a production ASP.NET app, many requests can happen in parallel, and if predictions are made at the same time using this type, it can lead to inconsistent or unreliable outputs. That can look like the model accuracy has dropped, even though the model itself hasn’t changed.

    To avoid this, the recommended approach in web applications is to use PredictionEnginePool, which is built to handle concurrent requests safely by managing multiple instances internally.

    At the same time, it is also important to make sure the data being passed in production is the same format and processed the same way as during training, because differences there can also affect prediction results.

    Please let us know if you require any further assistance, we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer". So that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    Was this answer helpful?


  2. Q&A Assist
    2026-05-08T05:22:43.02+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    PredictionEngine is not safe for concurrent ASP.NET requests.

    PredictionEngine is explicitly documented as:

    • A convenience API for single predictions.
    • Not thread-safe.
    • Acceptable only in single-threaded or prototype environments.

    In a production ASP.NET Core application handling concurrent requests, using a shared PredictionEngine instance can cause race conditions and corrupt internal state, which can manifest as unstable or degraded prediction accuracy after deployment.

    For production and concurrent scenarios, use PredictionEnginePool instead. PredictionEnginePool:

    • Creates an ObjectPool of PredictionEngine instances.
    • Provides improved performance and thread safety.
    • Can automatically reload models when the underlying file changes (when configured with watchForChanges: true).

    In an ASP.NET Core app, register it in Program.cs like this:

    builder.Services.AddPredictionEnginePool<ModelInput, ModelOutput>()
        .FromFile(modelName: "SentimentAnalysisModel", filePath: "sentiment_model.zip", watchForChanges: true);
    

    Then inject and use the pool in controllers/services instead of a single PredictionEngine instance.

    Using PredictionEnginePool is the recommended approach for production, concurrent ASP.NET workloads and can help prevent the kind of reliability issues observed after deployment.


    References:

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.