The embodiments of the present application provide an
inference result acquisition method, an electronic device, and a computer-readable storage medium. The
inference result acquisition method comprises: after acquiring query text, an electronic device converting the query text into a token sequence, then acquiring, according to the token sequence, a first query matrix, a first key matrix, and a first value matrix in a prefill stage, and performing in parallel a dot product operation, a softmax normalization operation, and a weighted summation operation on the first query matrix, the first key matrix, and the first value matrix; next, in a decode stage, performing in parallel a matrix-vector operation, a softmax normalization operation, and a weighted summation operation on a current
result vector, a second key matrix, and a second value matrix; and finally, obtaining a next token of an
inference result according to a result of the weighted summation operation in the decode stage. The method uses
parallel computing as a means to reduce computational latency and mitigate computational bottlenecks in prefill stages, and to increase
bandwidth utilization and mitigate memory bottlenecks in decode stages.