Visual Guide to the Inference Flow
シリーズ: イメージでわかる
入力がモデルの中でどう計算され、最後に答えになるのかを、工場の流れのようにやさしく説明するページです。
A factory-style explanation of how input data moves through a model and becomes an output during inference.
学習ずみの AI モデルに新しいデータを入れて、答えを出してもらう工程です。
The process of feeding new data into a trained AI model and getting an answer.
AI には大きく2つのフェーズがあります。「学習(training)」と「推論(inference)」。学習は教科書を何百回も読んで知識をつける段階。推論は、身についた知識でテストに答える段階です。
AI has two major phases: "training" and "inference." Training is like reading a textbook hundreds of times to gain knowledge. Inference is using that knowledge to answer test questions.
ChatGPT に質問を入力して返事をもらう、画像生成AIに指示を出して絵をもらう、これらはすべて推論です。
When you ask ChatGPT a question and get a reply, or tell an image-generation AI to create a picture — that's all inference.
テキストや画像をモデルが読める数値(トークン、テンソル)に変換する。「原材料を加工しやすい形にする」工程。
Convert text or images into numbers (tokens, tensors) the model can read. Like shaping raw materials for the production line.
入力データに重み行列をかける。モデルの各レイヤーで何度もくり返される、推論の中心的な作業。ここに時間がいちばんかかる。
Multiply the input data by weight matrices. This repeats at every layer of the model and is the most time-consuming part of inference.
画像系モデルでは畳み込みでパターンを抽出。どのモデルでも「活性化関数」で中間結果を調整する。
Image-based models use convolution to extract patterns. All models use "activation functions" to refine intermediate results.
ステップ2〜3をモデルの層の数だけくり返す。大きいモデルでは数十〜数百層。
Repeat steps 2–3 for as many layers as the model has. Large models can have tens to hundreds of layers.
最終層の結果から、テキスト(次の単語)や画像(ピクセル)に変換して返す。「完成品の出荷」。
Convert the final layer's result back into text (the next word) or an image (pixels). "Shipping the finished product."
rocBLAS → ステップ2担当。行列のかけ算を超高速でやる専門家。
rocBLAS → Handles Step 2. The specialist that performs matrix multiplication at blazing speed.
MIOpen → ステップ3担当。畳み込みと活性化の達人。GPU ごとにいちばん速い方法(solver = 計算のやり方)を選んでくれる。
MIOpen → Handles Step 3. The convolution and activation expert. Picks the fastest method (solver = one way of doing the computation) for each GPU.
HIP ランタイム → 工場全体の管理者。GPU にメモリを確保したり、計算命令を送ったりする裏方。
HIP Runtime → The factory manager. Allocates GPU memory, sends computation commands — the behind-the-scenes coordinator.