<- Back
Comments (12)
- airtnpI keep thinking the partial evaluator and Futamura projection application on LLM context.Skill => Generic Program LLM skill optimizer => Partial evaluator Context => Env/Input Agent => InterpreterFirst projection: mix(interpreter, program) => specialized skill AOT compiling => offline skill rewriting JIT compiling => runtime specializing, defer loadingSecond projection: mix(mix, interpreter) => Agent/Model specific skill optimizerThird projection: mix(mix, mix) => self-improvement skill optimizerWhatever maybe I'm just thinking LLM as magic partial evaluator for any tasks
- artraxWe build this as a c++ library, do to query-compilation for our stream processing engine.https://github.com/nebulastream/nautilusIt allows us to implement operators or functions without having to write them in terms of LLVM IR DSL (or similar). Rather, you write your functions over a wrapper type (and returning one), for which there is an overload of anything which you can overload in c++.You can instantiate a wrapper from some c++ value, in which case the wrapper will just forward everything to this value, which was nice for debugging in the preagentic era. But, you can also instantiate such a wrapper as a tracer, and the result of the functions evaluation will be a trace.For controlflow, we record whenever a wrapper type is evaluated as a bool, first return true, and when we reach the end of one branch, throw an exception to get back to the beginning, and start all over again, but evaluate it to false.The resulting trace we can turn into LLVM IR and compile, or run for example in wasm
- johntortugoThis seminar explains how GraalVM Truffle uses partial evaluation: https://youtu.be/pksRrON5XfU
- apignottiWe implemented a similar concept in our C++ -> JavaScript/WebAssembly compiler (Cheerp) several years ago. It was a nice challenge.https://labs.leaningtech.com/blog/reducing-webassembly-size-...
- owlstuffingThis type of optimization is also known as compile-time constant expression folding.The problem with expanding it to include function calls is that it compromises binary compatibility. A code change on a function that results in a different range or has different side effects, will not be realized unless the caller is recompiled.
- infogulchDoesn't Zig have a pretty nice implementation of compile-time evaluation built in?
- measurablefuncCombining this w/ a JIT gets you truffle/graal.