A Árvore de pensamento (TOT) solicitando, uma nova técnica empréstimos de empréstimos da estrutura da Árvore dos Thoughts, amplia e aprimora o conceito de impulsionamento da cadeia de pensamento bem estabelecida, permitindo assim que grandes modelos de linguagem, como o ChatGPT, exibam habilidades de raciocínio superiores. Essa técnica de necessidade da árvore de pensamento permite que grandes modelos de linguagem corrigissem seus erros autonomamente, acumulando progressivamente o conhecimento.
Em um exemplo, um prompt TOT melhora a capacidade de raciocínio do ChatGPT 3.5 de responder a uma pergunta que anteriormente só poderia ser respondida pelo ChatGPT 4.
Os grandes modelos de linguagem (LLMs) geralmente lutam para responder a certos tipos de perguntas complexas. Aqui está um exemplo representativo:
Bob is in the living room.
He walks to the kitchen, carrying a cup.
He puts a ball in the cup and carries the cup to the bedroom.
He turns the cup upside down, then walks to the garden.
He puts the cup down in the garden, then walks to the garage.
Where is the ball?
A resposta correta é que a bola está no quarto. Embora os LLMs não sejam determinísticos, as respostas que recebi durante várias tentativas foram as seguintes:
Existe um conceito amplamente reconhecido conhecido como "acumulação de cadeia de pensamentos" (COT para curta), o que incentiva os grandes modelos de linguagem (LLMs) a elucidar seu processo de pensamento, aumentando assim a probabilidade de uma resposta correta. As raízes desse conceito podem ser rastreadas até um artigo a partir de janeiro de 2022, intitulado: Cadeia de pensamento provocando o raciocínio em grandes modelos de idiomas.
Na sua essência, a técnica do COT pode ser implementada adicionando algo semelhante ao seguinte a um prompt:
Think carefully and logically, explaining your answer.
Essa abordagem aprimora o desempenho do LLMS em responder a muitas perguntas, embora sua eficácia varie.
Aqui está um exemplo da resposta do ChatGPT 3.5:
Based on the given sequence of events, we can logically determine the location of the ball. Let's analyze each step:
1. Bob is in the living room.
- No mention of the ball in the living room.
2. Bob walks to the kitchen, carrying a cup.
- No mention of the ball in the kitchen yet.
3. Bob puts a ball in the cup.
- The ball is now inside the cup.
4. Bob carries the cup to the bedroom.
- The ball is still inside the cup.
5. Bob turns the cup upside down.
- If the ball was inside the cup, it would have fallen out when Bob turned it upside down.
6. Bob walks to the garden.
- Bob left the cup in the garden, but there is no mention of the ball being removed from the cup.
7. Bob puts the cup down in the garden.
- The ball, if it was in the cup, would still be in the cup in the garden.
8. Bob walks to the garage.
- No mention of the ball being taken to the garage.
Based on the given information, we can conclude that the ball is still inside the cup in the garden.
Você pode ver como o ChatGpt percebeu que a bola caiu na etapa 5, mas ainda não conseguiu a resposta correta.
Podemos fazer melhor, sem recorrer ao chatgpt 4?
As últimas semanas viram o surgimento de vários artigos e repositórios de Python, introduzindo o conceito de árvore de Thoughts (TOT):
O princípio subjacente é fornecer ao LLM uma oportunidade de explorar vários ramos do raciocínio enquanto auto-avalia à medida que progride. De acordo com os artigos referenciados, essa abordagem parece ser altamente eficaz para certos problemas.
Os documentos existentes que discutem a estrutura da árvore de pensamento parecem ter como premissa fazer várias chamadas para um LLM, normalmente via Python. Uma das principais vantagens do raciocínio da cadeia de pensamentos é que ela pode ser alcançada com o ChatGPT em uma única frase.
Isso me levou a refletir: poderíamos melhorar os resultados do COT utilizando um prompt no estilo TOT?
Aqui está o aviso que usei:
Imagine three different experts are answering this question.
All experts will write down 1 step of their thinking,
then share it with the group.
Then all experts will go on to the next step, etc.
If any expert realises they're wrong at any point then they leave.
The question is...
E aqui está a resposta do ChatGTP 3.5:
Expert 1: The ball is in the living room.
Expert 2: The ball is in the kitchen.
Expert 3: The ball is in the bedroom.
Expert 1: Bob carries the cup to the bedroom, so the ball must be in the cup.
Expert 2: Oh, I see my mistake. Yes, the ball is in the cup.
Expert 3: Agreed, the ball is in the cup in the bedroom.
Expert 1: Next, Bob turns the cup upside down in the bedroom.
Expert 2: After that, Bob walks to the garden and puts the cup down.
Expert 3: Therefore, the ball must have fallen out of the cup when Bob turned it upside down in the bedroom. So, the ball is in the bedroom, not in the cup anymore.
Expert 1: Oh, you're right. I made a mistake. The ball is in the bedroom, not in the cup.
Expert 2: Agreed, the ball is in the bedroom.
Expert 3: Bob then walks to the garage, so the ball remains in the bedroom. It is not in the garden or the garage.
Expert 1: Absolutely, the ball is still in the bedroom.
Expert 2: Yes, the ball hasn't moved from the bedroom.
Expert 3: Therefore, the ball is in the bedroom, not in the garden or the garage.
All three experts agree that the ball is in the bedroom.
Você pode ver como desta vez ChatGPT 3.5 obtém a resposta correta!
Há espaço para refinar o prompt para melhorar o desempenho, potencialmente levando a respostas mais concisas.
Se você encontrar sucesso com outros avisos, recebemos você em enviar um PR e adicioná-los ao tree-of-thought-prompts.txt .
A estrutura da árvore de pensamento tem a semelhança com um processo de tomada de decisão organizacional envolvendo várias partes interessadas. A estrutura tenta imitar o consenso e a diversidade de pensamento.
O efeito pode ser estendido usando vários agentes que são ajustados para lidar com diferentes partes de uma tarefa. A AutoGPT é um bom exemplo disso, onde se autoavalia a LLM planeja uma meta. O uso de LLMs ajustados de maneira diferente para especialização ou mesmo LLMs completamente diferentes permitiria uma maior diversidade de pensamento. Esses LLMs podem interagir em diferentes modos (usando topologias de equipes Terminology):
As equipes de alto desempenho geralmente superam os indivíduos na tomada de decisões. Portanto, é plausível que a adoção de outras estruturas e características organizacionais possa melhorar o desempenho do LLMS. Além da diversidade de pensamento, especialização e concenso, podemos imitar:
Cite este repositório se você usar o código.
@misc{tree-of-thought-prompting,
title = {Using Tree-of-Thought Prompting to boost ChatGPT's reasoning},
author = {Dave Hulbert},
year = 2023,
month = may,
journal = {GitHub repository},
publisher = {Zenodo},
doi = {10.5281/ZENODO.10323452},
url = {https://doi.org/10.5281/zenodo.10323452},
howpublished = {url{https://github.com/dave1010/tree-of-thought-prompting}}
}