# Flux vs Tensorflow training performance comparison?

**URL:** https://discourse.julialang.org/t/flux-vs-tensorflow-training-performance-comparison/32926
**Category:** General Usage
**Tags:** tensorflow, flux, machine-learning
**Created:** [January 3, 2020, 2:42pm UTC](https://discourse.julialang.org/t/flux-vs-tensorflow-training-performance-comparison/32926 "2020-01-03T14:42:51Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)
#### Post date: [January 3, 2020, 2:42pm UTC](https://discourse.julialang.org/t/flux-vs-tensorflow-training-performance-comparison/32926/1 "2020-01-03T14:42:51Z")

</div>

Has anyone done a performance comparison between Flux and Tensorflow, on the speed of training a model? I mean taking some conveniently pre-defined model on some standard dataset (say MNIST) and training it using both libraries to see which goes faster. Are there comparisons like these out there?

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [January 3, 2020, 4:04pm UTC](https://discourse.julialang.org/t/flux-vs-tensorflow-training-performance-comparison/32926/2 "2020-01-03T16:04:57Z")

</div>

The most recent benchmarks I’ve found have shown Flux a bit faster:

> **[Estadistika](https://estadistika.github.io//julia/python/packages/knet/flux/tensorflow/machine-learning/deep-learning/2019/06/20/Deep-Learning-Exploring-High-Level-APIs-of-Knet.jl-and-Flux.jl-in-comparison-to-Tensorflow-Keras.html)**
>
> statistics, data science, machine/deep learning

though I would expect that not to be the case when deploying to large multi-GPU sessions, which is where TensorFlow shines. Though I do also know of

> **[GitHub - avik-pal/DeepLearningBenchmarks: Benchmarks across Deep Learning...](https://github.com/avik-pal/DeepLearningBenchmarks)**
>
> Benchmarks across Deep Learning Frameworks in Julia and Python - GitHub - avik-pal/DeepLearningBenchmarks: Benchmarks across Deep Learning Frameworks in Julia and Python

[http://denizyuret.github.io/Knet.jl/latest/tutorial/#Benchmarks-1](http://denizyuret.github.io/Knet.jl/latest/tutorial/#Benchmarks-1)

> **[High-Performance GPU Computing in the Julia Programming Language | NVIDIA...](https://developer.nvidia.com/blog/gpu-computing-julia-programming-language/)**
>
> Julia is a high-level programming language for mathematical computing that is as easy to use as Python, but as fast as C. The language has been created with performance in mind…

By all accounts, KNet is one of the fastest out there (and notice the Knet benchmarks were not written or ran by the Knet authors. They weren’t even written/ran by regular Julia users!), and Flux lags a bit behind in some areas, but uses KNet as a goal post. Thus KNet can be used as a bridge to see how Flux compares to KNet which compares to the rest of the world. KNet sacrifices some generality to get there by relying on hardcoded CUDA kernels for many things, so Flux is trying to get “the hardcoded performance” but without relying on hardcoded kernels.

---

<div class="post-metadata">

### Author: ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)
#### Post date: [January 3, 2020, 4:57pm UTC](https://discourse.julialang.org/t/flux-vs-tensorflow-training-performance-comparison/32926/3 "2020-01-03T16:57:03Z")

</div>

Thanks for the reply.

---

<div class="post-metadata">

### Author: ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)
#### Post date: [January 3, 2020, 6:23pm UTC](https://discourse.julialang.org/t/flux-vs-tensorflow-training-performance-comparison/32926/4 "2020-01-03T18:23:57Z")

</div>

I did some a while ago that can be found here:  
[https://github.com/oxinabox/oxinabox.github.io/blob/master/\_drafts/JuliaDeepLearningMeetupLondon2019/Regression%20Demo.ipynb](https://github.com/oxinabox/oxinabox.github.io/blob/master/_drafts/JuliaDeepLearningMeetupLondon2019/Regression%20Demo.ipynb)  
[https://github.com/oxinabox/oxinabox.github.io/blob/master/\_drafts/JuliaDeepLearningMeetupLondon2019/Classification%20Demo%20--%20Am%20I%20dressed%3F.ipynb](https://github.com/oxinabox/oxinabox.github.io/blob/master/_drafts/JuliaDeepLearningMeetupLondon2019/Classification%20Demo%20--%20Am%20I%20dressed%3F.ipynb)

also compares several non-deep learning libraries

---

<div class="post-metadata">

### Author: ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)
#### Post date: [January 3, 2020, 7:25pm UTC](https://discourse.julialang.org/t/flux-vs-tensorflow-training-performance-comparison/32926/5 "2020-01-03T19:25:13Z")

</div>

Keep in mind that Flux recent underwent a major change in back-end to Zygote.jl. I believe the first of @ChrisRackauckas’s posts was after the Zygote transition, but the others look like they come from before (correct me if I’m wrong).

It’s encouraging to see that the Flux performance is competitive, I know there had been significant concern about that in the past.

---

<div class="post-metadata">

### Author: ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)
#### Post date: [January 3, 2020, 7:38pm UTC](https://discourse.julialang.org/t/flux-vs-tensorflow-training-performance-comparison/32926/6 "2020-01-03T19:38:24Z")

</div>

> [@ExpandingMan](#):
>
> others look like they come from before (correct me if I’m wrong).

Yeah, mine were from before
