interfAIce icon indicating copy to clipboard operation
interfAIce copied to clipboard

Cache for Better Performance - Reflection & LLM

Open davin111 opened this issue 2 years ago • 4 comments

I think we can utilize internal caches for not executing reflection and many logic every time. This is surely optional feature, I think we can add it after the initial release. I'm interested in the implementation.

davin111 avatar Jun 09 '23 11:06 davin111

I've done something similar in the past: we could run all the reflection logic at configuration time (when beans are created), store the information somewhere and use it when the proxy is used. It might not have a big impact on the execution time since the main bottleneck will be from the llm apis, but it would save some computing resource.

mscheong01 avatar Jun 09 '23 12:06 mscheong01

jackson also has a reflection cache

mscheong01 avatar Jun 11 '23 11:06 mscheong01

since the main bottleneck will be from the llm apis

LLM API also can be cached with this concept (link) Although the above library don't support Kotlin, but it might be helpful to get some ideas.

joowon-dm-snu avatar Jun 14 '23 05:06 joowon-dm-snu

@joowon-dm-snu Thank you for sharing! 🍪 GPTCache seems to implement caches using vector similarity requiring an external vector storage and a cache storage. Since we standardize LLM requests into JVM methods, I think we can try something simpler, similar to Spring caches - by caching the response object using the method call parameter values as cache key. We could start with local caches and later support external cache storages. Overall, supporting caches for the LLM call itself is a good idea. Thanks!

mscheong01 avatar Jun 14 '23 09:06 mscheong01