Tuesday, September 23, 2008

Why the banks collapsed, and how a paper on Haskell programming can help stop it happening next time

Trading Risk

The financial system exists to trade three kinds of thing: money, commodities and risk. Money and commodities are the easy bit. Either I have £1,000 or I don't. Similarly with commodities: either I have a barrel of oil or I don't. But risk is a very different matter. In theory risk is easy to quantify: just multiply the probability of something by the cost, and you have the expected loss. But in practice its not so simple because the probability and cost may be difficult to quantify, especially for rare events (like, say, a global credit crunch). Many of the factors that go into a risk model are subjective, so honest people can have genuine disagreements about exactly what the risk is.

The Slippery Slope

Unfortunately risk assessment is not value-neutral. Risk has negative value: you have to pay people to take it off you. The higher the risk, the more you have to pay. And because the amount of risk is always debatable this is a very slippery slope; the people paying others to take the risk away have every incentive to present a lower estimate. Everyone can see that everyone else is doing the same, and so methods of hiding or downplaying risk migrate from dodgy dealing to open secret to standard practice.

Specific examples abound throughout the recent history of the finance industry;
  • The retail mortgage houses that originally lent to "sub-prime" clients would hire valuers who were known to be on the generous side with their valuations. So any valuer who wasn't so generous found their income drying up. Background checks on clients were cut back, then eliminated. Eventually borrowers were simply told what income to claim on the forms, regardless of what they actually earned.
  • These loans were then bundled up and sold. The idea was that the buyers would each get a share of the incoming loan repayments. Rights to this stream of money were divided into "tranches", the idea being that, for instance, Tranche 1 would get the first 34% of whatever money was due, Tranche 2 would get the next 33%, and Tranche 3 would get the last 33%. When some borrowers defaulted (as some always do), Tranche 3 would lose out first, then Tranche 2. Tranche 1 would only fail to get all their money if the overall repayment rate fell below 34%, which had never happened. The game here was to persuade a credit rating agency that Tranche 1 was so safe that it was worthy of a "Triple A" rating, because that meant that banks, insurance companies and similar big financial institutions could legally buy this debt without having to put cash aside to cover potential losses. The rating agencies earned fees for evaluating securities, so just like the house valuers they found it paid to be on the generous side.
  • All these institutions had risk management departments who were supposed to watch out for excessively risky behaviour. But in practice they found it very difficult to blow the whistle. Risk managers tell stories of being given two days to review a deal that took ten people a month to negotiate, and of accusations of "not being a team player" when they questioned over-optimistic claims. This story from the New York Times has some details. Look through the comments after the story as well; many of them are by people with their own tales of risk.
None of this is new; similar behaviour has contributed to past financial crises. In theory more regulation can prevent this, and everyone is now planning or demanding lots more regulation (even the banks). But in practice regulation has failed repeatedly because the regulators always concentrate on the way it went wrong last time. Regulations have to be written carefully, and the companies being regulated have to be given time to understand changes and put their compliance mechanisms in place. This prevents regulators from moving as fast as the institutions they regulate.

The regulators also don't have visibility of the information they need to assess systemic risk. Systemic risk arises because financial companies are exposed to each other; if one institution fails, others have to write off any money it owed them, possibly pushing them into bankruptcy as well. Regulators try to make companies insulate themselves by avoiding excessive risk and keeping some cash on hand, but without a clear picture of the risks being run by each company they have no way to tell if this is enough.

The basic problem, I believe, is the food chain of risk management within each institution. At the top are the negotiators and fund managers who design and package the securities. Then the lawyers are bought in to specify the precise terms of the deal. Somewhere along the way the "quants" will be asked to develop mathematical models, and at the bottom coders will be given the job of turning the models into executable code that will actually determine the real price and risks. It is this food chain that needs to be rethought, because its hiding important information.

This 2000 paper by Simon Peyton Jones, Jean-Marc Eber and Julian Seward shows a way forwards. It describes a Domain Specific Language embedded in Haskell for describing the rights and obligations imposed by a contract. Arbitrarily complicated contracts can be built up using a small collection of primitives. Aggregations of these contracts can also be created, as can risks of default and bankruptcy. This created quite a stir in the quantitative analysis world when it was presented, as it was the first time anyone had proposed a formal language for describing contracts. Today the list of commercial Haskell users includes a number of financial institutions using this kind of technique to model their market positions.

But on its own this is just a faster and more efficient way of getting the same wrong answer. It doesn't solve the underlying problem of concealed systemic risk. The solution has to be for big financial companies to reveal their positions to the regulators as formal models of the contracts they have written. At the moment they don't even have to reveal all their contracts, but merely knowing the legal terms of a contract is only the first step. Those terms have to be converted into a mathematical model. That model probably already exists, but only as an internal artefact of the parties to the contract. What ought to be happening is that the contract is specified in a well-defined mathematical language that can be converted into a model automatically. If the regulators have this information about all the contracts entered into by all the finance companies then they can model the impact of, say, a downturn in the housing market or a jump in the price of oil, and if they see systemic risk looming then they can order the companies involved to take corrective action. Unlike the various Risk Management departments they will be able to see the whole picture, and they don't have to worry about being "team players".

