Open
Conversation
- Create trl/trainer/hicra_config.py with HICRAConfig class - Add HICRA-specific parameters: hicra_alpha, use_hicra, hicra_entropy_topk, use_planning_tokens - Add Strategic Gram configuration: strategic_grams_path, strategic_grams, sg_n_range - Add logging configuration: log_semantic_entropy, log_planning_token_ratio - Implement parameter validation in __post_init__ - Add comprehensive docstrings following TRL conventions Implements task 1 from hierarchical-reasoner-trl spec. Requirements: 3.1, 3.2, 3.3, 3.4, 3.5
This PR implements HICRA, a novel RL algorithm that enables LLMs to develop hierarchical reasoning capabilities by amplifying learning signals for strategic planning tokens. Key features: - HICRATrainer extending GRPOTrainer with advantage modification - Strategic Gram utilities for identifying planning tokens - Comprehensive test suite with 37+ tests - Documentation and example scripts - Full compatibility with existing TRL features (PEFT, distributed training, etc.) Implementation follows the VeRL reference (TIGER-AI-Lab/Hierarchical-Reasoner) and the paper 'Emergent Hierarchical Reasoning in LLMs through Reinforcement Learning' (arXiv:2509.03646). Changes: - Add HICRAConfig extending GRPOConfig - Add HICRATrainer with VeRL-based advantage modification - Add Strategic Gram extraction and matching utilities - Add comprehensive test suite (unit, integration, validation) - Add documentation and example scripts - Update README and exports
Author
|
@qgallouedec or others any comment on this? we just want to add the HICRA algorithm to trl... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This branch implements a new trainer that enables language models to develop emergent hierarchical reasoning capabilities through reinforcement
learning. HICRA is based on research from TIGER-AI-Lab (https://huggingface.co/papers/2509.03646).
Key Changes
New Components:
Example Scripts:
Test Coverage:
How It Works
HICRA amplifies the learning signal for "Strategic Grams" (planning tokens like "let's try a different approach" or "the key insight is"),
which enables models to:
The implementation follows the VeRL reference from TIGER-AI-Lab and extends the existing GRPO trainer with hierarchy-aware advantage
modification.
Before submitting
Pull Request section?
to it if that's the case.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.