SIGN IN SIGN UP

llama : fix time complexity of string replacement (#9163)

This change fixes a bug where replacing text in a very long string could
cause llama.cpp to hang indefinitely. This is because the algorithm used
was quadratic, due to memmove() when s.replace() is called in a loop. It
seems most search results and LLM responses actually provide the O(n**2)
algorithm, which is a great tragedy. Using a builder string fixes things
J
Justine Tunney committed
436787f170329b3f549e6c2c46593d2af8482e7c
Parent: 93bc383
Committed by GitHub <noreply@github.com> on 8/26/2024, 6:09:53 AM