An implantable device for controllably applying a neural stimulus, the device comprising: a plurality of electrodes including one or more nominal stimulus electrodes and one or more nominal sense electrodes ; a stimulus source for providing a stimulus to be delivered from the one or more stimulus electrodes (2.4) to a neural pathway in order to give rise to an evoked action potential on the neural pathway; measurement circuitry for recording a neural compound action potential signal sensed at the one or more sense electrodes ; and a control unit configured to: control application of a neural stimulus as defined by at least one stimulus parameter; measure via the measurement circuitry a neural compound action potential response evoked by the stimulus; determine from the measured evoked response a feedback variable; complete a feedback loop by using the feedback variable to control a value of the at least one stimulus parameter; and adaptively compensate for changes in a gain of the feedback loop caused by electrode movement relative to the neural pathway, by applying a compensating transfer function to the feedback variable, the compensating transfer function being configured to compensate for both (i) a distance-dependent transfer function of stimulation and (ii) a distance dependent transfer function of measurement which is distinct from (i). a plurality of electrodes including one or more nominal stimulus electrodes and one or more nominal sense electrodes ; a stimulus source for providing a stimulus to be delivered from the one or more stimulus electrodes (2.4) to a neural pathway in order to give rise to an evoked action potential on the neural pathway; measurement circuitry for recording a neural compound action potential signal sensed at the one or more sense electrodes ; and a control unit configured to: control application of a neural stimulus as defined by at least one stimulus parameter; measure via the measurement circuitry a neural compound action potential response evoked by the stimulus; determine from the measured evoked response a feedback variable; complete a feedback loop by using the feedback variable to control a value of the at least one stimulus parameter; and adaptively compensate for changes in a gain of the feedback loop caused by electrode movement relative to the neural pathway, by applying a compensating transfer function to the feedback variable, the compensating transfer function being configured to compensate for both (i) a distance-dependent transfer function of stimulation and (ii) a distance dependent transfer function of measurement which is distinct from (i). control application of a neural stimulus as defined by at least one stimulus parameter; measure via the measurement circuitry a neural compound action potential response evoked by the stimulus; determine from the measured evoked response a feedback variable; complete a feedback loop by using the feedback variable to control a value of the at least one stimulus parameter; and adaptively compensate for changes in a gain of the feedback loop caused by electrode movement relative to the neural pathway, by applying a compensating transfer function to the feedback variable, the compensating transfer function being configured to compensate for both (i) a distance-dependent transfer function of stimulation and (ii) a distance dependent transfer function of measurement which is distinct from (i). <EOS>