Adds Liger Kernel support for a new HuggingFace Transformers model, or modifies existing monkey-patching. Generates lce_forward, monkey-patch function, tests, and README entry. Use when adding a new model to Liger Kernel, when a user asks to patch an unsupported model, when extending MODEL_TYPE_TO_APPLY_LIGER_FN, or when modifying/updating/fixing an existing monkey-patch (e.g., adding a new kernel to an already-supported model, fixing instance patching, updating a patch for upstream HF changes).
74
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Adds Liger Kernel optimization support for a new HuggingFace model, or modifies existing monkey-patching, through a staged pipeline with human review between stages. Supports creating new model patches and modifying existing ones.
Keywords that suggest modify mode: update, fix, change, add [kernel] to [existing model], extend, modify, new activation, new norm, bug in patch, upstream changed
Follow the Model Analyzer workflow in model-analyzer.md. If the host runtime supports parallel subagents, this stage may be delegated to one; otherwise execute the workflow directly.
This stage reads the HF modeling_*.py source and produces a model profile answering 12 architectural questions from decision-matrix.md.
Human checkpoint: Present the profile. Confirm before proceeding.
Follow the Code Generator workflow in code-generator.md.
Generates/modifies up to 13 files:
src/liger_kernel/transformers/model/{model}.py — NEW lce_forwardsrc/liger_kernel/transformers/monkey_patch.py — MODIFYsrc/liger_kernel/transformers/__init__.py — MODIFYsrc/liger_kernel/transformers/model/output_classes.py — MODIFY if neededtest/transformers/test_monkey_patch.py — MODIFYtest/convergence/bf16/test_mini_models.py — MODIFY (FLCE path)test/convergence/bf16/test_mini_models_with_logits.py — MODIFY (non-FLCE path)test/convergence/fp32/test_mini_models.py — MODIFY (FLCE path)test/convergence/fp32/test_mini_models_with_logits.py — MODIFY (non-FLCE path)test/convergence/bf16/test_mini_models_multimodal.py — MODIFY if VL modeltest/convergence/fp32/test_mini_models_multimodal.py — MODIFY if VL modeltest/utils.py — MODIFYREADME.md — MODIFYHuman checkpoint: Present changes for review.
Follow the Validator workflow in validator.md.
Runs instance patching test, convergence test, and lint check. Retries up to 3 times on failure.
Human checkpoint: Report final test results.
Read the existing apply_liger_kernel_to_{model_type} function in monkey_patch.py and the relevant section of the upstream HF modeling_{model_type}.py. Produce a short change plan:
Human checkpoint: Present the change plan. Confirm before proceeding.
Follow the Code Generator workflow in code-generator.md in modify mode.
Human checkpoint: Present changes for review.
Follow the Validator workflow in validator.md. This stage is mandatory — do not skip it. At minimum, run:
pytest test/transformers/test_monkey_patch.py -k "{model_type}" -xvspytest test/convergence/bf16/test_mini_models.py -k "{model_type}" -xvs (FLCE, bf16)pytest test/convergence/bf16/test_mini_models_with_logits.py -k "{model_type}" -xvs (non-FLCE, bf16)pytest test/convergence/fp32/test_mini_models.py -k "{model_type}" -xvs (FLCE, fp32)pytest test/convergence/fp32/test_mini_models_with_logits.py -k "{model_type}" -xvs (non-FLCE, fp32)pytest test/convergence/bf16/test_mini_models_multimodal.py -k "{model_type}" -xvspytest test/convergence/fp32/test_mini_models_multimodal.py -k "{model_type}" -xvsmake checkstyleHuman checkpoint: Report final test results.
7777995
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.