Skip to content
>_ StartupJobList_

Technology decisions

TensorFlow vs PyTorch: model migration, training parity and deployment

Keep the pipeline that meets its requirements. Evaluate an alternative on one specified workload, prove preprocessing and numerical parity, verify the real serving target and keep a tested reversal path before widening adoption.

TensorFlow 2.20.0 with Keras 3.11.3 on the TensorFlow backend, versus PyTorch 2.9.0. The synthetic classifier’s CPU inference and one-step SGD parity checks were executed. No accelerator, export-target compatibility or performance result is claimed.

Two model-development frameworks with distinct state, differentiation and deployment contracts. This is a bounded migration decision for an existing classifier, not a popularity ranking or an assumption that a new framework improves model quality.

Compare the practical consequences

Scroll sideways to compare all columns on a smaller screen.

TensorFlow and PyTorch by decision criterion
CriterionTensorFlowPyTorchWhat changes the decision
Existing pipelineKeep supported TensorFlow/Keras behavior.Pilot a bounded PyTorch implementation.Reverse the direction when PyTorch is the working reference.
Data contractFreeze transforms and tensor meaning.Reproduce the same feature and output contract.Split before fitting preprocessing.
DifferentiationTape and tracked variable boundaries.Autograd graph and registered parameters.Separate model mode from gradient recording.
Training parityExplicit loss and optimizer settings.Match reductions, state and update schedule.Same names do not prove equal updates.
ArtifactsNative .keras save versus inference export.Checkpoint versus export graph/target.Verify the actual consumer and operators.
Numerical proofRetained reference outputs and constraints.Measured tolerances and decision checks.Test inference and resumption separately.
Operating costKnown runtime/build/support ownership.Include compilation, transfers and new maintenance.No framework-wide speed ranking.
Hiring evidenceTensorFlow-tagged salary/job posts.PyTorch-tagged salary/job posts.Keep separate cohorts and overlapping-post limits.

↑ Back to sections

Should a working model pipeline change frameworks?

Keep the working pipeline unless a specific unsupported requirement justifies a trial. Compare one bounded workload through data, training state and the actual serving target before proposing a migration.

Use a hypothetical device-failure classifier as the running case: twenty named numeric features produce one failure logit per example. The current TensorFlow pipeline has a tested preprocessing artifact and a deployed inference consumer. A proposed PyTorch implementation might serve a new research workflow, but changing the framework creates proof obligations even when both model diagrams look identical. Name the missing requirement first: a needed operator, a supported deployment target, a measurable debugging problem or a team ownership constraint.

The reverse decision is equally valid. An existing PyTorch training loop should not be moved to TensorFlow merely because the team recognizes a serving product name. Identify the runtime the product actually uses, its supported model formats and its operational owner. Keep the first trial to this classifier and its existing contract. This article supplies an evaluation design, not evidence that either framework performed better on a real customer workload.

Follow-up: Does Keras3 make this choice irrelevant?

No. Keras3 supports multiple backends, but TensorFlow-specific operations, custom training loops, saved artifacts and deployment integrations can still depend on one backend. This comparison pins Keras3.11.3 to TensorFlow2.20 rather than assuming a backend switch is transparent.

Read the source: PyTorch2.9: module training state · Keras: migrating to Keras3 and export formats

↑ Back to sections

What must be identical before comparing predictions?

Freeze feature order, preprocessing, split rules, dtype, shape and output meaning. A matching layer count does not establish that the two implementations compute the same function.

For this classifier, define input as float32 [batch,20] in a named feature order and output as float32 [batch,1] logits. A positive label means a failure within the agreed future interval. Fit imputation and scaling only on training data; reuse the frozen transform for validation and serving. Keep device identities out of both sides of a split when testing generalization to unseen devices, or use a time split when the actual question is future performance. Choose the split for the deployment question, not for a flattering score.

Compare intermediate transformed features before model outputs. A column permutation, different missing-value fill or an extra sigmoid can dominate apparent framework differences. For image extensions, channel layout and resize conventions also become part of this contract; the tabular case does not prove those conversions. Save a small approved synthetic fixture with expected feature order and edge cases such as missing values and the maximum accepted range. Real private examples need their own data-handling authority.

