my dog was diagnosed as well but is grade 1-2, so his knee is normally in place but slips out in jogging pace (or possibly just doesn't function well enough) and he picks up the leg. He has a stiff slow walk but seems completely normal at medium pace and running.
The vet said just to leave him since he is low grade and I started him on Glucosamine/chondroitin/msm to reduce cartilage damage. The luxation is due to a combination of weak ligaments and shallow/deformed kneecap grooves.
From my understanding it normally does not cause pain at low grades but occasionally the cap may pop all the way out and cause pain, also over time continual wear on the knee crest increases incidence of luxation and can expose bone creating pain.
Grade 4 indicates that your dog has very shallow knee grooves and the knees spend the majority of their time out of position and may not be able to correct themselves back into the groove. The situation is unlikely to correct itself as it has a strong genetic component. At grade 4 I don't see rest correcting much and the damage will probably re-occur once exercise is non-restricted due to the deformity causing stress on the ligaments.
This condition does not improve with time, and will only get worst or if you are lucky will remain about the same.
Surgery is very invasive and most things I have read suggest not having it for grade 1-2 unless there is no pain involved and the dog copes well. Grade 3-4 (or 5 depending on the grading scale being used) typically require corrective surgery.
Depending on the severity of the deformity there are combinations of techniques that will be used on the knee. Usually the groove is deepened by removing a wedge from the knee groove, inside this triangular crevice more bone may be removed and then the sliver of bone replaced (to retain the cartilage surface) the ligament holding the kneecap may also be cut away and then pinned in a way to counter the directional stress on the knee (if the knee luxates inward the ligament will be pinned outward). Some vets also incorporate strapping to the knee to maintain proper alignments.
I would recommend seeing a orthopedic surgeon or visiting your local veterinary college for a second opinion from a vet who is very familiar with the diagnosis and procedure for corrective surgery who can recommend what course of treatment you will need.
Since your dog is very small he should recovery well from surgery and typically they are back to normal within 4 weeks.
Surgery is not cheap, depending on your location it can range from 1000 to 2000 or more for both knees.
Since this is a genetic deformity (especially since your girl is a pup and displaying symptoms indicates strong genetic component) she should be spay and not allowed to reproduce and pass the condition to her pups. If you received her from a reputable breeder (unlikely) you might be able to have some costs covered under genetic deformity. Even if they won't help you, if you are in communication from the breeder you should inform them they are breeding deformed dogs and if they have any sense of responsibility they will discontinue the parents from breeding and have their stock inspected.