Weights Are No Longer Just Binary
The weights-as-code project expresses the generation of an LLM's initial weights as code. It is worth examining because engineering teams can finally review where the weights came from and how to reproduce them.
The project page says that roughly 97% of an LLM's weight bytes were generated as code by Gemini 4. This does not mean Gemini 4 wrote a new model. More precisely, Gemini 4 participated in generating the weight code; the model logic, dependencies, and build artifacts still require independent verification.
This experiment is better understood as a shift in the model supply chain than as a new benchmark for model capabilities.
Weights Are No Longer Just Binary
A conventional model release usually includes several types of files:
safetensorsweights;- a
config.jsonconfiguration; - tokenizer files;
- quantized or converted artifacts required by the inference framework.
These files can be loaded, but they make several engineering questions difficult to answer:
- Where did a particular parameter originally come from?
- Can the training code, data processing, and random seed be reproduced?
- Was a weight modified by a script before release?
- Why do two models with the same name differ slightly?
Weights-as-code represents the process that generates a model's initial weights as code, providing an experimental path that can be reviewed, modified, and version-controlled. The code can live in Git and support diffs, reviews, and CI.
This is not quite the same as moving training settings from command-line arguments into a configuration file. A configuration usually describes what to run. Weight code may contain parameter generation, composition, transformation, and even distribution logic. The scope available for review therefore expands.
Still, 97% is a byte ratio, not a claim that Gemini 4 determines 97% of the model's behavior. The share of weight bytes in a model directory depends on the file format, quantization method, and parameter layout. The meaningful metrics are:
- Which weights were generated by code?
- Did the code generate initial values, corrections, or the final published values?
- What process produced the remaining 3%?
- Were any additional transformations performed before release?
Without these definitions, 97% is an attractive but incomplete headline.
Reviewability Does Not Equal Trust
Once weights become code, they gain at least three useful properties.
First, weights become readable. Reviewers can inspect the generation logic instead of seeing only a large field of floating-point values.
Second, the code becomes modifiable. Researchers can replace a module, change the initialization method, and generate a new set of weights.
Third, the process becomes versionable. Each commit corresponds to a clear Git diff, making it possible to trace the source of model changes.
None of this makes a model trustworthy by itself.
The code may still depend on unpinned packages, data files, or remote services. If the build relies on an untraceable environment, converting weights from binary files into code merely adds a visible wrapper around an otherwise invisible process.
Four areas deserve particular attention:
- Are dependencies pinned with lockfiles?
- Do data and base weights have content hashes?
- Does the build run in an isolated environment?
- Can a third party reproduce the final artifact from a clean environment?
This is the largest difference from a conventional open-source model release. Traditional releases leave the cost of reproduction to the model authors. A code-based release requires the authors to provide a build chain that more closely resembles a software supply chain.
Putting Weights Under Version Control
For engineering teams, the main value of putting weights in Git is precise change management, not storage savings.
Suppose a team wants to compare two initialization approaches. Previously, it might have generated two sets of weights, recorded their filenames, and compared them manually. With a code-based approach, teams can commit parameter experiments directly:
from dataclasses import dataclass
@dataclass(frozen=True)
class Experiment:
name: str
seed: int
scale: float
EXPERIMENT = Experiment(
name="baseline",
seed=42,
scale=1.0,
)
This example only illustrates how an experiment configuration can enter version control; it is not the project's complete build script. In practice, users still need to prepare the dependencies, input weights, and runtime environment specified in the project's README.
Code-based weights support four concrete use cases.
Fine-tuning. Teams can record the generation differences between baseline and fine-tuned weights instead of uploading only the final files.
Parameter experiments. Initialization distributions, scaling methods, or module combinations can each become an independent commit.
Model audits. Security teams can search for suspicious backdoor logic rather than scanning binary features alone.
Build reproduction. CI can regenerate the weights and compare them with released files byte for byte or by hash.
There is a practical complication: Git is good at managing text, not multi-gigabyte binary files. A more sensible approach is often to commit the generation code, data manifest, content hashes, and artifact manifest rather than the complete weights. Model files still belong in an artifact repository.
Git then records how the model was produced, while the artifact repository stores the final files, with the two linked through hashes.
Supply-Chain Risks Move Along with the Code
Readable code exposes opportunities for malicious changes. Executable code also expands the attack surface.
In an ordinary software supply chain, malicious code often hides in installation scripts, build dependencies, or publishing account permissions. Model weight code has the same vulnerability. Its output is not a webpage or CLI command, however, but a set of numbers that will shape inference.
A dangerous change may not be obvious. For example, a piece of code could add an extremely small offset to every token embedding. A single value would be almost impossible to notice, yet the resulting model could behave strangely around trigger words, refusal boundaries, or a specific domain.
These risks call for stricter release checks than ordinary software. At a minimum, releases should include:
- code reviews of generation scripts, dependencies, and input files;
- recorded versions and content hashes for every dependency;
- ephemeral containers or disposable build environments;
- restricted network access during builds;
- least-privilege publishing credentials;
- hashes for the final weights recorded in a signed manifest;
- CI rebuilds from a clean environment followed by artifact comparisons.
If the project permits changes to generation logic, it should also separate permission to generate weights from permission to approve a release. The people who write the code should not automatically gain the ability to push arbitrary artifacts to a model repository.
Another overlooked point is that code review does not substitute for behavioral auditing. Code may appear benign while producing an abnormal distribution, collapsed representations, or weights with a backdoor bias. Static checks therefore need to be supplemented by capability testing, security testing, and anomaly detection.
Hacker News Buzz and the Evidence Gap
The project reached the Hacker News front page. Links to the project page and discussion appear at the end of this article. The draft records a 234-point score and 70 comments, but these figures represent a changing snapshot and should be checked again at publication time.
The discussion is available at [news.ycombinator.com/item?id=50699217](https://news.ycombinator.com/item?id=50699217), while the original project is at [weights-as-code.pages.dev](https://weights-as-code.pages.dev/).
The attention shows that the community is interested in model supply-chain issues. The problem is that an HN score demonstrates that a discussion attracted interest; it does not establish that the project's 97% claim is valid.
Reproducing the project would require at least the following information:
- The role Gemini 4 played in code generation, including the prompts and tools used;
- The target LLM's architecture, parameter count, and weight format;
- The denominator used to calculate “97% of weight bytes”;
- The source of the remaining 3%;
- The complete code, input files, and dependency versions;
- The compute, time, and storage needed to build from scratch and produce a release artifact;
- Whether the rebuilt weights are identical to the official release files.
If any of these details is missing, third parties can review the concept but cannot verify the artifact.
A broader question also matters: if the same workflow can run reliably across different target models, could it become a new model release standard? Or is it limited to a single experiment demonstrating that weights can be constructed from code?
The former requires engineering conditions similar to those of a compiler or build system. The latter requires only an instructive proof of concept. Their value and costs differ by orders of magnitude.
Editorial Perspective
The significance of this experiment lies not in how many weight bytes Gemini 4 generated, but in turning a previously invisible part of model release into an artifact that can enter Git, code review, and CI. Even if the 97% metric still needs clarification, this approach changes the unit of discussion in model supply chains: engineering teams can inspect not only an uploaded file, but also the process that generated it.
In the short term, it is likely to serve as a research team's self-description tool rather than immediately replacing releases based on safetensors + model card. Complete weight code, input data, and a reproducible environment are often harder to publish than the final model files. The real barrier is not expressing weights as code, but enabling a third party to obtain the same artifact from a clean environment.
What is different is that the review target has moved from whether a model file exists to how that file was generated. It remains unclear whether the project has provided sufficient evidence for dependency locking, isolated builds, and byte-for-byte reproduction. Without those conditions, a code-based approach mainly improves visibility; it does not yet prove trustworthiness.
No comments yet — start the discussion