Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-place modify layers and rewrite ZBoxRule to use VJP #73

Merged
merged 7 commits into from
Jun 28, 2022

Conversation

adrhill
Copy link
Member

@adrhill adrhill commented Jun 28, 2022

Changes:

  • Introduces a new parameter-resetting mechanism by capturing initial parameters in a closure:
    reset! = get_layer_resetter(rule, layer)
    modify_layer!(rule, layer)
    reset!() 
  • In-place updating modify_layer!(rule, layer) replaces modify_layer(rule, layer)
  • In-place updating modify_param!(rule, param) replaces modify_params(rule, W, b)
  • Introduces modify_input(rule, input) in preparation of future rule implementations
  • Update ZBoxRule implementation to use VJP via Zygote.pullback
  • Update ZBoxRule references

Also updates tests and docs to match changes.
These are breaking changes, so the next release will be tagged v0.5.0.

@adrhill adrhill added the run benchmark Run benchmark CI action label Jun 28, 2022
@github-actions
Copy link

Benchmark result

Judge result

Benchmark Report for /home/runner/work/ExplainableAI.jl/ExplainableAI.jl

Job Properties

  • Time of benchmarks:
    • Target: 28 Jun 2022 - 17:58
    • Baseline: 28 Jun 2022 - 18:03
  • Package commits:
    • Target: 26f6e1
    • Baseline: 02a4bb
  • Julia commits:
    • Target: 742b9a
    • Baseline: 742b9a
  • Julia command flags:
    • Target: None
    • Baseline: None
  • Environment variables:
    • Target: None
    • Baseline: None

Results

A ratio greater than 1.0 denotes a possible regression (marked with ❌), while a ratio less
than 1.0 denotes a possible improvement (marked with ✅). Only significant results - results
that indicate possible regressions or improvements - are shown below (thus, an empty table means that all
benchmark results remained invariant between builds).

ID time ratio memory ratio
["Layer", "Conv", "ZBoxRule"] 0.32 (5%) ✅ 0.31 (1%) ✅
["Layer", "Dense", "EpsilonRule"] 1.53 (5%) ❌ 136.23 (1%) ❌
["Layer", "Dense", "GammaRule"] 2.07 (5%) ❌ 1.00 (1%)
["Layer", "Dense", "ZBoxRule"] 0.34 (5%) ✅ 0.39 (1%) ✅
["Layer", "WrappedDense", "EpsilonRule"] 1.51 (5%) ❌ 1.98 (1%) ❌
["Layer", "WrappedDense", "GammaRule"] 1.37 (5%) ❌ 1.00 (1%)
["Layer", "WrappedDense", "ZBoxRule"] 0.34 (5%) ✅ 0.39 (1%) ✅
["VGG", "Gradient", "construct analyzer"] 0.85 (5%) ✅ 1.00 (1%)
["VGG", "InputTimesGradient", "analyze"] 0.07 (5%) ✅ 0.63 (1%) ✅
["VGG", "InputTimesGradient", "construct analyzer"] 1.16 (5%) ❌ 1.00 (1%)
["VGG", "IntegratedGradients", "construct analyzer"] 0.79 (5%) ✅ 1.00 (1%)
["VGG", "LRPCustom", "analyze"] 0.45 (5%) ✅ 0.82 (1%) ✅
["VGG", "LRPZero", "construct analyzer"] 1.13 (5%) ❌ 1.00 (1%)
["VGG", "SmoothGrad", "analyze"] 0.88 (5%) ✅ 0.97 (1%) ✅
["VGG", "SmoothGrad", "construct analyzer"] 1.20 (5%) ❌ 1.00 (1%)

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["Layer", "Conv"]
  • ["Layer", "Dense"]
  • ["Layer", "MaxPool"]
  • ["Layer", "WrappedDense"]
  • ["VGG", "Gradient"]
  • ["VGG", "InputTimesGradient"]
  • ["VGG", "IntegratedGradients"]
  • ["VGG", "LRPCustom"]
  • ["VGG", "LRPZero"]
  • ["VGG", "SmoothGrad"]

Julia versioninfo

