Feedback Functions
Using feedback to guide optimization in Trace2
Feedback Functions
Feedback is how you tell Trace2 what's good or bad about your AI system's behavior.
What is Feedback?
Unlike traditional machine learning which uses numerical losses, Trace2 accepts any kind of feedback:
- ✅ Numerical rewards or losses
- ✅ Natural language descriptions
- ✅ Test pass/fail results
- ✅ Compiler errors
- ✅ User preferences
- ✅ Multi-modal feedback
Creating Feedback Functions
Numerical Feedback
def feedback_fn(output, target):
error = abs(output - target)
return f"Error: {error}"Natural Language Feedback
[Add example]
Test-Based Feedback
[Add example]
Effective Feedback
Feedback in the Backward Pass
optimizer.zero_feedback()
optimizer.backward(output_node, feedback_string)
optimizer.step()