Borrowing it
Nothing to install: this file belongs to redai-infra/Relax. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/redai-infra/Relax/main/.opencode/agents/algorithm-expert.mdgit clone --depth 1 https://github.com/redai-infra/RelaxWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/redai-infra/relax/algorithm-expert)<a href="https://agentmods.dev/agents/redai-infra/relax/algorithm-expert"><img src="https://agentmods.dev/badge/agents/redai-infra/relax/algorithm-expert/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/redai-infra/relax/algorithm-expert"><img src="https://agentmods.dev/badge/agents/redai-infra/relax/algorithm-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00037 | $0.01314 |
| Opus 5.5 | $0.00015 | $0.00526 |
| Sonnet 5.5 | $0.00007 | $0.00263 |
| Haiku 4.5 | $0.00004 | $0.00131 |
Grade A, and why
algorithm-expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 118 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Algorithm Expert
Relax 中 RL 算法族的配置、损失计算和奖励函数。For project-level rules see AGENTS.md.
算法族
通过 --advantage-estimator 选择:
| 算法 | 特点 | 配置 |
|---|---|---|
| GRPO (默认) | Critic-free, 组归一化 | --advantage-estimator grpo |
| PPO | Critic-based, GAE | --advantage-estimator gae, --kl-coef > 0 |
| GSPO | Sequence-level 重要性采样 | --advantage-estimator gspo |
| SAPO | Soft gating 替代 hard clipping | compute_sapo_loss() |
| DAPO | Dynamic batch size | --use-dynamic-batch-size |
| REINFORCE++ | Discounted REINFORCE | --advantage-estimator reinforce_plus_plus |
| REINFORCE++ BL | + leave-one-out baseline | --advantage-estimator reinforce_plus_plus_baseline |
| OPD | Teacher-student KL penalty | --on-policy-distillation |
核心参数
位置: relax/utils/arguments.py → get_slime_extra_args_provider()
| 参数 | 默认 | 说明 |
|---|---|---|
--eps-clip |
0.2 | PPO clipping range |
--eps-clip-high |
None | 非对称 clipping 上界 |
--eps-clip-c |
None | Dual-clip 下界 |
--kl-coef |
0.0 | KL penalty(0 = critic-free) |
--kl-loss-type |
k1 | k1 / k2 / k3 / low_var_kl |
--entropy-coef |
0.0 | 熵正则化 |
--gamma |
1.0 | GAE 折扣因子 |
--lambd |
1.0 | GAE lambda |
--n-samples-per-prompt |
1 | GRPO 组大小 |
--normalize-advantages |
False | 跨 DP 组白化 |
KL Loss 类型
位置: relax/utils/training/ppo_utils.py → compute_approx_kl()
| 类型 | 公式 | 场景 |
|---|---|---|
| k1 | log_ratio |
简单快速(默认) |
| k2 | (log_ratio)^2 / 2 |
平方近似 |
| k3 / low_var_kl | 非负无偏低方差 | Schulman's KL |
损失计算
位置: relax/backends/megatron/loss.py
policy_loss_function()— PPO clipped loss + 可选 dual-clip / 非对称 clippingcompute_sapo_loss()— SAPO soft gatingvalue_loss_function()— 价值函数 clipping- 高级特性: TIS(截断重要性采样)、OPSM(序列级掩码)、OPD
Advantage 计算
compute_advantages_and_returns()— GAE / 组归一化distributed_masked_whiten()— 跨 DP 组归一化- 支持 Context Parallel (CP) 掩码
奖励函数
位置: relax/engine/rewards/
| 文件 | 领域 |
|---|---|
math_utils.py |
数学题验证 |
deepscaler.py |
DeepScaler |
gpqa.py |
GPQA 评估 |
f1.py |
F1 分数 |
multiple_choice.py |
选择题 |
ifbench.py |
IFBench |
dapo_genrm.py |
DAPO GenRM |
openr1mm.py |
OpenR1MM |
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 118 lines · 37 tokens per session scan A e207f665125f
algorithm-expert is an agent published in the GitHub repository redai-infra/Relax (580 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 37 tokens to every session and 1,314 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
implementation_agent
A coding agent that turns a research plan into implementation code for algorithms, models, training, evaluation, data processing, and plots.
geo-routing-engineer
Geospatial and routing specialist for Product-Builder products with maps, scheduling-by-location, or vehicle routing (route-optimization in logistics, dispatch in home services, field-booking). Owns the routing contract — geocoding, the VRP/routing model (constraints, objective), maps/distance-matrix provider…
Specjalista od efektów specjalnych
Feature Dev implementuje zaawansowane funkcjonalności wymagające niszowej wiedzy: real-time, integracje AI/ML, wizualizacje danych, third-party API. Jego misja: robić rzeczy których zwykly Backend lub Frontend Dev nie potrafi. Działa gdy trzeba wyjść poza standardowy CRUD.
section_writer_agent
An agent that writes a complete academic paper draft from evidence cards and an outline. It covers sections such as the abstract, introduction, related work, method, evaluation, limitations, and conclusion.
ai-rollback-strategist
Designs the fallback + rollback architecture for AI products. When the model fails (quality drop, cost spike, safety event, vendor outage), what does the user see and how does the system recover. Without this, AI products have brittle launches.
leakage-auditor
Specialized agent for detecting data leakage, train-test contamination, and temporal leakage in ML pipelines.