pytorch / pytorch/executorch

Add segments for bpte

Open
#15,874 2 comments 1 reaction 2 assignees View on GitHub

@Gasoonjia is already working on this.

Since Nov 20, 2025.

Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

Currently, bpte schema stores program data as bytes inside the flatbuffer. This causes high latency and memory usage when converting llms ~1GB into bpte files, as we go through the flatbuffer json conversion.

We can follow the executorch schema and move the program into segments to avoid the flatbuffer conversion of large byte strings.

Program-data separation is a solution (without weights, program is small) but this is not a guaranteed solution for all users.

Conversion:
https://github.com/pytorch/executorch/blob/ca4e363cb04dec5aa39128220552739c3ba7a4df/devtools/bundled_program/serialize/__init__.py#L82-L100

Schema:
https://github.com/pytorch/executorch/blob/ca4e363cb04dec5aa39128220552739c3ba7a4df/devtools/bundled_program/schema/bundled_program_schema.fbs#L78-L95

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.