经 AI Skill Hub 精选评估,法律合同分层强化学习分析助手 获评「强烈推荐」。这款Agent工作流在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.2 分,适合有一定技术背景的用户使用。
该工具采用GRPO强化学习算法训练的大模型,通过分层架构实现专业的法律合同审查。它能高效识别合同风险并提供合规建议,特别适合法律从业者、企业法务及需要自动化合同审计的开发者。
法律合同分层强化学习分析助手 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
该工具采用GRPO强化学习算法训练的大模型,通过分层架构实现专业的法律合同审查。它能高效识别合同风险并提供合规建议,特别适合法律从业者、企业法务及需要自动化合同审计的开发者。
法律合同分层强化学习分析助手 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
# 方式一:pip 安装(推荐)
pip install hierarchical-rl-agents-for-legal-contract-analysis
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install hierarchical-rl-agents-for-legal-contract-analysis
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/HusamettinYilmazz/Hierarchical-RL-Agents-for-Legal-Contract-Analysis
cd Hierarchical-RL-Agents-for-Legal-Contract-Analysis
pip install -e .
# 验证安装
python -c "import hierarchical_rl_agents_for_legal_contract_analysis; print('安装成功')"
# 命令行使用
hierarchical-rl-agents-for-legal-contract-analysis --help
# 基本用法
hierarchical-rl-agents-for-legal-contract-analysis input_file -o output_file
# Python 代码中调用
import hierarchical_rl_agents_for_legal_contract_analysis
# 示例
result = hierarchical_rl_agents_for_legal_contract_analysis.process("input")
print(result)
# hierarchical-rl-agents-for-legal-contract-analysis 配置文件示例(config.yml) app: name: "hierarchical-rl-agents-for-legal-contract-analysis" debug: false log_level: "INFO" # 运行时指定配置文件 hierarchical-rl-agents-for-legal-contract-analysis --config config.yml # 或通过环境变量配置 export HIERARCHICAL_RL_AGENTS_FOR_LEGAL_CONTRACT_ANALYSIS_API_KEY="your-key" export HIERARCHICAL_RL_AGENTS_FOR_LEGAL_CONTRACT_ANALYSIS_OUTPUT_DIR="./output"
Reviewing several contracts involves understanding each document and finding risks across them. In this project, each contract is analyzed separately, then the findings are combined into one report. A reviewer can inspect the report, approve it, or ask the model to revise it based on feedback.
The project has two main parts: training a language model on CUAD using SFT and GRPO, and running contract review through Temporal parent and child workflows. The hierarchy here refers to how document analysis and report synthesis are organized. GRPO is used separately to train the extraction model.
The video below shows the contract review workflow in action.
https://github.com/user-attachments/assets/799a6275-3cc3-4de5-8a37-33e3684dcd0a
These are the current settings in agent_train/configs/config.yml:
| Parameter | SFT | GRPO |
|---|---|---|
| Learning rate | 2e-5 | 5e-6 |
| Batch size per device | 1 | 4 |
| Gradient accumulation | 8 | 8 |
| Generations per prompt | — | 4 |
| Save interval | 200 steps | 200 steps |
SFT runs for one epoch with LoRA rank 8, alpha 32, and dropout 0.05. Its formatting function truncates examples to 1,024 tokens, which can leave out parts of long contracts.
Python 3.11 is used for this project. Docker and Docker Compose are needed for Temporal, and a GPU is recommended for training.
conda create -n contract-analysis python=3.11
conda activate contract-analysis
pip install -r requirements.txt
From the repository root:
cp app/pdf-extraction/.env.example app/pdf-extraction/.env
cp app/client_app/.env.example app/client_app/.env
cp setup/samples-server/compose/.env.example setup/samples-server/compose/.env
In app/pdf-extraction/.env, set your S3 credentials, endpoint, and temporary download directory. Upload the contract PDFs to your storage and use their s3://bucket/path.pdf addresses when starting a review.
Choose the inference backend:
USE_LOCAL_MODEL=true, then set LOCAL_BASE_MODEL and LOCAL_ADAPTER_PATH to a compatible base model and adapter.USE_LOCAL_MODEL=false, then configure OPENROUTER_API_KEY, OPENROUTER_BASE_URL, and OPENROUTER_MODEL.Keep all template keys present because the worker reads settings for both backends at startup. The Temporal host, namespace, and task queue must match in the worker and API environment files. Review the Compose environment file for the server configuration.
aiskill88点评:将前沿的GRPO算法应用于垂直法律领域,分层架构设计合理,具有较高的专业实用价值。
该工具未明确声明开源协议,商业使用前请联系原作者确认授权范围,避免侵权风险。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
AI Skill Hub 点评:法律合同分层强化学习分析助手 的核心功能完整,质量优秀。对于自动化工程师和运维人员来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | Hierarchical-RL-Agents-for-Legal-Contract-Analysis |
| 原始描述 | 开源AI工作流:An LLM trained for legal contract review using GRPO and integrated into a hierar。⭐8 · Python |
| Topics | 法律AI强化学习合同审查 |
| GitHub | https://github.com/HusamettinYilmazz/Hierarchical-RL-Agents-for-Legal-Contract-Analysis |
| 语言 | Python |
收录时间:2026-07-11 · 更新时间:2026-07-11 · License:未公布 · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端