diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown
--- a/CHANGELOG.markdown
+++ b/CHANGELOG.markdown
@@ -1,3 +1,7 @@
+3.2.1
+---
+* `conjugateGradientDescent` now stops before it starts returning NaN results.
+
 3.2
 ---
 * Renamed `Chain` to `Wengert` to reflect its use of Wengert lists for reverse mode.
diff --git a/ad.cabal b/ad.cabal
--- a/ad.cabal
+++ b/ad.cabal
@@ -1,5 +1,5 @@
 name:         ad
-version:      3.2
+version:      3.2.1
 license:      BSD3
 license-File: LICENSE
 copyright:    (c) Edward Kmett 2010-2012,
diff --git a/src/Numeric/AD/Newton.hs b/src/Numeric/AD/Newton.hs
--- a/src/Numeric/AD/Newton.hs
+++ b/src/Numeric/AD/Newton.hs
@@ -121,9 +121,8 @@
 {-# INLINE gradientAscent #-}
 
 -- | Perform a conjugate gradient descent using reverse mode automatic differentiation to compute the gradient.
-conjugateGradientDescent :: (Traversable f, Fractional a, Ord a) =>
-                (forall s. Mode s => f (AD s a) -> AD s a) -> f a -> [f a]
-conjugateGradientDescent f x0 = go x0 d0 d0
+conjugateGradientDescent :: (Traversable f, Fractional a, Ord a) => (forall s. Mode s => f (AD s a) -> AD s a) -> f a -> [f a]
+conjugateGradientDescent f x0 = takeWhile (all (\a -> a == a)) (go x0 d0 d0)
   where
     dot x y = sum $ zipWithT (*) x y
     d0 = negate <$> grad f x0
@@ -133,7 +132,6 @@
         xi1 = zipWithT (\x d -> x + ai*d) xi di
         ri1 = negate <$> grad f xi1
         bi1 = max 0 $ dot ri1 (zipWithT (-) ri1 ri) / dot ri1 ri1
-        -- bi1 = max 0 $ sum (zipWithT (\a b -> a * (a - b)) ri1 ri) / dot ri1 ri1
         di1 = zipWithT (\r d -> r * bi1*d) ri1 di
 {-# INLINE conjugateGradientDescent #-}
 
