Re: Caching in PowerLoom
Hans Chalupsky <[email protected]> Mon, 05 Aug 2013 13:23:03 -0700
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
Yes, there are two forms of caching going on: (1) inferences inferred as part of forward-inference are cached in an inference cache (implemented via a PowerLoom context), so they don't have to be redone over and over again (2) results of backward inference that took a significant amount of chaining will be cached, provided that a goal had either all arguments bound or the result of a single-valued goal was computed. The problem with that for your scenario is that these caches get thrown away in light of user assertions and retractions, which might explain why you are not seeing any changes in query execution time. PowerLoom doesn't have fine-grained proposition-level truth-maintenance (yet), which might be beneficial in your scenario. If changes in a context might affect inferred results, those caches are thrown away (but caches in parent contexts are not affected). Moreover, without knowing the structure of your KB and rule base, it is not entirely clear whether caching would actually help. To get an improvement, there have to be sub-results that stay the same between different queries. One strategy that's often possible is to divide the KB into a static and a dynamic part, where expensive inferences from the static part are precomputed and then asserted in a module using "assert-from-query". In a submodule, you then represent the dynamic part of the KB which can use the results computed for the static part without having to rederive them every time. Setting this up might take a little bit of experimentation, though. Finally, even with a small rule base like yours, it is easy to get into performance trouble if the rules are recursive. In those cases it is often beneficial to mark the rules as forward-only. Having said all that, inference performance debugging can be quite hairy, even for experts. For more specific advice, I'd have to see the whole KB and rule base. Hans On 08/05/2013 08:11 AM, Sebastian Herold wrote: > Hi there, > > we use a PowerLoom factbase (~ 500,000 facts and about 30 rules) to > represent the structure of a software system and to do analysis on the > system. In some application scenario, we have to execute the same set of > queries over and over again but the factbase changes slightly between > each execution (single facts are retracted and asserted). What we > observe is that every execution takes about the same time as the > previous one although large parts of the factbase do not change. > > My question is whether PowerLoom applies any kind of caching mechanism, > incremental querying, or similar, to speed up execution, or if anything > like this can be enabled. > > Thanks and cheers > Sebastian >