Underground duct banks carrying power cables dissipate heat to the surrounding soil. The amount of heat dissipated determines the current rating of cables, which in turn affects the sizing of the cables. The dissipation of heat through the surrounding soils happens through conduction and convection. The mode of heat transfer depends on the soil’s thermal and hydraulic properties like diffusivity and permeability. The soil surrounding the cables could be designed to have maximum heat dissipation to have an improved current rating of cables. Differentiable programming is a novel technique that combines automatic differentiation with gradient-based optimization to minimize a loss function. Hence, differentiable programming can be used to evaluate input parameters based on output results. Given a desired heat distribution in the soil and a temperature source, we use differentiable programming to solve the inverse problem of estimating the soil permeability. In the present study, we employ differentiable programming to optimize the design of the buried duck bank and the backfill soil to improve heat dissipation. The design involves optimizing the permeability and size of the fill material compared to the surrounding natural soil. To implement automatic differentiation, we develop an inverse finite difference code in the Julia programming language and ForwardDiff package. We demonstrate the design capabilities of the differentiable programming technique to obtain the optimum permeability of the backfill material from the norm of the temperature distribution in the surrounding soil.