[null,null,["最終更新日 2025-07-27 UTC。"],[[["\u003cp\u003eInference involves using a trained model to make predictions on unlabeled examples, and it can be done statically or dynamically.\u003c/p\u003e\n"],["\u003cp\u003eStatic inference generates predictions in advance and caches them, making it suitable for scenarios where prediction speed is critical but limiting its ability to handle uncommon inputs.\u003c/p\u003e\n"],["\u003cp\u003eDynamic inference generates predictions on demand, offering flexibility for diverse inputs but potentially increasing latency and computational demands.\u003c/p\u003e\n"],["\u003cp\u003eChoosing between static and dynamic inference depends on factors like model complexity, desired prediction speed, and the nature of the input data.\u003c/p\u003e\n"],["\u003cp\u003eStatic inference is advantageous when cost and prediction verification are prioritized, while dynamic inference excels in handling diverse, real-time predictions.\u003c/p\u003e\n"]]],[],null,["[**Inference**](/machine-learning/glossary#inference) is the process of\nmaking predictions by applying a trained model to\n[**unlabeled examples**](/machine-learning/glossary#unlabeled_example).\nBroadly speaking, a model can infer predictions in one of two ways:\n\n- **Static inference** (also called **offline inference** or **batch inference** ) means the model makes predictions on a bunch of common [**unlabeled examples**](/machine-learning/glossary#unlabeled_example) and then caches those predictions somewhere.\n- **Dynamic inference** (also called **online inference** or real-time inference) means that the model only makes predictions on demand, for example, when a client requests a prediction.\n\nTo use an extreme example, imagine a very complex model that\ntakes one hour to infer a prediction.\nThis would probably be an excellent situation for static inference:\n**Figure 4.** In static inference, a model generates predictions, which are then cached on a server.\n\nSuppose this same complex model mistakenly uses dynamic inference instead of\nstatic inference. If many clients request predictions around the same time,\nmost of them won't receive that prediction for hours or days.\n\nNow consider a model that infers quickly, perhaps in 2 milliseconds using a\nrelative minimum of computational resources. In this situation, clients can\nreceive predictions quickly and efficiently through dynamic inference, as\nsuggested in Figure 5.\n**Figure 5.** In dynamic inference, a model infers predictions on demand.\n\nStatic inference\n\nStatic inference offers certain advantages and disadvantages.\n\nAdvantages\n\n- Don't need to worry much about cost of inference.\n- Can do post-verification of predictions before pushing.\n\nDisadvantages\n\n- Can only serve cached predictions, so the system might not be able to serve predictions for uncommon input examples.\n- Update latency is likely measured in hours or days.\n\nDynamic inference\n\nDynamic inference offers certain advantages and disadvantages.\n\nAdvantages\n\n- Can infer a prediction on *any* new item as it comes in, which is great for long tail (less common) predictions.\n\nDisadvantages\n\n- Compute intensive and latency sensitive. This combination may limit model complexity; that is, you might have to build a simpler model that can infer predictions more quickly than a complex model could.\n- Monitoring needs are more intensive.\n\nExercises: Check your understanding \nWhich **three** of the following four statements are true of static inference? \nThe model must create predictions for all possible inputs. \nYes, the model must make predictions for all possible inputs and store them in a cache or lookup table. If the set of things that the model is predicting is limited, then static inference might be a good choice. However, for free-form inputs like user queries that have a long tail of unusual or rare items, static inference can't provide full coverage. \nThe system can verify inferred predictions before serving them. \nYes, this is a useful aspect of static inference. \nFor a given input, the model can serve a prediction more quickly than *dynamic* inference. \nYes, static inference can almost always serve predictions faster than dynamic inference. \nYou can react quickly to changes in the world. \nNo, this is a disadvantage of static inference. \nWhich **one** of the following statements is true of dynamic inference? \nYou can provide predictions for all possible items. \nYes, this is a strength of dynamic inference. Any request that comes in will be given a score. Dynamic inference handles long-tail distributions (those with many rare items), like the space of all possible sentences written in movie reviews. \nYou can do post-verification of predictions before they are used. \nIn general, it's not possible to do a post-verification of all predictions before they get used because predictions are being made on demand. You can, however, potentially monitor *aggregate* prediction qualities to provide some level of quality checking, but these will signal fire alarms only after the fire has already spread. \nWhen performing dynamic inference, you don't need to worry about prediction latency (the lag time for returning predictions) as much as when performing static inference. \nPrediction latency is often a real concern in dynamic inference. Unfortunately, you can't necessarily fix prediction latency issues by adding more inference servers.\n| **Key terms:**\n|\n| - [Example](/machine-learning/glossary#example)\n| - [Inference](/machine-learning/glossary#inference)\n- [Unlabeled example](/machine-learning/glossary#unlabeled_example) \n[Help Center](https://support.google.com/machinelearningeducation)"]]