DistilBERT lowering

The same lowering script as used with GPT-2 is applied here.

Run the following on the development machine:

    

        
        
module-1-transformer-inference-with-xnnpack/scripts/aot/lower_to_executorch.py \
  --spec module-1-transformer-inference-with-xnnpack/artifacts/distilbert/model_spec.json \
  --backend portable

    

This creates distilbert_fillmask_portable.pte and distilbert_fillmask_portable.json.

    

        
        
module-1-transformer-inference-with-xnnpack/scripts/aot/lower_to_executorch.py \
  --spec module-1-transformer-inference-with-xnnpack/artifacts/distilbert/model_spec.json \
  --backend xnnpack

    

This creates distilbert_fillmask_xnnpack.pte and distilbert_fillmask_xnnpack.json.

Example artifact sizes are recorded below:

ArtifactBackendPTE size
distilbert_fillmask_portable.pteportable268.03 MB
distilbert_fillmask_xnnpack.pteXNNPACK361.80 MB

Check deployable artifacts

Before moving on, confirm that the lowering step produced:

  • the portable .pte
  • the XNNPACK .pte
  • the XNNPACK metadata JSON

In the reference run, the XNNPACK artifact is about 94 MB larger than the portable artifact. As with GPT-2, that extra size comes from backend-specific lowered data and metadata stored in the .pte.

The reference XNNPACK run reported:

  • XNNPACK delegate call sites: 27
  • fallback call_function operators: 354

The fallback list was again dominated by allocation, indexing, shape, mask, and normalization work, including alloc (161), getitem (60), expand_copy (25), and native_layer_norm (14). Mask and elementwise operations such as logical_not, mul.Scalar, scalar_tensor, and where also remained on the default path, along with DistilBERT-specific selection work such as argmax and index.

Compared with GPT-2, DistilBERT produced fewer delegate call sites and fallback operators. Because the graphs differ in size and structure, these counts do not by themselves show better coverage or less fragmentation. Use Model Explorer to inspect the size and placement of the delegated regions. DistilBERT still contains mask handling, reshapes, normalization, and elementwise operations that stay on the default path.

Previous page Complete and continue