Target

Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 20.04.4 LTS
  uname: Linux 5.13.0-1031-azure #37~20.04.1-Ubuntu SMP Mon Jun 13 22:51:01 UTC 2022 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2593 MHz       5743 s          0 s        501 s       1806 s          0 s
       #2  2593 MHz       2608 s          0 s        458 s       4977 s          0 s
       
  Memory: 6.783607482910156 GB (1809.3046875 MB free)
  Uptime: 808.95 sec
  Load Avg:  1.16  1.25  0.83
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake-avx512)

Baseline

Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 20.04.4 LTS
  uname: Linux 5.13.0-1031-azure #37~20.04.1-Ubuntu SMP Mon Jun 13 22:51:01 UTC 2022 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2593 MHz       8101 s          0 s        571 s       1958 s          0 s
       #2  2593 MHz       3021 s          0 s        555 s       7041 s          0 s
       
  Memory: 6.783607482910156 GB (2384.5625 MB free)
  Uptime: 1067.04 sec
  Load Avg:  1.12  1.2  0.92
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake-avx512)

Target result

Benchmark Report for /home/runner/work/ExplainableAI.jl/ExplainableAI.jl

Job Properties

  • Time of benchmark: 28 Jun 2022 - 17:58
  • Package commit: 26f6e1
  • Julia commit: 742b9a
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["Layer", "Conv", "EpsilonRule"] 664.109 μs (5%) 1.36 MiB (1%) 137
["Layer", "Conv", "GammaRule"] 665.110 μs (5%) 1.36 MiB (1%) 143
["Layer", "Conv", "ZBoxRule"] 659.710 μs (5%) 1.36 MiB (1%) 137
["Layer", "Conv", "ZeroRule"] 658.509 μs (5%) 1.36 MiB (1%) 131
["Layer", "Dense", "EpsilonRule"] 63.401 μs (5%) 197.95 KiB (1%) 10
["Layer", "Dense", "GammaRule"] 153.902 μs (5%) 589.64 KiB (1%) 16
["Layer", "Dense", "ZBoxRule"] 121.501 μs (5%) 397.42 KiB (1%) 30
["Layer", "Dense", "ZeroRule"] 40.001 μs (5%) 1.45 KiB (1%) 3
["Layer", "MaxPool", "EpsilonRule"] 65.801 μs (5%) 65.55 KiB (1%) 30
["Layer", "MaxPool", "GammaRule"] 66.501 μs (5%) 65.55 KiB (1%) 30
["Layer", "MaxPool", "ZBoxRule"] 66.001 μs (5%) 65.55 KiB (1%) 30
["Layer", "MaxPool", "ZeroRule"] 65.601 μs (5%) 65.55 KiB (1%) 30
["Layer", "WrappedDense", "EpsilonRule"] 124.602 μs (5%) 397.64 KiB (1%) 36
["Layer", "WrappedDense", "GammaRule"] 216.503 μs (5%) 789.33 KiB (1%) 42
["Layer", "WrappedDense", "ZBoxRule"] 122.301 μs (5%) 397.42 KiB (1%) 30
["Layer", "WrappedDense", "ZeroRule"] 91.301 μs (5%) 201.14 KiB (1%) 29
["VGG", "Gradient", "analyze"] 1.197 s (5%) 13.404 ms 1.10 GiB (1%) 2012
["VGG", "Gradient", "construct analyzer"] 13.801 μs (5%) 26.66 KiB (1%) 189
["VGG", "InputTimesGradient", "analyze"] 1.183 s (5%) 13.211 ms 1.10 GiB (1%) 2015
["VGG", "InputTimesGradient", "construct analyzer"] 14.101 μs (5%) 26.66 KiB (1%) 189
["VGG", "IntegratedGradients", "analyze"] 10.553 s (5%) 96.657 ms 10.34 GiB (1%) 16942
["VGG", "IntegratedGradients", "construct analyzer"] 12.000 μs (5%) 24.69 KiB (1%) 187
["VGG", "LRPCustom", "analyze"] 2.471 s (5%) 91.493 ms 2.23 GiB (1%) 1966
["VGG", "LRPCustom", "construct analyzer"] 20.100 μs (5%) 45.88 KiB (1%) 159
["VGG", "LRPZero", "analyze"] 1.203 s (5%) 11.321 ms 761.54 MiB (1%) 1816
["VGG", "LRPZero", "construct analyzer"] 13.001 μs (5%) 43.88 KiB (1%) 82
["VGG", "SmoothGrad", "analyze"] 10.461 s (5%) 90.759 ms 10.33 GiB (1%) 16852
["VGG", "SmoothGrad", "construct analyzer"] 12.600 μs (5%) 24.69 KiB (1%) 187

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["Layer", "Conv"]
  • ["Layer", "Dense"]
  • ["Layer", "MaxPool"]
  • ["Layer", "WrappedDense"]
  • ["VGG", "Gradient"]
  • ["VGG", "InputTimesGradient"]
  • ["VGG", "IntegratedGradients"]
  • ["VGG", "LRPCustom"]
  • ["VGG", "LRPZero"]
  • ["VGG", "SmoothGrad"]