Migration decision worksheet · Worked example
Field             | Retained pipeline | Candidate pipeline
Feature order      |                   |
Train-only transform version/hash        |
Input dtype/shape  | float32 [B,20]    | float32 [B,20]
Output meaning     | failure logit     | failure logit
Split/group/time rules                    |
Missing/out-of-range policy               |

Populate both columns from actual pipeline definitions. The shared shape and logit labels are this hypothetical contract, not facts inferred from either framework.

Illustrative worksheet, not a runtime or benchmark result.

Follow-up: Should validation data be shuffled?

Only if it does not change the evaluation contract. A stateless aggregate metric can be order independent; sequence state, grouped evaluation and a time-based question may require preserved order. The loader option does not choose the scientific question.

Read the source: TensorFlow: input datasets · PyTorch2.9: data loading

↑ Back to sections

Why can matching predictions still produce different training?

Inference parity compares a fixed function. Training continuation also depends on loss reduction, gradient scale, optimizer state, random draws and data order. These require separate checks.

Use binary cross entropy on logits for the one-output classifier, with float targets of shape [B,1] and an explicit mean over the B examples. Do not apply sigmoid first and then use a logits loss. With one output and no sample weights this gives a simple common denominator. Once examples have weights, masked tokens or several output labels, write down the numerator and denominator again instead of assuming the default reductions match. A [B] target accidentally combined with a [B,1] prediction can create a different operation through broadcasting in surrounding code.

Match optimizer hyperparameters explicitly, including epsilon, decay interpretation, momentum terms, step counters and schedule timing. The same optimizer name does not specify the same defaults or saved state. A first training test can compare a loss and one update on fixed small tensors without stochastic layers. A later test includes the actual BatchNorm/dropout behavior, mixed-precision policy and data order. A model that produces matching logits before an update has not yet passed the training-continuation test.

Follow-up: Can gradient accumulation replace a large-batch parity check?

Only under stated conditions. Weight uneven microbatches correctly and handle the final partial window. Batch-dependent layers and different random draws can make accumulated microbatches differ from a single large batch even with the same arithmetic denominator.

Read the source: PyTorch2.9: BCEWithLogitsLoss · TensorFlow2.20 source: sigmoid cross entropy with logits · Keras3.11.3: optimizer implementation · PyTorch2.9: Adam settings

↑ Back to sections

How should a team define numerical parity?

Use a fixed trusted reference, explicit tolerances and more than a headline accuracy score. Check preprocessing, logits, losses and decisions before accepting a converted implementation.

Start with float32 CPU inference on the same synthetic inputs and transferred, deliberately mapped weights. Declare tensor layout and transpose rules. Compare each named intermediate output where feasible, then final logits with an absolute-plus-relative tolerance chosen for the product. Record maximum error and inspect outliers, not just an average. No numeric tolerance is universal: values near the business decision threshold may require a tighter decision-specific check than values far from it. Set the PyTorch model to eval() and call the Keras model with training=False for this inference gate. Separately use a PyTorch no_grad/inference_mode context when no derivative is needed; Keras training=False does not prevent a surrounding GradientTape from recording operations.

After that gate, test the actual deployment precision and runtime. Compare positive/negative class meaning, calibrated probabilities if used, and threshold decisions on a held-out permitted corpus. Separately compare training loss and parameter updates for a small deterministic fixture. Exact equality across frameworks, hardware or releases is not promised. A shared random seed is a configuration input, not proof that random streams, algorithms or training trajectories coincide.

Python / parity arithmetic and layout contract · Worked example
import math
# TensorFlow Dense kernel: [20, 1]. PyTorch Linear weight: [1, 20].
# Map the Dense kernel by transposing; retain the same scalar bias.
features = [2.0, -1.0] + [0.0] * 18
weights = [0.5, 1.0] + [0.0] * 18
bias = 0.25
logit = sum(x * w for x, w in zip(features, weights)) + bias
positive_loss = math.log1p(math.exp(-logit))  # target = 1
wrong_features = [-1.0, 2.0] + [0.0] * 18
wrong_logit = sum(x * w for x, w in zip(wrong_features, weights)) + bias
print(round(logit, 6), round(positive_loss, 6), round(wrong_logit, 6))

