I discussed the idea of participating in a retirement plan at work even though on a work visa in this previous post - here
You did that, and ended up with a small chunk of money over a period of 3-6 years and are planning to go back to your home country, now what? Here are a few options.
Option 1 - Leave the 401k plan as is, then the following year withdraw your money from the plan,this would trigger a 10% penalty plus taxes. The good part is since your earned income will be much less than the previous year, your tax bracket will be lower than the previous few years, this means that not only do you pay less tax on your original contribution, you also pay less tax on the employers plus any growth. After paying the penalty plus taxes you will still end up with much more money than you would have without putting it away in the 401k.
Option 2 -Let the money be, move it to an aggressive growth path in an IRA.This is a smart thing, since you will have automatic diversification by having funds in not only your home country but also having money grow here in the US. At the age of 59 1/2 see how it has done and either remove it all at once or get a defined return back.(pay the taxes at that point - which may or may not be too high depending on the tax rates and growth)
Option 3 -Roll over the 401-k into a ROTH IRA, avoid the 10% penalty and just pay the reduced tax rate on the whole amount(since this year your income level and hence your tax rate will be much more favorable than the previous years). Let the money grow (with the same diversification benefit from before) and then remove the money TAX-FREE at retirement.
I am not a finance expert, so please don't take this as an advice, these are just my opinions and may or may not be 100% accurate, but if it was me i would probably take option 3, the ROTH IRA one and end up with much more money in the future and pay less taxes today.