speculative : fix out-of-bounds read in ngram-map on prompt shrink (#23936)