Observed standard-library arithmetic: 0.25, 0.575939, 1.75. The correct dot product is 2×0.5 − 1×1 + 0.25. Swapping the first two input columns changes the logit to 1.75 despite identical model dimensions. A Dense kernel shaped [20,1] must become a Linear weight shaped [1,20]; forgetting that transpose produces an incompatible shape, while a feature permutation can stay shape-compatible and still be wrong. Matching Dense and Linear models were also run on CPU: their logits and loss agreed, and one plain SGD update matched independently calculated weights and bias (relative tolerance 1e-6, absolute tolerance 1e-7). This verifies this small float32 fixture, not arbitrary models, stochastic training or a deployment target.

Executed arithmetic and matching CPU Dense/Linear inference and one-step SGD checks with TensorFlow 2.20.0, Keras 3.11.3 and PyTorch 2.9.0.

Follow-up: What should happen when a handful of outputs exceed tolerance?

Keep the retained implementation and investigate the first divergent transform or operator. Do not widen tolerance simply to pass. Change the acceptance criterion only when the product owner can explain why the difference is harmless.

Read the source: PyTorch2.9: reproducibility limits · PyTorch2.9: autograd and evaluation modes · Keras3.11.3: Dense kernel shape · PyTorch2.9: Linear weight shape

↑ Back to sections

What has to reach the serving runtime?

Export an artifact supported by the actual target and verify its operators, shapes, state and numerical behavior there. A training checkpoint or successful local export is not a deployment certificate.

In the TensorFlow2.20/Keras3.11.3 baseline, distinguish a native .keras model save from an inference export. A SavedModel is not loaded as a native Keras3 model through load_model in the same way as a .keras file. Choose the format for the consumer and test the consumer entry point. On the PyTorch2.9 side, an exported graph carries capture assumptions and shape constraints; it still needs a compatible downstream runtime and supported lowering. Do not assume that an export name supplies a serving system.

Write down target operating system, architecture, accelerator, supported precision, dynamic batch policy and custom operators. Run malformed shapes and boundary batch sizes through the deployed-equivalent adapter in a controlled test. If the target cannot represent an operator, the decision may be to retain the framework, change the model with revalidation, or keep a fallback. Conversion that silently substitutes behavior must go back through the parity gate. No target compatibility has been measured in this article.

Keep the artifact provenance and expected digest with a trusted release record, and load only in a controlled validation environment before promotion. Keras safe_mode and PyTorch weights_only restrict particular deserialization behavior; they are not integrity checks, provenance guarantees or general sandboxes against malformed or resource-exhausting inputs. A matching digest is useful only when the expected digest came from a trusted channel.

Follow-up: Is a checkpoint enough for exact resumption?

Not by itself. Depending on the experiment, restoration also needs optimizer/scheduler/scaler, RNG states, preprocessing version and a controlled data cursor/order. Worker prefetch makes an arbitrary mid-epoch restart harder; an agreed checkpoint boundary can be simpler and more honest.

Read the source: Keras3.11.3: saving and loading API · PyTorch2.9: torch.export constraints · Keras: migrating to Keras3 and export formats · PyTorch2.9: serialization and loading limits

↑ Back to sections

When does the pilot earn a wider rollout?

Only after correctness and target gates pass should performance and operating cost decide expansion. Keep the reference path usable and define a reason to stop before starting.

Measure the same batch/input mix on the intended hardware. Separate compile or tracing warm-up from steady inference; include preprocessing, transfers and output handling. Record memory and tail latency as well as throughput. For training, compare cost to an agreed quality target, not just batches per second with different validation results. tf.function retracing and torch.compile graph breaks are different mechanisms, but both can make a toy timing unlike the actual application. Accelerator calls can enqueue asynchronously: use the appropriate device events or synchronize the measured operation boundaries before interpreting elapsed time. State whether transfer completion is included. A host timer around dispatch alone can measure enqueue cost rather than completed inference.

Add human costs: build and dependency maintenance, debugging the export, on-call knowledge and reproducing a training run. Assign an owner for each new artifact and keep the prior implementation built and tested until the pilot earns adoption. Stop if a required operator is unsupported, the relevant quality slice regresses, the memory budget fails or support depends on one person. Retain the reference artifact and its preprocessing contract so reversal does not require reconstructing a lost environment.

Follow-up: What if correctness passes but there is no cost improvement?

The pilot may still solve an explicit maintainability or target-support requirement. If no agreed benefit remains, keep the working pipeline and close the experiment. Successful exploration does not oblige a migration.

