13. A non-transitory computer storage medium encoded with a computer program for dynamically modifying a content item on a per-request basis, the program comprising instructions that when executed by data processing apparatus cause the data processing apparatus to perform operations comprising: receiving, from a user device, a content item request that includes context data specifying (i) a set of one or more attributes of a resource on which the content item will be presented and (ii) a set of one or more attributes of a user to which the content item will be presented; in response to receiving the content item request: identifying a given content item to provide in response to the content item request; identifying a set of templates that are eligible for use in generating variations of the given content item; filtering the set of templates based on the one or more attributes of the resource on which the content item will be presented, the filtering including removing, from the set of templates, one or more templates that are not eligible for use in generating content items for presentation with resources having the one or more attributes of the resource on which the content item will be presented; determining, for each particular template from the set of templates, a contextual performance measure that indicates a performance of content items that have been provided using the particular template and in response to content item requests having context data that matches the one or more attributes of the user; selecting, from the set of templates and based on the contextual performance measure of each template in the set of templates, a template for the given content item; creating a different formatted content item by populating the selected template with content for the given content item; and providing, to the user device and for presentation with the resource, the different formatted content item in response to the content item request.
13. A non-transitory computer storage medium encoded with a computer program for dynamically modifying a content item on a per-request basis, the program comprising instructions that when executed by data processing apparatus cause the data processing apparatus to perform operations comprising: receiving, from a user device, a content item request that includes context data specifying (i) a set of one or more attributes of a resource on which the content item will be presented and (ii) a set of one or more attributes of a user to which the content item will be presented; in response to receiving the content item request: identifying a given content item to provide in response to the content item request; identifying a set of templates that are eligible for use in generating variations of the given content item; filtering the set of templates based on the one or more attributes of the resource on which the content item will be presented, the filtering including removing, from the set of templates, one or more templates that are not eligible for use in generating content items for presentation with resources having the one or more attributes of the resource on which the content item will be presented; determining, for each particular template from the set of templates, a contextual performance measure that indicates a performance of content items that have been provided using the particular template and in response to content item requests having context data that matches the one or more attributes of the user; selecting, from the set of templates and based on the contextual performance measure of each template in the set of templates, a template for the given content item; creating a different formatted content item by populating the selected template with content for the given content item; and providing, to the user device and for presentation with the resource, the different formatted content item in response to the content item request. 18. The non-transitory computer storage medium of claim 13 , wherein the contextual performance measure for the particular template is based on a combination of (i) a first performance of content items that have been provided using the particular template in response to content item requests having context data that specifies the one or more attributes of the resource on which the content item will be presented and (ii) a second performance of content items that have been provided using the particular template in response to content item requests having context data that specifies the one or more attributes of user to which the content item will be presented.