mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-26 07:44:05 +00:00
Attribution: Based on Samsung SAIL Montreal's TinyRecursiveModels Repository: https://github.com/SamsungSAILMontreal/TinyRecursiveModels This commit adds a complete TRM implementation for recursive reasoning: ## Core Components - TrmConfig: Configuration with builder pattern, validation, serde support - TrmEngine: Main recursive reasoning engine with K iterations - MlpLatentUpdater: Fast MLP-based latent state updates with gated residual - AttentionLatentUpdater: Expressive multi-head cross-attention variant - AnswerRefiner: Answer refinement with residual connections - ConfidenceScorer: Confidence estimation with optional entropy adjustment - SonaBridge: SONA integration for adaptive K selection and learning ## Features - Configurable hidden/embedding dimensions (default 256) - K iterations (1-20) with n latent updates per iteration - Early stopping based on confidence threshold - Convergence detection via plateau monitoring - Trajectory recording for analysis and learning - Variable-length input handling via mean pooling - Thread-safe design with pre-allocated buffers ## Testing - 59 unit tests covering all components - 16 integration tests for full pipeline - Benchmark suite for performance measurement ## Architecture MLP variant: ~2-3x faster, good for simple queries Attention variant: More expressive, better for complex reasoning 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| attention.rs | ||
| memory.rs | ||
| pipeline.rs | ||
| router.rs | ||
| sona_bench.rs | ||
| trm_bench.rs | ||