Read the source: PyTorch2.9: compile troubleshooting · TensorFlow: tracing with tf.function · PyTorch2.9: asynchronous CUDA execution and timing

↑ Back to sections

What skills should the role actually require?

Hire for the work: model experimentation, training systems, data quality or inference delivery. A PyTorch or TensorFlow tag alone does not define the role or a reliable assessment.

For the classifier pilot, an inference engineer needs to trace preprocessing, tensor layout, export constraints and runtime failures. A training engineer needs to explain gradient accounting, evaluation leakage and resumable state. A research role may need experimental design and model-specific expertise beyond either framework API. Give the candidate the actual task boundary and evaluate how they discover and test a wrong assumption.

The linked interview guides provide framework mechanisms with worked failures. The hiring hub and budget worksheet remain general tools here: there is no dedicated model-training role kit implied by this comparison. The applied-AI application assessment elsewhere focuses on a different job and should not be treated as a substitute. A useful interview can ask why matching architecture names failed the parity fixture, then follow the evidence to a shape, reduction or preprocessing mismatch.

Follow-up: Should candidates memorize framework defaults?

They should know which defaults can change the result and how to inspect the pinned implementation. Reward a correctly specified experiment and a justified correction, not confident recall of an unverified current default.

Read the source: PyTorch2.9: autograd and evaluation modes · TensorFlow: input datasets

↑ Back to sections

What can the salary and job links tell a hiring team?

They show separate framework-tagged source posts and advertised-pay context under this site’s evidence rules. They do not establish a framework pay premium or the cost of converting a model.

One source post can mention both frameworks, and each cohort can mix research, training infrastructure, inference and application work. Location, seniority and employer mix can differ too. Keep the existing sample and overlap limits beside displayed figures. Sparse or identical groups are not improved by a longer comparison narrative, and co-mentions do not represent two independent vacancies.

Open the matching posts and compare their actual responsibilities before setting a budget. Define the role, hiring location and working arrangement, then use the budget worksheet for salary and non-salary costs. The technical pilot and the hiring plan answer different questions. A median of advertised salary minima is neither an employee-pay survey nor a causal estimate of the return on learning or adopting either framework.

Follow-up: Can these links support a learning decision?

Yes, as context for the kinds of source posts that mention each framework. Pair that with the actual projects you want to work on and the worked interview mechanisms; do not turn a cohort median into a promise of personal earnings.

Read the source: StartupJobList: salary methodology

↑ Back to sections

Salary context

Advertised salaries for these skills

These are Hacker News job posts that mention these technologies, not employee earnings or a measure of what a skill adds to pay. The amounts summarize annualized advertised minimums in approximate USD. Groups can overlap and differ in roles, locations and dates.

TensorFlow posts

10 posts · 10 usable advertised salary amounts

2024-08-01 to 2026-05-05

Not enough usable observations for an aggregate salary: at least 30 are needed. Individual source offers can still be useful.

Explore TensorFlow salaries → Browse matching job posts →
Currency and calculation basis

Approximate USD using ECB daily reference rates as of 2026-10-30. Original currencies and offer ranges remain on the source listings. These figures cover posts tagged TensorFlow, rather than every job in the broader technology family.

PyTorch posts

38 posts · 38 usable advertised salary amounts

2024-08-02 to 2026-11-02

$150,000

Median advertised minimum, approximate USD/year

Middle 50%: $125,000–$165,000

Explore PyTorch salaries → Browse matching job posts →
Currency and calculation basis

Approximate USD using ECB daily reference rates as of 2026-10-30. Original currencies and offer ranges remain on the source listings. These figures cover posts tagged PyTorch, rather than every job in the broader technology family.

How many source posts appear in both salary groups?

Source posts can appear in both groups in this salary dataset. The same advertised salary can therefore contribute to both summaries.

TensorFlow posts in this dataset 7 of 10 also tagged PyTorch · 70.0%
PyTorch posts in this dataset 7 of 38 also tagged TensorFlow · 18.4%
What these bars count

Bars count distinct source posts with known HN IDs in these salary cohorts, not every Hacker News post or the wider job market. Duplicate IDs count once; rows without a valid HN ID are left out, so the bars cannot establish overlap for the full population. These are source-post counts, not the salary-observation counts in the cards above. A missing tag does not prove a technology was not used. Overlap does not establish employer preference, adoption or a pay effect.

↑ Back to sections

Keep exploring