Export a forward-only PTE model (with forward() returns loss + mutable params) for gradient-free finetuning
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 581
Description
🚀 The feature, motivation and pitch
Hi team,
I’m working on a project that needs to finetune a PTE model. In the "llm_fine_tuning" example, the model is exported with a combined forward+backward graph via _export_forward_backward():
When I run forward() on the exported PTE model, the outputs are loss + gradients + parameters (with parameters being mutable), per the runner code:
What I am trying to do
I would like to export a forward-only compute graph where the parameters remain mutable, and the forward() return format is simply loss + parameters (i.e., no gradients)
This would let me apply gradient-free optimization methods for finetuning, which could reduce runtime and memory by skipping the backward graph entirely.
Alternatives
-
Is there a recommended or supported way to export a forward-only PTE model while keeping parameters mutable?
-
If so, is there an API flag or alternative export path (e.g., an _export_forward() variant) I should use?
-
If not currently supported, would this be a feasible feature request? Any pointers on where to start would be greatly appreciated.
Thanks for your time and for the great project!
Additional context
No response
RFC (Optional)
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with examples/llm_pte_finetuning/model_loading_lib.py at _export_forward_backward() and the corresponding calls in examples/llm_pte_finetuning/runner.py. Trace the available export paths and parameter mutability behavior; done when a forward-only PTE export path is identified or specified that returns loss and mutable parameters without gradients.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100