Tree Prompting: LLM decision trees for text classification without fine-tuning
In Tree Prompting: Efficient Task Adaptation without Fine-Tuning (EMNLP 2023), John X. Morris, Chandan Singh, Alexander M. Rush, Jianfeng Gao, and Yuntian Deng learn decision trees that classify text through prompted language-model calls. Each internal node asks the frozen model to judge the input; its answer selects the next branch, and the reached leaf returns a class. The learned prompts and branching structure form a reusable program for the task.
Route a message using fixed questions and recorded answers. The paper learns the tree and prompts from labeled examples.
How do I export my notes?
Prompt at the first nodeDoes the message ask for help?
Response: Yes
Prompt selected by that responseDoes the message describe a failure?
Response: No
How-to question
A prompt response selects the next branch and ultimately a class.
What Tree Prompting introduced
The Tree Prompting preprint was released on 21 October 2023 and published at EMNLP 2023; John X. Morris and Chandan Singh contributed equally. A node combines a prompt, an LM call, and a rule mapping the output to a branch. A complete root-to-leaf path is the classifier’s execution trace for one input.
The tree is learned from labeled examples. Candidate prompts include sampled demonstrations, instructions and dynamically generated prompts. In the dynamic version, iPrompt generates candidates for the examples reaching a node, then split quality selects the prompt. Both the node questions and the tree’s branching structure are learned.
Tree Prompting (EMNLP 2023) learns a reusable classification tree from labeled examples. Internal nodes call a frozen language model with a prompt, its response selects a branch, and a leaf returns a class. The learned tree classifies new inputs.
Tree of Thoughts (NeurIPS 2023) searches paths of intermediate reasoning steps for the current problem, evaluating candidate thoughts and using lookahead or backtracking to choose the next step. The trees serve different purposes: Tree Prompting learns prompts and control flow for classification; Tree of Thoughts searches reasoning paths while solving a problem.
Consider a worked support-classification example with input “I was charged twice; please refund the duplicate payment.” A first node asks whether the message requests a refund. Its yes branch reaches a node asking about a duplicate charge; that yes branch ends at a duplicate-billing leaf. The input is a message, the intermediate values are LM judgments, and the output is its category. This fixed example illustrates control flow; the paper learns its trees from data.
The program consists of conditions, branches and return values. A conventional condition tests a numerical threshold or an exact string. A prompt-based condition asks the LM to interpret the input under an instruction. The instruction defines the question; the LM supplies the decision for this particular input.
A path log distinguishes three failure types: the node asks an irrelevant question; the model answers a relevant question incorrectly; or the leaf assigns the wrong class after correct answers. Recording the actual path makes these failures distinguishable.
What is learned, and what inference costs
Adaptation lives in the selected prompts and tree structure, without updating LM weights. Under one-call-per-node features, a path of depth D takes D LM calls, rather than evaluating every node. The code provides a scikit-learn-style classifier interface.
Keep fitting cost separate from prediction cost. Fitting searches candidate questions and measures their behavior on labeled inputs; serving evaluates the retained path. A large search budget therefore does not imply the same expense for every new prediction.
For an implementation, specify the label set, output parser, stopping rule and behavior on an invalid model answer. Measure accuracy together with average path length and token usage. Two trees with equal depth still differ in cost when their prompts include different numbers of demonstrations. Save the fitted prompts and tree with the model version: changing the LM changes the meaning of its executable conditions.
Aug-Tree expands text features using an LLM during fitting, then deploys an interpretable tree without LM calls. GPTree builds LLM-powered trees and supports expert feedback on decision paths. ACT learns binary natural-language questions with impurity-based selection and TextGrad refinement.
These distinctions identify separate design choices: generating features, answering semantic questions, searching for better questions, and revising the resulting program.
Method
Node or split
Role of the LM
Tree Prompting · 2023
Learned prompt evaluated on the input
Executes branching decisions; dynamic variant also generates prompts
Use this design when the task has a repeatable decision structure and labeled examples expose which distinctions matter. Intent routing, document classification and categorization all provide a natural setting for asking successive semantic questions. The tree stores task-specific structure outside the model weights.
Choose among example messages to follow their paths through a fixed tree. To train a classifier, use the original paper and code, fit on training examples, select tree size on validation data, and evaluate the saved tree on held-out examples.
Run the original Tree Prompting notebook
The authors’ original notebook uses GPT-2 and Rotten Tomatoes examples to fit TreePromptClassifier, predict held-out labels, compare individual prompts, and draw the learned tree with plot_tree. Follow the repository installation instructions; this notebook downloads the model and dataset.
John X. Morris, Chandan Singh, Alexander M. Rush, Jianfeng Gao, Yuntian Deng
Tree Prompting (EMNLP 2023) learns a decision tree of prompts for text classification without fine-tuning the language model. Training selects prompts and branching structure; inference follows a root-to-leaf path of LM calls.
Original prompt-based decision-tree method: task adaptation changes the tree and prompts while keeping the language model fixed.