Model and Inference EngineeringTraining execution and recoveryStaff
How can checkpoint conversion preserve embedding values while breaking tied-weight training?
By Amit Kumar2 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A language model intentionally shares one trainable parameter between input embeddings and its output projection. A conversion copies both arrays into a distributed model. Their values initially match, but they drift after training resumes. Explain why equal values are insufficient, how to check logical sharing through wrapping and optimizer construction, and when a clean checkpoint or explicit architecture migration is needed.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
A tied weight is one logical trainable parameter used by two computation paths. It is not merely two arrays that happen to contain equal numbers. In a hypothetical scalar example, one path contributes gradient +2 and the other contributes -1. A tied parameter receives their sum, +1. Independent copies receive +2 and -1 separately and immediately move apart under an ordinary gradient update. Matching checkpoint values cannot establish this shared-update property.
Hugging Face's model documentation describes tying input and output embeddings when configured, and PyTorch's module documentation exposes parameter traversal with duplicate handling. Check the actual parameter identity in the framework and sharding setup, not only tensor equality in a serialized file.
I would inspect the model construction order, load operation, tie operation, distributed wrapping and optimizer creation. A converter might clone the output head. Or the training model ties weights before loading, but loading or wrapping materializes a second parameter afterwards. Some distributed and export paths represent shared parameters differently, so I would not assume a pointer comparison across wrappers tells the whole story. Test the documented alias invariant in the unwrapped model, then verify logical sharing through gradients and a single optimizer step under the actual training runtime. Enumerate optimizer parameter IDs and groups to ensure one logical tied weight is updated once, with intended weight decay and sharding.
The correction depends on whether the architecture really intends tied weights. If yes, reconstruct the alias at the right stage, load a canonical tensor, rebuild optimizer state to match the new parameter mapping and verify a round-trip save and resume. Do not average the two diverged arrays and declare recovery. Their optimizer moments may have diverged too. Decide whether a clean checkpoint is needed and compare token-level validation, especially rare tokens, before resuming a long run.
There is a reasonable interviewer pushback: maybe the model intentionally untied the head during fine-tuning. Fine, but that is an architecture change with its own optimizer and evaluation plan. Record it explicitly. This question is about an accidental break in a stated invariant. The new LoRA adapter has gradients. Why do its weights never change? has a LoRA weight missing from optimizer groups. Here both matrices can update, which is why the failure can hide under a plausible loss curve.
Related questions
Keep practising model and inference engineering
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux