1. A method of fast neural network training for library-based critical dimension (CD) metrology for a grating structure, the method comprising: providing a training target for a first neural network; training the first neural network, the training of the first neural network including use of a validation data set, the training comprising starting with a first number of neurons and iteratively increasing the number of neurons until the training target is reached using a second, larger, number of neurons, wherein the training of the first neural network includes stopping iterations for the training of the first neural network upon the occurrence of the following: a value of a computational cost function for the training of the first neural network is less than a predetermined value, the value of the computational cost function is not reduced by a predetermined percentage for a certain number of consecutive iterations, or an error of the validation data increases for a predetermined number of iterations; generating a second neural network based on the training and the second number of neurons; providing a spectral library based on the second neural network, the spectral library including a simulated spectrum for the grating structure; and comparing the simulated spectrum to a sample spectrum for the grating structure.