Monte Carlo Tree Search for Poetry Using GPT
Monte Carlo Tree Search for Poetry Using GPT
I've been working on enact, a framework that simplifies the implementation of complex generative software flows at https://github.com/agentic-ai/enact . Enact's core features include the ability to rewind and replay executions of python functions that are annotated in the framework. The linked notebook shows how this can be used to implement a generic Monte Carlo Tree Search (MCTS) algorithm that can be deployed over any annotated python program and directly searches the space of program executions. MCTS (used, e.g., in the AlphaZero family of algorithms) searches a tree of generative possibilities using a scoring function in order to find high-scoring branches. The notebook deploys MCTS over a line-by-line poetry generator, allowing the algorithm to backtrack and search different completions for the same starting lines. Baseline (no MCTS): > While shadows stir and breathe beneath the moon's licentious glow. > Nightly whispers wind through trees, long lost in their verdurous flow. > In the echoing silence, secrets lie dormant, awaiting the raven's crow. > A path unfolds beneath the thorns, where memories and shadows grow. MCTS Example 1: >Under the hush of leaves, ancient secrets pass as whispers. >Shadows dance as the daylight fades, echoing the rhythm of heartbeats. >In hallowed silence roots entwine, sharing stories with the undergrowth. >A shiver of twilight laces through, the phantom pulse of a forest's breath. MCTS Example 2: > Under the neon hum, craft recedes into shadow, > Where artistry and mechanics clash, souls are traded for steam and gas. > Echoes of creation's heart, usurped by iron’s brazen art. > Infernal gears grind dreams, artists' tears oiling their ceaseless horseplay. MCTS Example 3: > Spun by silent looms of determination ragged from use. > Eyes search the horizon, fingers till the marrow of invention. > Under quiet cover of the moon, the night was sown with ceaseless creation. > Mastering chaos, coaxing stars from a coal-darkened hand.
Share cardActual performance
Launch Intel predictions
Analyze your own launch →Correct prediction on native model
Similar products
FAQify – Algolia for FAQs using GPT-3
less than 650 LOC trainable GPT only using NumPy
Angular 2 AoT Compilation and Tree Shaking Example
Implementation of a 3-pointer AVL Tree
Visualizing Binary Tree
Ldd as a Tree and Much More
Toy LISP compiler in C# (LINQ) expression tree
Tree Dangler
I ported Tree-sitter to Go
KD-tree recommender system in Literate Coffeescript