Julia versioninfo

Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 20.04.4 LTS
  uname: Linux 5.13.0-1031-azure #37~20.04.1-Ubuntu SMP Mon Jun 13 22:51:01 UTC 2022 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2593 MHz       5743 s          0 s        501 s       1806 s          0 s
       #2  2593 MHz       2608 s          0 s        458 s       4977 s          0 s
       
  Memory: 6.783607482910156 GB (1809.3046875 MB free)
  Uptime: 808.95 sec
  Load Avg:  1.16  1.25  0.83
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake-avx512)

Baseline result

Benchmark Report for /home/runner/work/ExplainableAI.jl/ExplainableAI.jl

Job Properties

  • Time of benchmark: 28 Jun 2022 - 18:3
  • Package commit: 02a4bb
  • Julia commit: 742b9a
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["Layer", "Conv", "EpsilonRule"] 642.809 μs (5%) 1.36 MiB (1%) 131
["Layer", "Conv", "GammaRule"] 643.110 μs (5%) 1.36 MiB (1%) 140
["Layer", "Conv", "ZBoxRule"] 2.063 ms (5%) 4.46 MiB (1%) 495
["Layer", "Conv", "ZeroRule"] 640.809 μs (5%) 1.36 MiB (1%) 131
["Layer", "Dense", "EpsilonRule"] 41.400 μs (5%) 1.45 KiB (1%) 3
["Layer", "Dense", "GammaRule"] 74.301 μs (5%) 588.98 KiB (1%) 12
["Layer", "Dense", "ZBoxRule"] 361.205 μs (5%) 1017.84 KiB (1%) 152
["Layer", "Dense", "ZeroRule"] 41.400 μs (5%) 1.45 KiB (1%) 3
["Layer", "MaxPool", "EpsilonRule"] 66.001 μs (5%) 65.55 KiB (1%) 30
["Layer", "MaxPool", "GammaRule"] 66.101 μs (5%) 65.55 KiB (1%) 30
["Layer", "MaxPool", "ZBoxRule"] 66.101 μs (5%) 65.55 KiB (1%) 30
["Layer", "MaxPool", "ZeroRule"] 66.101 μs (5%) 65.55 KiB (1%) 30
["Layer", "WrappedDense", "EpsilonRule"] 82.702 μs (5%) 200.92 KiB (1%) 23
["Layer", "WrappedDense", "GammaRule"] 158.402 μs (5%) 788.45 KiB (1%) 32
["Layer", "WrappedDense", "ZBoxRule"] 360.005 μs (5%) 1017.84 KiB (1%) 152
["Layer", "WrappedDense", "ZeroRule"] 90.402 μs (5%) 200.92 KiB (1%) 23
["VGG", "Gradient", "analyze"] 1.155 s (5%) 12.017 ms 1.10 GiB (1%) 2012
["VGG", "Gradient", "construct analyzer"] 16.200 μs (5%) 26.66 KiB (1%) 189
["VGG", "InputTimesGradient", "analyze"] 17.771 s (5%) 244.328 ms 1.74 GiB (1%) 12127070
["VGG", "InputTimesGradient", "construct analyzer"] 12.201 μs (5%) 26.66 KiB (1%) 189
["VGG", "IntegratedGradients", "analyze"] 10.327 s (5%) 147.810 ms 10.34 GiB (1%) 16942
["VGG", "IntegratedGradients", "construct analyzer"] 15.100 μs (5%) 24.69 KiB (1%) 187
["VGG", "LRPCustom", "analyze"] 5.517 s (5%) 83.418 ms 2.72 GiB (1%) 6018515
["VGG", "LRPCustom", "construct analyzer"] 19.700 μs (5%) 45.88 KiB (1%) 159
["VGG", "LRPZero", "analyze"] 1.226 s (5%) 42.555 ms 761.54 MiB (1%) 1816
["VGG", "LRPZero", "construct analyzer"] 11.500 μs (5%) 43.88 KiB (1%) 82
["VGG", "SmoothGrad", "analyze"] 11.848 s (5%) 160.633 ms 10.60 GiB (1%) 4908207
["VGG", "SmoothGrad", "construct analyzer"] 10.500 μs (5%) 24.69 KiB (1%) 187

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["Layer", "Conv"]
  • ["Layer", "Dense"]
  • ["Layer", "MaxPool"]
  • ["Layer", "WrappedDense"]
  • ["VGG", "Gradient"]
  • ["VGG", "InputTimesGradient"]
  • ["VGG", "IntegratedGradients"]
  • ["VGG", "LRPCustom"]
  • ["VGG", "LRPZero"]
  • ["VGG", "SmoothGrad"]

