HeadlinesBriefing favicon HeadlinesBriefing.com

GitHub - Imp: Self-Improving LM Programs for Elixir

Hacker News •
×

Imp is a declarative, self-improving language-model programming framework for Elixir, a full port of DSPy to the BEAM. It lets developers describe language-model steps and returns, choose reasoning strategies, and optimize programs against labeled examples using OTP's reliability and concurrency.

Developers define typed signatures like "issue -> kind: enum[bug,feature,question], summary" and call them with Imp.predict/2. The framework builds prompts from signatures, validates replies, and returns typed fields. Chain-of-thought reasoning and tool use are supported via Imp.chain_of_thought/2 and Imp.react/3 without changing signatures.

Optimization uses labeled datasets (trainset, valset, testset) with metrics. GEPA, a strong LM, reads failures and rewrites instructions. Other optimizers include Labeled Few Shot, Bootstrap Few Shot, MIPROv2, SIMBA, and fine-tuning with GRPO.

Agents run as supervised OTP processes with Imp.start_run/3, enabling monitoring and authorization controls. Tools are plain Elixir functions wrapped with Imp.tool/3. The framework depends on Req for HTTP calls.

Imp enables building from single typed calls to long-running agents, improving each component through measurement and optimization while maintaining Elixir's fault-tolerance and concurrency guarantees.