Groups¶
Groups organize tasks into hierarchical collections, enabling aggregate scoring across related benchmarks.
Group
dataclass
¶
Group(name: str, alias: str | None = None, aggregate_metric_list: list[AggMetricConfig] | None = None, metadata: dict[str, Any] | None = None, _children: dict[str, Task | Group] = dict(), _config: GroupConfig | None = None)
A Group is a container for Tasks and/or sub-Groups.
Groups directly hold references to their children, making traversal and aggregation straightforward.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Unique identifier for this group (e.g., "mmlu", "mmlu::humanities")
TYPE:
|
alias |
Display name (defaults to name if not set)
TYPE:
|
aggregate_metric_list |
Optional list of metrics to aggregate across children
TYPE:
|
metadata |
Optional dict for user-defined metadata
TYPE:
|
Example
Attributes¶
aggregate_metric_list
class-attribute
instance-attribute
¶
aggregate_metric_list: list[AggMetricConfig] | None = None
Functions¶
add
¶
pop
¶
get
¶
__contains__
¶
__iter__
¶
__len__
¶
get_all_tasks
¶
get_all_tasks(recursive: bool = True) -> list[Task]
Get all leaf Task objects.
| PARAMETER | DESCRIPTION |
|---|---|
recursive
|
If True, include tasks from nested subgroups. If False, only return direct Task children.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Task]
|
List of Task objects (not Groups). |
Source code in lm_eval/api/group.py
get_all_groups
¶
get_all_groups(recursive: bool = True) -> list[Group]
Get all subgroups.
| PARAMETER | DESCRIPTION |
|---|---|
recursive
|
If True, include nested subgroups. If False, only return direct Group children.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Group]
|
List of Group objects (not including self). |
Source code in lm_eval/api/group.py
aggregate
¶
Aggregate metrics for this group from its leaf task results.
| PARAMETER | DESCRIPTION |
|---|---|
task_metrics
|
{task_name: {metric_key: value, "sample_len": int, ...}}
The full flat metrics dict (all tasks). This group only reads
entries for its own leaf tasks (via
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
_TaskMetrics
|
Aggregated metrics dict for this group, e.g.
|
Source code in lm_eval/api/group.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
to_dict
¶
Convert to dictionary for serialization.
Source code in lm_eval/api/group.py
from_config
classmethod
¶
from_config(config: GroupConfig | dict[str, Any]) -> Group
Create a Group from a GroupConfig or raw dict (e.g., parsed from YAML).
Note: This only creates the Group shell. Children must be added separately via group.add() after Tasks/subGroups are built.