The present application relates to the technical field of computers, and in particular to a request
processing method and apparatus, an electronic device, and a storage medium, for use in preventing hallucinations in large models due to high
concurrency, and improving the availability of the large models. The method comprises: acquiring a request to be processed, initially acquiring from a
token bucket a token corresponding to said request, and adding 1 to the total number of concurrencies of a current
sliding time window; if the initial acquisition of the token fails, on the basis of the total number of concurrencies, and the
throughput, average
delay and maximum acceptable
delay of a
large model, determining the number of retries and a retry interval duration of re-acquiring the token; and on the basis of the number of retries and the retry interval duration, re-acquiring the token from the
token bucket, and when the re-acquisition of the token succeeds, performing
inference on said request on the basis of the
large model, and generating and returning an answer. In this way, the number of retries and the retry interval duration are dynamically adjusted on the basis of the real-time total number of concurrencies, and requests are scattered to reach large models, thereby improving the response success rate and availability.