Julia versioninfo

Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 20.04.4 LTS
  uname: Linux 5.13.0-1031-azure #37~20.04.1-Ubuntu SMP Mon Jun 13 22:51:01 UTC 2022 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2593 MHz       8101 s          0 s        571 s       1958 s          0 s
       #2  2593 MHz       3021 s          0 s        555 s       7041 s          0 s
       
  Memory: 6.783607482910156 GB (2384.5625 MB free)
  Uptime: 1067.04 sec
  Load Avg:  1.12  1.2  0.92
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake-avx512)

Runtime information

Runtime Info
BLAS #threads 2
BLAS.vendor() openblas64
Sys.CPU_THREADS 2

lscpu output:

Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   46 bits physical, 48 bits virtual
CPU(s):                          2
On-line CPU(s) list:             0,1
Thread(s) per core:              1
Core(s) per socket:              2
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           85
Model name:                      Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
Stepping:                        7
CPU MHz:                         2593.905
BogoMIPS:                        5187.81
Hypervisor vendor:               Microsoft
Virtualization type:             full
L1d cache:                       64 KiB
L1i cache:                       64 KiB
L2 cache:                        2 MiB
L3 cache:                        35.8 MiB
NUMA node0 CPU(s):               0,1
Vulnerability Itlb multihit:     KVM: Mitigation: VMX unsupported
Vulnerability L1tf:              Mitigation; PTE Inversion
Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT Host state unknown
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Mmio stale data:   Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Retpolines, STIBP disabled, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Mitigation; Clear CPU buffers; SMT Host state unknown
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt avx512cd avx512bw avx512vl xsaveopt xsavec xsaves md_clear
Cpu Property Value
Brand Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
Vendor :Intel
Architecture :Skylake
Model Family: 0x06, Model: 0x55, Stepping: 0x07, Type: 0x00
Cores 2 physical cores, 2 logical cores (on executing CPU)
No Hyperthreading hardware capability detected
Clock Frequencies Not supported by CPU
Data Cache Level 1:3 : (32, 1024, 36608) kbytes
64 byte cache line size
Address Size 48 bits virtual, 46 bits physical
SIMD 512 bit = 64 byte max. SIMD vector size
Time Stamp Counter TSC is accessible via rdtsc
TSC increased at every clock cycle (non-invariant TSC)
Perf. Monitoring Performance Monitoring Counters (PMC) are not supported
Hypervisor Yes, Microsoft

@adrhill adrhill removed the run benchmark Run benchmark CI action label Jun 28, 2022
@adrhill adrhill merged commit e359b98 into master Jun 28, 2022
@adrhill adrhill deleted the ah/mod-params branch June 28, 2022 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant