Reflection Agents
AI Summary
- Introduction
- Presenter: Will from Lang chain
- Topic: Reflection technique for AI agents
- Reflection Technique
- Purpose: To improve AI agent quality and strategic decision-making
- Method: Prompting an LLM to critique and improve past actions, sometimes with external information
- Benefits: Enhances overall performance, albeit with added execution time
- Application: Can be used for fine-tuning data generation
- Example 1: Simple Reflection
- Process:
- Generate output with an LLM
- Use another LLM to critique and improve the output as a teacher
- Repeat process fixed number of times
- Return improved result to user
- Setup: API keys, tracing for reproducibility, prompt templates
- Outcome: Better artifact than initial attempt
- Example 2: Reflexion by Shin
- Architecture: Uses verbal feedback and self-reflection
- Process:
- Initial response generated by responder
- Self-critique and search terms generated for improvement
- Tools executed based on search terms
- Revisions made, incorporating critiques and search results
- Process repeated until desired state achieved
- Setup: Dependencies on Lang chain, search engine, API keys
- Outcome: Final response with citations and improvements
- Example 3: Language Agent Tree Search
- Concept: Combines reflection with reward modeling in a tree search
- Process:
- Generate candidate responses
- Reflect and score candidates
- Perform additional external checks if necessary
- Use scores to backpropagate and determine promising branches
- Repeat process, expanding on promising branches
- Setup: Graph state with nodes, messages, and values
- Outcome: Best trajectory determined through parallel operations and scoring
- Conclusion
- Reflection improves agent performance
- Demonstrated through basic reflection, Reflexion, and Language Agent Tree Search examples
- Sign up for Lang Smith for further exploration
For more information on the reflection technique and its applications, visit Lang chain.