The virtue bubble has not only peaked; it is starting to deflate.

For the last few years, the ESG movement has affected both how people invest and what they buy. Now the acronym (it stands for environmental, social and governance) is becoming a “dirty word.” Companies are scrubbing it from their websites, and CEOs are no longer mentioning it in their speeches. And if there is an acronym that sparks even stronger feelings than ESG, it is DEI (which stands for diversity, equity and inclusion, and is part of the S and G in ESG). Depending on your view, DEI is either a cure for America’s structural racism or proof that the fight against it has gone too far. In either case, its power is also fading; firms facing narrowing profit margins are cutting jobs in DEI departments.

In many ways the economics of these acronyms never made much sense. The ESG investment thesis promised almost all upside and no downside — and once the costs became apparent, it became much less compelling. For evidence that DEI is a bubble, look no further than Bill Ackman’s attack of it: As my Bloomberg Opinion colleague Beth Kowitt notes, short sellers make their living by popping bubbles.

At the same time, almost every bubble starts as something worthwhile. If the question is how to preserve what was valuable about ESG and DEI in the first place, then the answer may lie in how these initiatives evolve over the next few years. Do they merely try to rebrand themselves? Or do their supporters take a hard look at their objectives and adjust?

What’s certain is that virtue has become a major industry in the last decade. Investments in sustainable assets grew from $22.8 trillion in 2016 to $35.3 trillion in 2020, but fell to $30.3 trillion in 2022. The DEI industry is worth as much at $9 billion.

But while the intentions of DEI and ESG are noble — a cleaner environment, schools and workplaces free from discrimination — the execution was problematic. Whether a company is complying with ESG standards, and thereby worthy of inclusion in a ESG investment fund, is more a value judgment than an objective assessment. Putting DEI into practice, meanwhile, led to situations like candidates for academic jobs being required to express support for ideas and strategies they might not agree with.

This doctrinaire approach alienated many people, and opposition arose in political and legal channels. Laws in some states now prohibit the use of DEI considerations in government jobs, for example, and some public pension plans are restricted from investing in ESG funds.

There is another reason the ESG and DEI bubbles are bursting: The economic case for them was never strong. Investors were promised ESG funds that would produce higher returns by avoiding certain investments, but they haven’t always outperformed the market.

ESG funds performed well in their first decade, but that was mostly because they were heavily weighted toward a few technology firms. They underperformed compared to the S&P 500 in 2022. Considering this is an investment for the very long term, it is a risky bet. How a fund performs in a down market is the true test of its value. If investors are looking for a fund with a high beta there are cheaper and better ways to find it.

The promise of DEI was that a more diverse and representative workforce would bring better outcomes, because it was also supposed to bring fresh insights and good judgment. But in several sectors the “diversity dividend” has proved elusive, and in academia DEI efforts often result not in a variety of viewpoints but in intellectual conformity.

The way these initiatives were practiced, they essentially created new constraints in investing and hiring decisions. And it is a basic law of optimization that the more constraints you impose, the smaller the output you get.

The question is, what comes next? The virtue bubble may have popped, but it will not disappear entirely — the virtue industry is just too large and too ingrained. And DEI and ESG are not without public support. Polls show people like DEI, for example, just not in their own workplace. The disconnect may be due to the difference between intentions and execution.

Parts of the virtue economy will surely be rebranded. Other parts will probably shrink. ESG funds may become a niche product, a box that you check at the end of your 401(k) investment menu, while DEI programs become part of those online HR training modules no one really pays attention to.

They could also be reformed — but this would mean accepting the idea that imposing constraints doesn’t increase outputs. For ESG investing, maybe this means more funds that focus on climate solutions, instead of promising to avoid certain companies. That will be riskier, since the investment horizon is longer and more uncertain, but they may also offer more potential upside, and they can be balanced with more traditional assets to suit an individual investor’s needs and values. For DEI, that may mean reframing it not as a restriction on who can be hired, but as an affirmative plan to discover and cultivate talent from people of underprivileged backgrounds.

None of this will be easy. But as we’ve learned, in markets there is no free lunch. Good ideas don’t create value if they’re not executed well — and that means being honest about the trade-offs even the best ideas require.

Allison Schrager is a Bloomberg Opinion columnist covering economics. A senior fellow at the Manhattan Institute, she is author of “An Economist Walks Into a Brothel: And Other Unexpected Places to Understand Risk.”