Explain algorithms in step by step list
- User
Explain algorithms in step by step list
Assistant
Based on the provided code files, here's a step-by-step explanation of the key algorithms implemented in the optillm repository:
-
Best of N Sampling (BON)
- Generate N completions for a given prompt
- Rate each completion using the model itself
- Select the highest-rated completion
- Return the best completion along with token usage
-
Chain of Thought (CoT) Decoding
- Generate multiple reasoning paths starting with top-k tokens
- Calculate confidence scores for each path based on token probabilities
- Aggregate paths based on confidence scores
- Select the path with highest confidence or aggregate multiple paths
-
CoT with Reflection
- Generate initial reasoning within tags
- Reflect on reasoning within tags
- Make adjustments based on reflection
- Provide final answer within tags
- Extract and return final output
-
Entropy Decoding
- Compute token entropy and variance at each step
- Adjust sampling parameters dynamically based on entropy
- Use adaptive sampling to select best next token
- Continue until stop token or max tokens reached
-
LEAP (Learning from Errors and Patterns)
- Extract examples from query
- Generate intentional mistakes for examples
- Generate low-level principles from mistakes
- Derive high-level principles
- Apply principles to solve original query
-
MCTS (Monte Carlo Tree Search)
- Initialize search tree with initial state
- Select nodes using UCT formula
- Expand nodes by generating possible actions
- Simulate random rollouts to terminal states
- Backpropagate results up the tree
- Select best action based on visit counts
-
Mixture of Agents (MoA)
- Generate multiple candidate responses
- Generate critiques for each candidate
- Generate final response based on candidates and critiques
- Return final response along with token usage
-
Plan Search
- Generate initial observations about problem
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.