Objective. The visual perception provided by retinal prostheses is limited by the overlapping current spread of adjacent electrodes. This reduces the spatial resolution attainable with unipolar stimulation. Conversely, simultaneous multipolar stimulation guided by the measured neural responses—neural activity shaping (NAS)—can attenuate excessive spread of excitation allowing for more precise control over the pattern of neural activation. However, defining effective multipolar stimulus patterns is a challenging task. Previous attempts focused on analytical solutions based on an assumed linear nonlinear model of retinal response; an analytical model inversion (AMI) approach. Here, we propose a model-free solution for NAS, using artificial neural networks (ANNs) that could be trained with data acquired from the implant. Approach. Our method consists of two ANNs trained sequentially. The measurement predictor network (MPN) is trained on data from the implant and is used to predict how the retina responds to multipolar stimulation. The stimulus generator network is trained on a large dataset of natural images and uses the trained MPN to determine efficient multipolar stimulus patterns by learning its inverse model. We validate our method in silico using a realistic model of retinal response to multipolar stimulation. Main results. We show that our ANN-based NAS approach produces sharper retinal activations than the conventional unipolar stimulation strategy. As a theoretical bench-mark of optimal NAS results, we implemented AMI stimulation by inverting the model used to simulate the retina. Our ANN strategy produced equivalent results to AMI, while not being restricted to any specific type of retina model and being three orders of magnitude more computationally efficient. Significance. Our novel protocol provides a method for efficient and personalized retinal stimulation, which may improve the visual experience and quality of life of retinal prosthesis users.