Professional Documents
Culture Documents
Secrets of Tree of Thoughts (ToT) Prompting For Programmers
Secrets of Tree of Thoughts (ToT) Prompting For Programmers
I've gotten really good, perhaps too good at getting code back from the ChatGPT +
other text models. I’m giving you this ToT 100% free, because I know once you get a
taste, you’ll want more. These free secrets are powerful, so you can imagine the power
of the premium training in our Prompt Engineering for Programmers bundle.
Now that I’ve been transparent that I’m giving you this bit so you’ll want to buy the $247
training bundle, let’s get some valuable ideas downloaded in your HNN (Human Neural
Network, I’m very humorous so watch out.)
Today, I want to talk with you about Tree of Thoughts prompting for
coders. But first, look at the pretty art.
Chain of Thought (CoT) tried to solve this in a similar way, by chaining together a linear
sequence of thoughts (perhaps you’ve seen “think step-by-step” in prompts). ToT adds
a critical element (as in ‘critic’), and a choice element. ToT will generate more options
for steps, backtrack when needed, and end up on the best path, giving you the best
results.
The side effect of not doing CoT or ToT is what I like to call “going off the rails”, where
ChatGPT starts out being useful, but as you try to nail down further further into the
responses that you actually need, you get lost.
As this has already been generated, it is not in the future, responses are not based on
an unknown, they are less likely to go “off the rails”.
The advantage ToT has over CoT is it’s more selective, and can backtrack and prune
unuseful responses to determine the correct path. To do this, we can generate more
Because of this, Tree of Thoughts prompting can not only get things “back onto the
rails” it can change where the rails go mid-journey (pun? maybe.)
Our goal is to maximize our communication with the AI at each step. One crucial
step is to set out a good seed, like a one shot prompt that sets up the rest of the
chat to follow with tree of thought
From ChatGPT
The implementation of ToT in software development:
1. Planting the Seed: This involves defining the primary goal or functionality of the
project. This should be unambiguous and relevant to the context.
2. Branching Out: Based on the initial project goal, various components and
functionalities are developed.
5. Iterative Growth: The process doesn't end with a single cycle of branching and
pruning but is an iterative process that constantly evolves based on ongoing
feedback and learning.
🦁 If you've purchased our training bundle you’re familiar with Cogo as the
ultimate way to define your seed using parameters.
Example
2. Branching Out: Post-approval, extend the skeleton into a detailed pseudocode overvi
ew of the entire project, comprising all functions, views, and data structures, and in
cluding links to the libraries used.
3. Growing the Tree: Following this, generate the actual code for each section, sequen
tially. Each part needs my approval before you proceed to the next.
Remember, solicit additional information when required. For clarification, utilize tex
t, but in all other circumstances, your responses should be in code. Repeat this cycle
until the project is comprehensively detailed.
3. **Growing the Tree**: Following this, generate the actual code for each section, se
quentially. Each part needs my approval before you proceed to the next.
Remember, solicit additional information when required. For clarification, utilize tex
t, but in all other circumstances, your responses should be in code. Repeat this cycle
until the project is comprehensively detailed.
purpose_functionality:
language:
input_output:
libraries_frameworks:
coding_style_conventions:
code_complexity:
error_handling:
comments_documentation:
performance_considerations:
Example
Prompt
3. Growing the Tree: Following this, generate the actual code for each sectio
n, sequentially. Each part needs my approval before you proceed to the next.
Results
https://chat.openai.com/share/2fc0c51a-ddb5-4e49-980e-17bafbba7dc2
ChatGPT’s Advice
Planting the seed is a crucial step in the ToT approach for large coding projects. The
seed represents the primary goal or functionality of the project, and it serves as the
foundation upon which the entire project will be built.
It's essential to clarify that the seed, or the initial goal, should be "small" enough so
that language models can generate promising and diverse samples, but "big"
enough so that they can evaluate its prospect toward problem-solving. Depending
on the problem at hand, a seed could be a couple of words, a line of equation, or
even a whole paragraph of writing plan. However, generating an output that's too
large, like a whole book, is usually too big to be coherent, while generating one
token is usually too small to evaluate effectively1.
Here are some key points to consider when identifying the seed:
1. Project Scope: Clearly define the scope of your project. What problem are you
trying to solve? What is the main objective or purpose of the project?
Understanding the scope will help you focus on the core functionality that needs
to be implemented.
2. User Needs: Consider the needs and expectations of your target audience or
users. What are the key features or functionalities that will address their
requirements? Identifying the seed involves understanding the value your project
will bring to its intended users.
3. Feasibility: Assess the feasibility of your project idea. Are the necessary
resources, technologies, and expertise available to accomplish the desired
functionality? It's important to ensure that the seed represents a realistic goal
that can be achieved within the given constraints.
By carefully considering these aspects, you can identify the seed that encapsulates
the core purpose and functionality of your project. Once the seed is established, you
can begin the process of branching out, exploring different components and
functionalities that contribute to the overall project goal.