Union Pacific (UNP -1.82%) is in a sticky wicket.

Like so many other organizations at the time, back in 2021, the railroad recognized it didn't have enough employees to handle rekindled demand coming out of the pandemic. So, it accelerated its hiring efforts. Then last quarter's total freight tonnage fell for the second quarter in a row, reaching a two-year low as a result.

If this an omen of what's to come, it may well mean a hiring freeze is in order. Employee compensation is the railroad industry's single biggest operating expense, after all, accounting for roughly a third of most carriers' operational costs. Making the matter even more complicated is how Union Pacific is already understaffed relative to its pre-COVID-19 employment levels. The company may not even know what its optimal headcount is right now.

It's a problem for all interested parties, but it's particularly an issue for shareholders who have enjoyed watching the railroad's profit margin expand in recent years.

Shrinking its way to success

It's a very common tale. Workers are often the first to be put on the chopping block when a company is looking to lower costs. That's because employees look like they're the expense that would be missed the least. It's not typical, however, for a company to eventually realize it needs workers more than it thought it did.

This certainly seems to be the case for Union Pacific. Now-outgoing CEO Lance Fritz began a drastic reduction of the company's headcount back in 2017 when the railroad employed over 42,000 people. By early 2020, that figure had been pared back to less than 34,000. It's now less than 32,000, although that number is growing slightly again.

On the surface the job cuts made sense. Technology now facilitates longer trains taking fewer total trips, while also improving on-time percentages and optimizing the usage of rolling stock. This capability in turn reduces the need for actual workers. And, as intended, profit margin expanded the whole time the company was laying workers off even though demand for rail freight services has been shrinking for the past several years.

UNP Total Employees (Annual) Chart

UNP Total Employees (Annual) data by YCharts

Except the railroad's employee reduction efforts arguably went too far. Now that mistake looks like it's being corrected. There's the rub.

Not everything can be effectively automated

It's not a part of railroads' quarterly reports that investors typically scour, but deep in their filings many of these companies publish important efficiency measures. These metrics include the number of delivery miles the carrier is logging on a per-employee basis, as well as how many millions of tons were hauled during a particular three-month stretch.

As the graphic below illustrates, Union Pacific's car miles per employee and its gross ton-miles per employee both began rising in 2017, when layoffs started in earnest. These measures then outright soared in 2020, when the company's headcount reduction efforts turned rather indiscriminate in the wake of the pandemic. And remember, that's when profit margins took off, too.

Union Pacific's per-employee freight levels have been falling since early 2022, in step with employee growth.

Data source: Union Pacific. Chart by author.

But those wider profit margins may just not be sustainable.

That's what the per-employee metrics suggest, anyway. Both efficiency measures have been edging lower since early 2022, falling markedly faster than demand for rail freight service itself has. Yet last quarter's gross ton-miles per employee of 6.57 is still well above Union Pacific's pre-pandemic level of around 5.5. The Q1 car miles per employee of 991 is also the lowest the figure's been in three years, but that's still well above the sub-900 numbers regularly seen as recently as 2019.

Simply put, the nascent downtrend implies employees were being asked to do too much -- an argument being made by plenty of rail workers who are as concerned with safety and reliability as they are with their own compensation.

Union Pacific is off the rails until it finds its right head count

So what are the ideal car mile and gross-ton numbers for railroads these days? That's just it -- nobody seems to know. The correct levels are probably somewhere in between 2017's and 2021's extremes, but finding them could be a bit of an adventure most investors would rather not experience.

All we know for sure is that after leaning heavily on technology to better manage its rolling stock, Union Pacific now seems willing to ease back into weaker per-employee efficiency numbers even though it will assuredly crimp future profit margins. That dynamic will work against the stock's price. The fact that Lance Fritz is stepping down later this year (after pushing for the very job cuts that may have done more long-term harm than short-term good) only bolsters the stock's bearish case even though the market initially cheered the news. This isn't a company that needs any more uncertainty than it's already dealing with.

It's not a permanent problem, to be clear. Mistakes can be fixed. Operations can be improved. Other forms of cost optimization are still on the table, and new business can be won or rewon. Other factors like the cost of fuel and raw demand still impact the bottom line in the meantime.

Getting its employee count right is Union Pacific's biggest challenge right now, however. A close second is equipping its workers to operate as efficiently as possible to preserve most of the profit margin gains achieved by its past staffing cuts. The irony is the company may be ultimately better served by spending more on workers rather than less.

Bottom line? Until it's clear the railroad understands that employees are an investment in and of themselves rather than a mere expense, investors may want to consider other options. In the meantime, listen for any commentary from management regarding Union Pacific's per-employee operating metrics. They'll point to the ultimate sustainability of the company's operation and fiscal results. Less may well be more.