10 research outputs found
Training with Mixed-Precision Floating-Point Assignments
When training deep neural networks, keeping all tensors in high precision
(e.g., 32-bit or even 16-bit floats) is often wasteful. However, keeping all
tensors in low precision (e.g., 8-bit floats) can lead to unacceptable accuracy
loss. Hence, it is important to use a precision assignment -- a mapping from
all tensors (arising in training) to precision levels (high or low) -- that
keeps most of the tensors in low precision and leads to sufficiently accurate
models. We provide a technique that explores this memory-accuracy tradeoff by
generating precision assignments for convolutional neural networks that (i) use
less memory and (ii) lead to more accurate convolutional networks at the same
time, compared to the precision assignments considered by prior work in
low-precision floating-point training. We evaluate our technique on image
classification tasks by training convolutional networks on CIFAR-10, CIFAR-100,
and ImageNet. Our method typically provides > 2x memory reduction over a
baseline precision assignment while preserving training accuracy, and gives
further reductions by trading off accuracy. Compared to other baselines which
sometimes cause training to diverge, our method provides similar or better
memory reduction while avoiding divergence.Comment: Published in TML
On Correctness of Automatic Differentiation for Non-Differentiable Functions
Differentiation lies at the core of many machine-learning algorithms, and is
well-supported by popular autodiff systems, such as TensorFlow and PyTorch.
Originally, these systems have been developed to compute derivatives of
differentiable functions, but in practice, they are commonly applied to
functions with non-differentiabilities. For instance, neural networks using
ReLU define non-differentiable functions in general, but the gradients of
losses involving those functions are computed using autodiff systems in
practice. This status quo raises a natural question: are autodiff systems
correct in any formal sense when they are applied to such non-differentiable
functions? In this paper, we provide a positive answer to this question. Using
counterexamples, we first point out flaws in often-used informal arguments,
such as: non-differentiabilities arising in deep learning do not cause any
issues because they form a measure-zero set. We then investigate a class of
functions, called PAP functions, that includes nearly all (possibly
non-differentiable) functions in deep learning nowadays. For these PAP
functions, we propose a new type of derivatives, called intensional
derivatives, and prove that these derivatives always exist and coincide with
standard derivatives for almost all inputs. We also show that these intensional
derivatives are what most autodiff systems compute or try to compute
essentially. In this way, we formally establish the correctness of autodiff
systems applied to non-differentiable functions
Differentiable Algorithm for Marginalising Changepoints
We present an algorithm for marginalising changepoints in time-series models
that assume a fixed number of unknown changepoints. Our algorithm is
differentiable with respect to its inputs, which are the values of latent
random variables other than changepoints. Also, it runs in time O(mn) where n
is the number of time steps and m the number of changepoints, an improvement
over a naive marginalisation method with O(n^m) time complexity. We derive the
algorithm by identifying quantities related to this marginalisation problem,
showing that these quantities satisfy recursive relationships, and transforming
the relationships to an algorithm via dynamic programming. Since our algorithm
is differentiable, it can be applied to convert a model non-differentiable due
to changepoints to a differentiable one, so that the resulting models can be
analysed using gradient-based inference or learning techniques. We empirically
show the effectiveness of our algorithm in this application by tackling the
posterior inference problem on synthetic and real-world data.Comment: To appear at AAAI 202
Smoothness Analysis for Probabilistic Programs with Application to Optimised Variational Inference
International audienceWe present a static analysis for discovering differentiable or more generally smooth parts of a given probabilistic program, and show how the analysis can be used to improve the pathwise gradient estimator, one of the most popular methods for posterior inference and model learning. Our improvement increases the scope of the estimator from differentiable models to non-differentiable ones without requiring manual intervention of the user; the improved estimator automatically identifies differentiable parts of a given probabilistic program using our static analysis, and applies the pathwise gradient estimator to the identified parts while using a more general but less efficient estimator, called score estimator, for the rest of the program. Our analysis has a surprisingly subtle soundness argument, partly due to the misbehaviours of some target smoothness properties when viewed from the perspective of program analysis designers. For instance, some smoothness properties, such as partial differentiability and partial continuity, are not preserved by function composition, and this makes it difficult to analyse sequential composition soundly without heavily sacrificing precision. We formulate five assumptions on a target smoothness property, prove the soundness of our analysis under those assumptions, and show that our leading examples satisfy these assumptions. We also show that by using information from our analysis instantiated for differentiability, our improved gradient estimator satisfies an important differentiability requirement and thus computes the correct estimate on average (i.e., returns an unbiased estimate) under a regularity condition. Our experiments with representative probabilistic programs in the Pyro language show that our static analysis is capable of identifying smooth parts of those programs accurately, and making our improved pathwise gradient estimator exploit all the opportunities for high performance in those programs. CCS Concepts: • Software and its engineering → Correctness; Automated static analysis; • Mathematics of computing → Bayesian computation; Variational methods
On Correctness of Automatic Differentiation for Non-Differentiable Functions
International audienceDifferentiation lies at the core of many machine-learning algorithms, and is wellsupported by popular autodiff systems, such as TensorFlow and PyTorch. Originally, these systems have been developed to compute derivatives of differentiable functions, but in practice, they are commonly applied to functions with non-differentiabilities. For instance, neural networks using ReLU define nondifferentiable functions in general, but the gradients of losses involving those functions are computed using autodiff systems in practice. This status quo raises a natural question: are autodiff systems correct in any formal sense when they are applied to such non-differentiable functions? In this paper, we provide a positive answer to this question. Using counterexamples, we first point out flaws in oftenused informal arguments, such as: non-differentiabilities arising in deep learning do not cause any issues because they form a measure-zero set. We then investigate a class of functions, called PAP functions, that includes nearly all (possibly nondifferentiable) functions in deep learning nowadays. For these PAP functions, we propose a new type of derivatives, called intensional derivatives, and prove that these derivatives always exist and coincide with standard derivatives for almost all inputs. We also show that these intensional derivatives are what most autodiff systems compute or try to compute essentially. In this way, we formally establish the correctness of autodiff systems applied to non-differentiable functions
Towards Verified Stochastic Variational Inference for Probabilistic Programs
International audienceProbabilistic programming is the idea of writing models from statistics and machine learning using program notations and reasoning about these models using generic inference engines. Recently its combination with deep learning has been explored intensely, which led to the development of so called deep probabilistic programming languages, such as Pyro, Edward and ProbTorch. At the core of this development lie inference engines based on stochastic variational inference algorithms. When asked to find information about the posterior distribution of a model written in such a language, these algorithms convert this posterior-inference query into an optimisation problem and solve it approximately by a form of gradient ascent or descent. In this paper, we analyse one of the most fundamental and versatile variational inference algorithms, called score estimator or REINFORCE, using tools from denotational semantics and program analysis. We formally express what this algorithm does on models denoted by programs, and expose implicit assumptions made by the algorithm on the models. The violation of these assumptions may lead to an undefined optimisation objective or the loss of convergence guarantee of the optimisation process. We then describe rules for proving these assumptions, which can be automated by static program analyses. Some of our rules use nontrivial facts from continuous mathematics, and let us replace requirements about integrals in the assumptions, such as integrability of functions defined in terms of programs' denotations, by conditions involving differentiation or boundedness, which are much easier to prove automatically (and manually). Following our general methodology, we have developed a static program analysis for the Pyro programming language that aims at discharging the assumption about what we call model-guide support match. Our analysis is applied to the eight representative model-guide pairs from the Pyro webpage, which include sophisticated neural network models such as AIR. It finds a bug in one of these cases, reveals a non-standard use of an inference engine in another, and shows that the assumptions are met in the remaining six cases
Adsorption Characteristics of Phosphate Ions by Pristine, CaCl2 and FeCl3-Activated Biochars Originated from Tangerine Peels
This study has evaluated the removal efficiencies of phosphate ions (PO43−) using pristine (TB) and chemical-activated tangerine peel biochars. The adsorption kinetics and isotherm presented that the enhanced physicochemical properties of TB surface through the chemical activation with CaCl2 (CTB) and FeCl3 (FTB) were helpful in the adsorption capacities of PO43− (equilibrium adsorption capacity: FTB (1.655 mg g−1) > CTB (0.354 mg g−1) > TB (0.104 mg g−1)). The adsorption kinetics results revealed that PO43− removal by TB, CTB, and FTB was well fitted with the pseudo-second-order model (R2 = 0.999) than the pseudo-first-order model (R2 ≥ 0.929). The adsorption isotherm models showed that the Freundlich equation was suitable for PO43− removal by TB (R2 = 0.975) and CTB (R2 = 0.955). In contrast, the Langmuir equation was proper for PO43− removal by FTB (R2 = 0.987). The PO43− removal efficiency of CTB and FTB decreased with the ionic strength increased due to the compression of the electrical double layer on the CTB and FTB surfaces. Besides, the PO43− adsorptions by TB, CTB, and FTB were spontaneous endothermic reactions. These findings demonstrated FTB was the most promising method for removing PO43− in waters