Contract description language

MLFi: the Modeling Language for Finance

Product innovation and increased regulatory pressure in the financial industry create a challenge for computer systems designed to support structured products. The diversity of product shapes and variants on the market and the number of operations to be performed on each of them tend to materialize in hard-to-manage software complexity, where each pair of shape and operation requires some ad hoc support. To overcome this challenge, LexiFi has created MLFi, a domain-specific computer language to describe financial products in a generic way and implements most operations on top of this formal description. The picture above illustrates the benefits of this approach:

  • Each operation, such as valuation or life-cycle processing, needs to be implemented only once, in a generic way (so that it supports an arbitrary product shape).
  • Once a product is described in MLFi (either manually for one-off products, or using some predefined product templates), all operations are readily available.
  • Moreover, as time progresses and information become available from the market (fixings, barrier or default events, etc), the MLFi product description can be updated automatically, so that all operations remains available on the residual contract.

Unlike other financial contract modeling approaches, LexiFi's award-winning formalism supports both pricing and operational management. LexiFi's ingenious pricing framework is designed to link contract definitions with in-house, third-party, and LexiFi valuation engines; to facilitate the development of risk analyses; and to reuse calculation platforms while benefiting from a unique contract description. LexiFi's robust operational management framework enables the systematic detection and processing of contract events.

Some key properties of LexiFi's contract description language:

  • An MLFi contract description defines the rights and obligations of the parties both precisely and exhaustively, and independently of any valuation methodology.
  • MLFi supports any type or combination of underlying asset(s).
  • MLFi has a well-defined and unambiguous semantics, which makes it possible to reason about contract descriptions and define operations in a generic way.
  • An MLFi description is a "portable" piece data which can be exchanged between computer systems and across stakeholders.
  • MLFi is "closed under life-cycle", meaning that applying external events to a contract (fixings, barrier or credit events) produces also an MLFi contract, on which all the generic operations can be applied.

LexiFi has built a software stack based on MLFi, implementing all the generic operations listed in the picture above (and more). This stack is used in LexiFi Apropos, LexiFi's flagship end-user product. It has also been embedded in existing third-party systems to give them extra flexibility in terms of support for structured products. An application embedding LexiFi's MLFi technology can be extended to support all features for a new product shape in hours, not weeks or months!

Theoretical foundations

The theoretical foundations for MLFi results from a joint effort over many years between LexiFi and leading researchers in computer science. This award-winning work draws insights from the study of programming language theory to provide a clear and homogeneous framework for representing financial instruments.

The main results include:

  • A set of about twenty basic combinators or "primitives" that capture the essence of financial contracts in order to both describe and process such contracts. The contract description is independent of any contract manipulation or valuation method.
  • An operational semantics designed to describe precisely how a contract evolves in its life cycle. A behavioural equivalence relationship enables the manipulation, transformation, and simplification of contracts as they evolve over time.
  • A valuation semantics that, for each contract, enables the creation of a program that associates a contract description and a model specification in order to automatically generate specialised pricing code.

The MLFi technology has been described in academic papers and in a book. You can find more information about it in our white papers and presentations.

A compositional approach to describing contracts

With MLFi, it suffices to understand a small set of core constructs in order to design complex contracts. Analogously, in algebra, the expression "(1 + 2) x (3 + 4)" is easy to understand because we know what a number is, and we understand the meaning of algebraic operators. MLFi does exactly the same thing with financial contracts, with elementary MLFi contracts replacing numbers and MLFi combinators replacing algebraic operators. Expressions that contain elementary contracts and combinators are also contracts, which may in turn be further combined with other contracts to create increasingly higher-level building blocks for designing financial products.

A key benefit of compositional semantics is that one can explore and manipulate "passive" data. For example, MLFi's contract definitions—the data—lend themselves to automated processing of various sorts, including pricing and event management. A single program may manipulate all data elements, without exception. This property has a parallel in algebra: in the same way one can apply a process to any algebraic expression—e.g., calculate the value, count the number of symbols—MLFi can apply a process to any contract.

In summary, MLFi's crucial property is that sophisticated contracts are assembled from a small set of simple, orthogonal constructs that processes know how to manipulate, regardless of the contract's complexity. The consequence is that processes do not need to be reprogrammed as new financial instruments are added.

What is MLFi used for?

MLFi is a building block for developing a variety of high value-added transaction processing, decision support and business integration solutions for derivatives and structured products. Potential application areas of MLFi include:

  • structuring and sales support
  • trading
  • risk management
  • operational management
  • documentation processing
  • product repository
  • enterprise application integration
  • data warehousing

MLFi, combined with the customer's or LexiFi's own pricing libraries, forms the foundation layer of an integrated and extensible transaction processing and decision support infrastructure.


White papers

LexiFi, Structuring, Pricing, and Processing Complex Financial Products with MLFi, PDF format, January 2005.
Describes MLFi concepts and applications.
LexiFi, Structured Products and Time Travel, PDF format, January 2004.
Reviews potential solutions for overcoming the challenges of valuing structured products on past, present, and future dates.

Academic papers

Simon Peyton Jones, Jean-Marc Eber, and Julian Seward, Composing Contracts: An Adventure in Financial Engineering, PDF format, September 2000.
Best EAPLS (European Association for Programming Languages and Systems) Paper Award at PLI 2000, Montreal.


Jean-Marc Eber, Compositional Description, Valuation, and Management of Financial Contracts: The MLFi Language, PowerPoint format, March 2003.
Provides an introduction to the Modeling Language for Finance (MLFi).
Jean-Marc Eber, Describing, Manipulating and Pricing Financial Contracts: The MLFi Language, PDF format, presented at the University of Cambridge, University Finance Seminar on Financial Contract Representation on 14 March 2003. Updated in January 2005.

On the need for a common language

National Research Council, Technical Capabilities Necessary for Systemic Risk Regulation: Summary of a Workshop, chapter entitled "Need for a Common Language for All Securities and Financial Contracts", The National Academies Press, Washington, DC, 2010.
Andrew Haldane, Towards a common financial language, speech by Andrew Haldane, Executive Director, Financial Stability, Bank of England, at the Securities Industry and Financial Markets Association (SIFMA) "Building a Global Legal Entity Identifier Framework" Symposium, New York, 14 March 2012.


A key part of LexiFi's research is exposed in a book

Simon Peyton Jones of Microsoft Research and Jean-Marc Eber of LexiFi contributed a chapter in the book entitled "The Fun of Programming" edited by Jeremy Gibbons and Oege de Moor (Palgrave Macmillan, March 2003, ISBN: 0333992857).


Risk Magazine, The Risk Awards 2001 - Software Product of the Year - MLFi, PDF format, January 2001.

Need for a common language for all securities and financial contracts

"An important building block for systemic financial risk regulation is the development of a common nomenclature and language to enable the unambiguous aggregation and interpretation of data collected from firms by regulators. Virtually all data on complex financial instruments and risk measurements (and many other data) are captured differently by different firms, and this is a major limitation facing any effort to analyze risks that cut across firms and markets."

National Research Council
Workshop, Washington, DC, 2010