1. A system, comprising: one or more computers; and a computer-readable storage device storing instructions that, when executed by the one or more computers, cause the one or more computers to perform operations comprising: storing data identifying a plurality of training images for a query, wherein each of the training images is classified as being in a positive group of images for the query or a negative group of images for the query according to a respective query-specific preference measure for the image; selecting a first image from either the positive group of images or the negative group of images, and applying a scoring model to the first image to determine a score for the first image; selecting a plurality of candidate images from the other group of images; applying the scoring model to each of the candidate images to determine a respective score for each candidate image, and then selecting a second image from the candidate images, the second image having a highest score; and determining that the scores for the first image and the second image fail to satisfy a criterion, wherein the criterion requires that a result of the score of the image selected from the positive group of images minus the score of the image selected from the negative group of images exceeds a threshold that is greater than zero, updating the scoring model, and storing the updated scoring model.
11. The system of claim 1 , wherein the respective query-specific preference measure for each image is derived from a number of times users select the image in response to being presented with a search result for the query that includes the image.