sampling-and-evaluation
Use Mellea 0.8.0.dev0 sampling, requirements, verifiers, evaluators, metrics, and m eval workflows to make generation more reliable and measure outputs safely.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- sampling-and-evaluation
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Mellea 0.8.0.dev0 sampling, requirements, verifiers, evaluators, metrics, and m eval workflows to make generation more reliable and measure outputs safely.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/api-reference.md7.6 KB
- 参考文档references/cli-reference.md4.3 KB
- 参考文档references/evaluators-and-verifiers.md7.4 KB
- 参考文档references/strategies.md6.1 KB
- 参考文档references/troubleshooting.md6.3 KB
- 脚本scripts/validate_eval_config.py11.7 KB
03 SKILL.md 正文
Sampling and evaluation
Use this route when the task involves retries, rejection, majority voting,
feedback, a verifier, an LLM judge, generated-code tests, benchmarks, metrics,
or m eval. It turns a generation call into an explicit candidate → check →
repair/select → report pipeline.
Route first
- Decide whether the goal is reliability during one generation or evaluation across a dataset. Use strategies.md for the former and evaluators-and-verifiers.md for the latter.
- Make every check that can be expressed in Python deterministic. Reserve LLM-as-a-judge for semantic or subjective criteria, and label its result qualitative and model-dependent.
- Bound both attempts and tokens before running a model. With
concurrency_budget > 1, the upper bound is approximatelyloop_budget * concurrency_budgetgenerations per base action; majority voting multiplies this again bynumber_of_samples. - Use
return_sampling_results=Truewhen failure diagnosis, per-attempt comparisons, or evidence is needed. Otherwise consume the output thunk. - For bulk judge evaluation, validate the dataset shape first, then run
m eval run; the bundled validator checks a local configuration without opening files, calling a backend, or executing generated code.
Strategy decision table
| Need | Start with | Important output/limit |
|---|---|---|
| Retry an unchanged prompt | RejectionSamplingStrategy |
First passing attempt; failed fallback is index 0 |
| Give repair reasons to an instruction | RepairTemplateStrategy |
Copy of Instruction with failed reasons |
| Continue a conversation while repairing | MultiTurnStrategy |
Requires ChatContext; failed fallback is last attempt |
| Fast solver then escalation | SOFAISamplingStrategy |
S1 loop, then one S2 attempt |
| Consensus-like math/text selection | MBRD strategy | Pairwise score maximum, not a semantic guarantee |
| Force a reasoning token budget | direct budget-forcing module | Ollama-only and usage metadata required |
| Safe generated Python checks | code-generation preset | Prefer static or Docker policy; never trust an allowlist as isolation |
Reliability contract
A Requirement validates the latest model output and returns a
ValidationResult. A passing result is bool(result) or
result.as_bool()—there is no public .result property on
ValidationResult. Failure reason is the repair signal. score, thunk,
and context are optional evidence, not automatic acceptance criteria.
SamplingResult contains success, the selected result, and parallel
histories: sample_generations, sample_validations, sample_actions, and
sample_contexts. Treat success=False as a failed reliability gate even
though a best-effort selected output is still available.
Evaluation contract
TestBasedEval.from_json_file() accepts one object or a JSON array. Each test
needs source, name, instructions, id, and a non-empty examples list.
Examples contain role/content messages; the last user message becomes the
input and assistant messages become reference targets. set_judge_context()
then supplies input, prediction, target(s), and guidelines to one judge call.
The m eval runner produces per-input score, passed, and justification,
plus per-test and overall pass rates. A missing or unparsable score is a failed
input. Do not compare raw judge prose as if it were a deterministic metric.
Safety and boundaries
Generated code is untrusted input. Static Python requirements parse and inspect
without execution. If execution is required, choose a declared policy and
prefer the Docker tier; ImportRestrictions is only an AST check, not a
security boundary. Do not put generated code, shell commands, credentials, or
network side effects into the configuration validator.
seed in model_options is only a request to the selected backend; it does
not make providers, retries, concurrency, or judges universally reproducible.
Record model, backend, strategy, budgets, seed, requirement definitions, and
raw validation reasons with benchmark results.
Handoff and related routes
- Typed
@generative, Pydantic output, parsing, and structured generation: route togenerative-programming. - General
mcommand discovery, serving, backend flags, and deployment: route toserving-and-cli; this route owns only evaluation semantics and them evalcontract. - Hooks and OpenTelemetry setup details: route to
observability-and-extensions; this route records which evaluation signals are useful.
Read api-reference.md for exact signatures,
evaluators-and-verifiers.md for
assertion-backed patterns, cli-reference.md for
m eval, and troubleshooting.md before
classifying a failure as a model failure.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).