You only get to withdraw your personal contributions, right? Not the employer contributions?

If that's the case, it's usually worthwhile to leave it in. I have a net present value spreadsheet for my federal pension, that first calculates what it will pay me at age 62 (which is easy because it's just years of service times 1% of high 3, with no inflation adjustment), and then depreciates that value backwards in time to see what today's value of that future payment would be.

Instead of using the compounding rate of a total stock fund to do that depreciation, as you suggested, I have used the compounding rate of the G-fund. The G fund is where those dollars are actually located, and it has a near zero risk profile and a correspondingly lower compounding rate. You also need to assume a SWR that the pension fund uses to pay people (which is probably at least 6% for the federal retiree system, based on population averages).

So for example, if your high-3 was 100k and you worked exactly 6 years and are 33 years old, then you would receive 6k/year of pension starting in 29 more years. So you need to figure out the NPV of 6k/yr starting in 29 years. If they're paying out 6% per year then 6k/yr is worth 100k of total account value when they start paying it. Then you depreciate that 100k by the G fund rate of ~2%/yr for 29 years to get a Net Present Value, suggesting it is worth about $56k today.

Those numbers change dramatically, of course, if you can reliably put those funds somewhere that does better than 2%/yr the gov gets on the G-fund. If you were confident you could get 9% per year for the next 29 years, then you would only need $8,200 today to reach 100k in 29 years to generate the same payout, so your pension's NPV today would only be $8,200.

If you count your employer contributions, the real value of your pension today is probably closer to 56k than 8.2k. This is just a matter of recreating the same accounting process that the federal government is already using to calculate pension payments. In your shoes, I would leave it in and just hope inflation stays low.