AGENT SKILL

model-training

Train, resume, tune, inspect, serialize, score, and troubleshoot LightFM recommendation models.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
model-training
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Train, resume, tune, inspect, serialize, score, and troubleshoot LightFM recommendation models.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

LightFM model training sub-skill

Use this sub-skill when the task is to train or operate a lightfm.LightFM model: choose a loss, fit or resume training, score items, inspect embeddings, serialize the model, tune regularization or schedules, use sample weights, or export representations for nearest-neighbour retrieval.

Route map

  • Use this sub-skill for: LightFM(...), fit, fit_partial, predict, predict_rank usage notes, get_user_representations, get_item_representations, sample weights, random_state, num_threads, pickling, sklearn-style parameters, and optional ANN indexing from trained embeddings.
  • Route dataset mappings and feature matrices to: ../data-features/SKILL.md. This includes Dataset, raw user/item ids, identity features, metadata features, and feature-shape preparation.
  • Route metrics and splits to: ../evaluation-splitting/SKILL.md. This includes precision_at_k, auc_score, train/test split construction, and evaluation leakage checks. This sub-skill only notes when model APIs feed evaluation.
  • Route build, Cython, OpenMP, and packaging maintenance to: ../repo-development/SKILL.md.

Fast workflow

  1. Prepare interactions as a SciPy sparse user-item matrix. Use ../data-features/SKILL.md if raw ids or feature matrices are involved.
  2. Pick a loss:
    • warp for implicit top-k ranking, often a strong default.
    • bpr for implicit ranking/AUC-style objectives and usually faster epochs than WARP.
    • logistic when interactions include both positive 1 and negative -1 labels.
    • warp-kos for k-order statistic WARP experiments; do not combine it with sample_weight.
  3. Train with model.fit(...) for a fresh model or model.fit_partial(...) to resume from current weights.
  4. Score candidate pairs with model.predict(user_ids, item_ids, ...); pass repeated user ids when ranking many items for one user.
  5. Inspect/export representations with get_item_representations(...) and get_user_representations(...); preserve the same feature schema used at training time.
  6. Use references/workflows.md for concrete snippets and scripts/tiny_lightfm_smoke.py for a no-network smoke run.

Decision points

  • Fresh versus resumed training: fit resets existing learned state; fit_partial keeps state and advances training. Use fit_partial for epoch-by-epoch validation, checkpointing, and warm starts.
  • Feature shape continuity: when resuming or predicting with side features, the feature matrices must have compatible rows and the same feature-column meaning as training.
  • Regularization: if train quality is high but validation quality degrades, try lower no_components, early stopping, or small item_alpha/user_alpha. If learned weights collapse toward zero, regularization may be too strong.
  • Threads: LightFM is CPU-only. num_threads must be at least 1; keep it no larger than physical cores and use 1 when reproducibility/debugging matters.
  • ANN retrieval: approximate nearest-neighbour libraries are optional operational add-ons. Build indexes only after extracting trained item/user embeddings; keep exact predict as the correctness fallback.

References

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351