If you are AWOL or in desertion status, voluntarily return. If you know someone who is in AWOL or desertion status, try and convince them to voluntarily return to military control. The sooner the better. The longer one is absence, the more severe any punishment is likely to be. Also, punishment will be much more lenient if one voluntarily returns to military control than if one is arrested by law enforcement and involuntarily returned to the military.
Additionally, if one voluntarily returns, they are less likely to be placed in confinement while awaiting disposition of their case. If one is apprehended by civilian law enforcement, on the other hand, they will likely spend several days in a civilian jail, while awaiting for the military to make arrangements to pick them up and transport them to a military base. Upon return to military control, they would then likely be confined while waiting for the authorities to decide what to do with their case.
While you should voluntarily return as soon as possible, it's often very helpful to obtain an attorney with military law experience prior to surrendering to military control. I've seen dozens of cases where attorneys have been able to contact military authorities on behalf of the AWOL/deserter, and negotiate (sort of a "plea bargain"), what will happen with your case after your return. There are several civilian lawyers available who specialize in military law. If you can't afford a civilian attorney, contact a military defense attorney at the military base you plan to turn yourself into. They can represent you for free.
The real key to minimizing possible punishment however, is to voluntarily return to military control as soon as possible.
More About AWOL and Desertion