12 comments:

Anonymous said...

I think this is genuinely interesting and very technocratic. However, I think the finance world is too big to regulate efficiently and instead it would be best to manage incentives rather than try to model risk for an entire industry. Nonetheless, everyone should be using Haskell more. It could really save the world :D

Anonymous said...

I agree with the first commenter: this is a very interesting (from a theory/tech point of view), but very technocratic. The value in these sorts of technologies is, as you say, detecting these sorts of "bottom valued" constructions, where a single mis-step will make the whole thing crash and burn. But tying any regulatory oversight to any particular formalism is just giving them another target.

Shifting the goal posts so the companies find ways to lie to a regulator with honest mistakes in formal languages probably won't fix the problem -- the incentives are still there and (if it works anything like most other areas of corporate regulation in the US) the disincentives will likely be pitifully inadequate for the purpose of deterrence. I doubt that I will every be dissuaded from my belief that the solution to these sorts of problems is broad regulatory power backed with enormous personal fines and jail terms for traders, managers, executives, and others who are culpable or ought to have an obligation to prevent it (along with regulations to prevent the corps from paying fines, etc. for them).

On the "pro" side, any move like this would buoy the market for type theorists and the like.

falcon said...

The contracts paper is indeed very interesting, but I don't think it would've helped in the current crisis. The paper does talk about doing risk valuations, but financial firms already measure risk. Their risk models can be fairly simple (historical VaR) to quite complex, requiring teams of PhDs. If the the computer is given wrong assumptions about correlations, probability distributions, liquidity, the result will be wrong as well. Garbage in, garbage out.

The paper is still awesome, it just won't save the world :)

Paul Johnson said...

Yes, this is indeed a technocratic solution. Finance is technocratic by nature. A pure "free market" won't work, but on the other hand having politicians run the banks won't work either (they will simply "lend" money to uncompetitive companies that happen to employ lots of voters). So you need to let the banks look for the profit on one hand, but keep a tight rein on their risk-taking on the other. The problem is how to give the regulators the necessary visibility into what the banks are actually doing.

phubaba said...

I think one of the biggest things you are missing is that many of these contracts events or contracts are nearly possible to model by hand. Clearly spelling them out and putting them into a computer to automatically automate is a much larger problem. In many cases the only way to model things is by making assumptions to bring the state space down to something that can be mathematically understood. The issue is really how these assumptions are used to either push a model in the wrong or right way. In the case of the mortgages, the assumption was simply that prices would continue up. If you had put this into a computer, it would have had the same effect as if a human decided it. It almost seems like you are proposing a system that can automatically detect new problems with contracts before those problems happen.

Although interesting, I don't think Haskell is the solution to this problem. The solution is to somehow regulate coporate greed. (AND actually attempt to model some of the crazy assumptions they come up with).

This isn't the only time that assumptions have caused people to lose a lot of money, and it won't be the last. No amount of modeling will ever fix this problem

Paul Johnson said...

The issue is really how these assumptions are used to either push a model in the wrong or right way.

Thats why I want the global model to be owned by the regulators, not the banks. The banks would be required to disclose their contracts in a computer-readable form, but its up to the regulator to put all those contracts together into the model.

Robin said...

You start off by pointing out that lying about mortgage applications was a factor, but your proposed solution does not explicitly address this epidemic of lying. If companies lie to the government about their client's incomes, no amount of bogus models will allow the government to correctly model what's going on.

Clearly, any solution needs to involve enforcing existing laws against fraud (and mis-selling) far more vigorously.

Anonymous said...

"Thats why I want the global model to be owned by the regulators, not the banks"

The current crisis does not exist solely because of fraud. There is an argument that we simply don't understand how to model many of the financial instruments. Buffet has warned about them, Mandelbrot (of fractals fame) has warned about the underlying mathematics and Taleb is now known for explaining how we underestimate risk.

Taleb and Mandelbrot argue that we don't even know how to accurately describe the movement of simple stock prices (not predict them, just statistically and accurately describe them).

Besides, regulators already audit risk models of depository banks. Doesn't help much when the underlying models underestimate risk.

Anonymous said...

Credit Default Swaps issued by highly leveraged operators among themselves is semantic nonsense.

If Haskell could be used to demonstrate that this system is nothing but a house of cards, then the government has no choice but to pay attention and regulate, or firewall this sector from the rest of the economy.

However, I doubt such assessments of value can come from a pure specification, without some subjective assignment of what real-world values actually are.

s9 said...

This is a revolutionary idea. That's why it will require a revolution to implement it.

Anonymous said...

Regulations are programs for an open system: therefore completely insane, conceptually incommensurate with reality, etc.

We don't need more laws (ditto programs for open systems), we need only a few, all variations on "Seller beware, you have the responsibility to provide the buyer with all of the information they need to make a good decision, to do it in a way they can understand, and to check that they in fact did understand it." and "size of the liability / responsibility is proportional to the size of the possible loss by the buyer".

That would lower the influence of lawyers and lower the cost of doing business, at least for honest businesses, thereby giving them an advantage.

Jon Harrop said...

LexiFi sell a commercial implementation of this written in OCaml.