The uslib Library#

Warning

uslib is in its draft stage, and its contents are subject to change as development continues.

Overview#

The uslib library packages twelve reference liability cash flow projection models for the individual life insurance and annuity products sold in the United States, built with modelx — and, for each one, the product specification and technical notes the model was built from.

The models are the centre of the library. Each is a by-model-point projection of one product’s gross liability cash flows: premiums, claims, surrenders, withdrawals, expenses and commissions, on the product’s own processing order and timing. None of them discounts — every model publishes the cash flows and leaves discounting, reserving and capital to a layer that consumes them.

Each one of these models reproduces a documented worked example, asserted cell by cell to the precision the notes display. The chain is deliberate and complete in both directions:

  • product-spec.md specifies a representative product — a standardized composite built from publicly available documentation of real products, not any single insurer’s contract. It records contractual mechanics, a full parameter set, the observed variation across insurers, and the rationale for every representative choice.

  • technical-notes.md turns that product into a liability cash flow model on paper: model point attributes, state variables, assumption inputs, the recursions with their explicit processing order, policyholder behaviour, and a numeric worked example.

  • The model implements those notes, and the library’s own tests/ assert the worked example against it. Change an assumption, and the test tells you whether the model and the notes have parted company.

  • sources.md lists every source the first two cite, with URLs, access dates and whether the document was actually retrieved.

Every quantitative parameter in the library is either source-tagged or marked std — a standardization introduced for the reference implementation, carrying its rationale and, where available, the observed range across insurers. Facts taken from source material are never silently mixed with assumptions made to complete a model.

These are mechanics demonstrations, not pricing or reserving results

The contractual elements are sourced; most behavioural and expense assumptions are std, because no public source carries them. Current non-guaranteed scales — declared crediting rates, current COI, IUL caps — are not public at all. Replace them with company data before drawing any conclusion from the numbers.

The models#

Model names are <product>_<country>_<grid>: the short name the product is actually known by — MYGA, FIA, RILA, SPIA, DIA, ULSG — then US, then _A for an annual step or _S for a monthly one. The grid letters follow lifelib, where annuallife/TradLife_A is the annual-step model and basiclife/BasicTerm_S and savings/CashValue_SE are the monthly ones. S carries a second sense in lifelib — scalar, one model point at a time, as against the vectorized _M models — and that is true of all twelve here.

Every product also carries a second model, <product>_US_SEC, derived from its _S model. E is for running in force: t counts months from a valuation date shared by every model point, and a model point may be a policy issued at that date, one already in force at it, or one written after it, as in basiclife/BasicTerm_SE. C is for compiling, as basiclife/BasicTerm_SC does; Term_US_SEC, WholeLife_US_SEC, UL_US_SEC, VUL_US_SEC, ULSG_US_SEC, MYGA_US_SEC, SPIA_US_SEC, DIA_US_SEC, FIA_US_SEC, IUL_US_SEC, VA_US_SEC and RILA_US_SEC compile, and each model-sec.md says how. On the _S model’s new-business points, issued at the valuation date, an _SEC model reproduces its _S model cell by cell. Where the worked example’s point is already in force, as whole life’s, the FIA’s, the variable annuity’s and guaranteed UL’s are, the _SEC twin of that point continues the _S projection from the month it is valued at, its expenses apart, which inflate from the valuation date. Each model-sec.md says what running in force changes. Term_US_SEC, WholeLife_US_SEC, SPIA_US_SEC, MYGA_US_SEC, UL_US_SEC, DIA_US_SEC, FIA_US_SEC, VUL_US_SEC, RILA_US_SEC, VA_US_SEC, ULSG_US_SEC and IUL_US_SEC are all twelve: every product has its in-force model.

Compiled speed. Each _SEC model’s model-sec.md records what compiling buys, timed by tools/bench_sec_cy.py: one block of the committed model points repeated, each engine in a process of its own, the fastest of several runs. The figures below are net_cf(t) summed over each point’s frame, the projection alone, in milliseconds a point, on the shared Linux machine each compile step ran on, under load, so they compare engines within a row better than products across rows. The export is the model as plain Python, modelx’s export, before compiling; modelx is the _SEC model itself. RILA’s ratio to its export is the lowest, since making and releasing its 6.4 MB compiled point takes most of each point’s time.

Product

Model

Compiled

Export

modelx

Compiled vs export

Compiled vs modelx

Term

Term_US_SEC

0.50 ms

4.7 ms

196 ms

9.4×

392×

Whole life

WholeLife_US_SEC

0.53 ms

7.4 ms

274 ms

14.0×

517×

Universal life

UL_US_SEC

1.21 ms

14.5 ms

545 ms

12.0×

450×

Variable UL

VUL_US_SEC

2.53 ms

34.9 ms

964 ms

13.8×

381×

Guaranteed UL

ULSG_US_SEC

1.42 ms

17.4 ms

539 ms

12.3×

380×

Indexed UL

IUL_US_SEC

4.01 ms

69.4 ms

2,060 ms

17.3×

514×

MYGA

MYGA_US_SEC

1.19 ms

15.0 ms

520 ms

12.6×

437×

FIA

FIA_US_SEC

1.32 ms

14.6 ms

489 ms

11.1×

370×

Variable annuity

VA_US_SEC

1.70 ms

22.2 ms

815 ms

13.1×

479×

RILA

RILA_US_SEC

2.00 ms

8.33 ms

167 ms

4.2×

84×

SPIA

SPIA_US_SEC

0.808 ms

7.66 ms

197 ms

9.5×

244×

DIA

DIA_US_SEC

0.860 ms

8.49 ms

199 ms

9.9×

231×

All twelve run on a monthly grid, the term, whole life and FIA models included since their conversion.

Where a product’s contractual drivers are annual — the term guaranteed premium schedule and its shock lapse, whole life’s cash value schedule and dividend declaration, the FIA’s point-to-point index credit, rider charge and lifetime withdrawal — the model keeps those events on the policy anniversary and derives the policy year from t (duration(t) = t // 12), rather than stepping annually. A monthly grid is not the same thing as a monthly product: what the finer grid resolves is everything that is not a contractual event — mortality and lapse in the month they happen, interest and nonforfeiture floors accruing month by month so a mid-year exit is valued on the balance it actually has, and expenses falling where they are incurred. The two grids agree exactly on the in-force at every anniversary, and on every anniversary-dated contractual quantity; they differ on cash flow timing, which is what the monthly grid is for. An _SEC model derives the policy year from its policy clock (duration(t) = duration_mth(t) // 12).

Life

Product

Model

Grid

Representative design

Level premium term

Term_US_S, Term_US_SEC

monthly

Guaranteed level premiums for 10/20/30 years, then jump-to-ART renewal at unchanged face to attained age 95; convertible until min(end of level period, age 70); no cash value. Contractually annual throughout, so the premium schedule, the ART renewals and the shock lapse sit on the anniversary

Whole life

WholeLife_US_S, WholeLife_US_SEC

monthly

Participating level-premium WL on a 2017 CSO / 4% nonforfeiture basis, three-factor contribution dividends, paid-up-additions default; plus a non-par final-expense variant. The dividend and the cash value schedule stay annual; the cash value interpolates between anniversaries

Universal life

UL_US_S, UL_US_SEC

monthly

Flexible-premium current-assumption UL: monthly deductions, declared crediting over a guaranteed minimum, GPT corridor, DB options A/B — the base chassis for the three below

Indexed UL

IUL_US_S, IUL_US_SEC

monthly

UL chassis + S&P 500 annual point-to-point index account with cap, 100% participation, 0% floor — the AG 49-A benchmark design

Variable UL

VUL_US_S, VUL_US_SEC

monthly

UL chassis + unitized separate-account subaccounts and a fixed option; SEC-registered, so charges are anchored on prospectus fee tables

Guaranteed UL

ULSG_US_S, ULSG_US_SEC

monthly

UL chassis + shadow-account secondary guarantee (AG 38 §8E Design #1), funded by a solved level no-lapse premium; lapse-supported economics

Annuity

Product

Model

Grid

Representative design

Fixed deferred (MYGA)

MYGA_US_S, MYGA_US_SEC

monthly

Single-premium book-value annuity: multi-year declared rate, surrender charge plus market value adjustment, Model #805 floor — the deferred base chassis

Fixed indexed (FIA)

FIA_US_S, FIA_US_SEC

monthly

Index-linked credits at a 0% floor, premium bonus with vesting, and a guaranteed lifetime withdrawal benefit that continues after the account value is exhausted

Variable annuity

VA_US_S, VA_US_SEC

monthly

Separate-account deferred annuity: subaccount units net of M&E, a guaranteed minimum death benefit, and a lifetime withdrawal rider fee-assessed on the benefit base

Registered index-linked (RILA)

RILA_US_S, RILA_US_SEC

monthly

SEC-registered buffered annuity: point-to-point terms with a downside buffer and upside cap, and an AG 54 interim value

Immediate (SPIA)

SPIA_US_S, SPIA_US_SEC

monthly

Single premium converted immediately into a payment stream; life only, period certain, joint and survivor, refund forms, compound COLA — the payout chassis

Deferred income (DIA/QLAC)

DIA_US_S, DIA_US_SEC

monthly

Flexible-premium contract with no account value: each premium buys a paid-up income slice, with a return-of-premium deferral death benefit and a QLAC variant

One shape, enforced#

Every model has the same two Spaces — Data reads the input CSVs once per model, and Projection is parameterized by point_id, or by its position, idx, in an _SEC model that compiles — with inputs as external CSVs beside run.py, so the model folder holds formulas and nothing else. Projection’s docstring carries the mapping from the technical notes’ actuarial symbols to the cells names.

That shape is asserted rather than merely described: tests/test_model_conventions.py applies it to every model in the registry, and each model additionally has its own test module for its worked example and its product-specific invariants — the notes’ “Known modeling pitfalls” sections are written up there as tests.

The pairing of model name to folder is deliberately not derivable from the folder name — registered_index_linked_annuity spelled out is unusable and the industry says RILA — so it is registered once in tests/us_registry.py, and the conventions suite asserts that the registry, the directory on disk and the model’s own _name all agree.

Shared vocabulary#

Cells names come from lifelib — basiclife/BasicTerm_S first, then savings/CashValue_SE — so a name means the same thing in every model here and the same thing it means in lifelib. Where a cross-model review found one concept under two names, the conflict was settled once and the ruling is asserted, not merely documented. The _SEC models, which run in force at a valuation date, keep each ruling except where their column says otherwise:

Convention

Settled as

In the _SEC models

Time index

t is 0-based and counts policy months: t = 0 is the issue month of a policy projected from issue, period t runs from time t to time t + 1, and proj_len() is the number of periods from t = 0 — the exclusive end of the frame, result_cf() covering t = t_first, ..., proj_len() - 1. A policy year is the derived 1-based label duration(t) + 1, never the index

t counts months from the valuation date: t = 0 is the valuation month for every point, however old the policy, and every frame runs t = 0, ..., proj_len() - 1, so the points’ frames sum row by row into a block. The policy’s own age is the policy clock, duration_mth(t) = duration_mth_init() + t, which every contractual cell reads, duration(t), policy_year(t) and age(t) keeping their formulas on it. A point issued k months on holds zeros, not NaN, before its issue month, and nothing is active there. On a point issued at t = 0 the two clocks coincide, and the model reproduces its _S twin

In-force count

pols_if(t) is the count at the start of period t, and is the weight on that same result_cf() row’s cash flows. End-of-period state is reachable through pols_if_at(t, timing)

The same weight, pols_if(t) == pols_if_at(t, "BEF_DECR"): the count carried in from t - 1, pols_if_at(t, "BEF_NB"), plus the month’s new business, pols_new_biz(t), whose column in result_pols() sums to the new-business points’ policy_count. result_cf() keeps the _S columns exactly, and the counts the family adds are in result_pols(). The payout annuities differ: SPIA’s pols_if is its _S closing measure, and DIA’s the count on the books weighted by the probability that a covered life is alive

Annual rates on a monthly grid

An assumption published annually stays annual in the unsuffixed cells and is converted at 1 - (1 - q)^(1/12) for the month. A contractually annual event is never spread across the year to match: a dividend declaration, a shock lapse and a paid-up-additions purchase land whole on the anniversary month, and a premium lands whole on each date the elected mode bills it

As in the _S models

Rates

mort_rate / lapse_rate are annual; mort_rate_mth / lapse_rate_mth are monthly

As in the _S models

Net cash flow

net_cf is income-positive in every model. Where a product’s notes print the stream outgo-positive (whole life, both payout annuities), that orientation survives verbatim as liability_cf, and net_cf(t) == -liability_cf(t)

As in the _S models

Roll-forward checks

check_*() takes no argument and returns bool over all t (the CashValue_SE form); a per-t residual lives at check_*_resid(t)

As in the _S models

Account value

av_pp_at(t, timing) / av_at(t, timing) with the CashValue_SE timing strings; prem_to_av_pp is the premium credited to it

As in the _S models

Withdrawals

withdrawals(t), in a withdrawals column — an owner election, not a claim

As in the _S models

Benefit columns

claims_death, claims_lapse, claims_maturity, … named for the kind argument that produces them

As in the _S models

Absences are product facts, not gaps: a SPIA has no premiums and no lapse decrement, the payout annuities model lives_if (annuitant survival) alongside pols_if (contracts with an obligation open), and whole life has a cash value cv_pp, not an account value.

Chassis relationships#

Products that share machinery point at the file where it is specified rather than silently restating it, and each pointer states what it inherits and where it deviates:

  • Life — the UL-family documents (indexed, variable, guaranteed) reference the universal life technical notes for the shared base-chassis recursion, anchored on a retrieved specimen policy; deviations, such as VUL’s prospectus-sourced NAAR convention, are flagged explicitly.

  • Annuity, deferred — the fixed-indexed and variable annuity documents inherit the structure of the fixed deferred annuity chassis — surrender benefit composition, nonforfeiture floor, death benefit at account value — while carrying their own recursions and parameters.

  • Annuity, payout — the deferred income annuity and the annuitization phase of the RILA reference the immediate annuity payout chassis symbol-for-symbol, stating their deltas.

  • Across families — where an annuity document borrows from a life document, it states the differences: an annuity has no cost of insurance, no net amount at risk, and no death benefit corridor.

How to use the library#

Create your own copy of the uslib library, as described in the Copying a Library section. For example, to copy it to C:\path\to\your\uslib:

>>> import lifelib

>>> lifelib.create("uslib", r"C:\path\to\your\uslib")

Each model reads from its own directory, so run one directly:

python products/term_life/run.py

or read it and take the cash flow statement:

>>> import modelx as mx

>>> model = mx.read_model("products/term_life/Term_US_S")

>>> model.Projection[1].result_cf()

Projection takes a point_id; Projection[1] is each model’s worked-example anchor cell. result_cf() returns a tidy DataFrame indexed by t with one column per cash flow line.

The time index t is 0-based and counts policy months: t = 0 is the issue month of a policy projected from issue, period t runs from time t to time t + 1, and the attained age is age_at_entry + duration(t) with duration(t) = t // 12. proj_len() is the number of periods from t = 0, i.e. the exclusive end of the frame: result_cf() covers t = t_first, ..., proj_len() - 1, where t_first is 0 for a point projected from issue and the elapsed periods for an in-force point (WholeLife_US_S’s proj_start()). This is lifelib’s own convention (basiclife/BasicTerm_S, savings/CashValue_SE: for t in range(proj_len())). A contractual policy year is the 1-based label duration(t) + 1 and is derived, never indexed by. The same rule holds in all twelve models, and tests/test_model_conventions.py asserts it for every model point. An _SEC model counts t from its valuation date instead, the same month for every model point, and its model-sec.md sets out the two clocks.

Where a model publishes result_cf_annual() — Term_US_S, WholeLife_US_S and FIA_US_S, the products whose contractual quantities are annual — it is the same frame summed into policy years, with pols_if the count entering each year. Term_US_SEC, WholeLife_US_SEC and FIA_US_SEC publish it too: for a point already in force at the valuation date, the first row holds the rest of the policy year the point is in, with pols_if the count at the valuation date, and for a point issued later, the months before issue are left out.

The tests ship inside the library and run against your copy:

python -m pytest tests -q

Library contents#

File or folder

Description

products/<product>/

One directory per product, holding its documents and its models together. Twelve of them.

products/<product>/product-spec.md

The representative product specification: mechanics, parameters, variation across insurers.

products/<product>/technical-notes.md

The liability cash flow model on paper: state variables, recursions, processing order, worked example.

products/<product>/model.md

How the model implements those notes — what was standardized, what diverges, what the tests cover.

products/<product>/model-sec.md

Where the product has an _SEC model: how it extends the _S one — the in-force interface, the two clocks, the departures.

products/<product>/sources.md

Every source the product’s documents cite, with URLs, access dates and retrieval status.

products/<product>/<Model>/

The modelx model itself. Formulas only — no embedded data.

products/<product>/*.csv

The model’s inputs, external to the model folder so they can be edited or swapped in place. An _SEC model reads the same tables and its own model_point_table_sec.csv, with any *_sec.csv companion beside or in place of a table, such as DIA’s premium schedule or indexed UL’s segment ladder, or the FIA’s rate scenarios, RILA’s market scenarios or the variable annuity’s return and rate scenarios re-based to each model point, each generated from the _S model and its inputs and checked against them by the tests.

products/<product>/run.py

Reads the model and prints its cash flow statement. run_sec.py does the same for an _SEC model, for one model point or the whole block, and --cython runs the compiled model.

products/<product>/sample_sec.py, spec_sec.py

mx2cy’s two inputs for compiling an _SEC model: the sample run that types each cell, and the size of each cell’s cache.

references/

The cross-product regulatory and actuarial bibliography, cited as [REG-R#].

tests/

One module per model for its worked example and invariants, plus test_model_conventions.py for the house style, us_registry.py carrying the model registry, and sec_support.py, the comparisons and the generator the _SEC tests share.

_research/

The raw research notes every citation traces back to. Provenance, not documentation — kept in the source repository, neither rendered nor packaged with lifelib.

Citation conventions#

Whether a citation tag is a link tells you what kind of source it is. [R1] and [REG-R18] are links: the first lands on entry R1 in that product’s sources.md, the second on entry R18 of the shared reference library. [S6] is not a link. It stays on the page as you see it, brackets and all, and names entry S6 in that product’s sources.md for you to look up.

That asymmetry is deliberate, and it is the same line the sources.md files draw between their own sections. A regulatory or actuarial reference is an authority the model is held to, and following it is part of reading the document. A primary product source is a specification citation — the brochure or specimen policy a number was taken from — which says where a figure came from rather than what the model must obey. So one reads as a tag on the page and the other as a link off it.

Numbering is per product — S1 is a different source in each — so tags resolve against the document’s own product rather than one global list.

Tag

On the page

Meaning

[S#]

bracketed text

Fact taken from a primary product document (brochure, specimen policy, prospectus, producer guide) listed in the product’s sources.md

[R#]

link

Fact taken from a product-specific regulatory/actuarial reference in the product’s sources.md

[REG-R#]

link

Fact taken from the cross-product reference library (frozen R-numbering)

std — a standardization introduced for the reference implementation: a parameter or convention chosen where sources vary, are proprietary, or are silent. Each carries a rationale and, where available, the observed range across insurers.

unverified — a claim from general knowledge or a secondary snippet that could not be confirmed against a retrieved document. Treat it as a to-verify item, not an established fact.

The hard rule throughout: every quantitative parameter is either source-tagged or marked std.

Regulatory and actuarial reference library#

The reference library is the curated cross-product bibliography — frozen numbering R1–R157, cited as [REG-R#] — with separate product-relevance matrices for the life and annuity products. R1–R34 are life-origin entries, several of which also bind annuity models; R35–R72 are annuity-specific; R151–R157 are the seven AP&P Manual appendix items read at first hand. Most of the R73–R149 block is unused: it was allocated to a statutory accounting and capital research stream since retired from the library. Unused is not missing — the invariant is that numbers are never reused or renumbered.

  • Life — NAIC statutory framework (Standard Valuation Law, Standard Nonforfeiture Law, the Valuation Manual and VM-20, Models 582/585/787/830, AG 38/48/49/49-A/49-B), federal tax (IRC §§ 7702, 7702A, 807, 817), mortality tables and experience studies (2017 CSO, 2015 VBT, ILEC, SOA persistency and post-level-term), AAA practice notes and ASOPs.

  • Annuity — VM-21 and VM-22, formulaic CARVM under AG 33 and AG 35, AG 54 for index-linked interim values, Model #805 nonforfeiture and Models #245/#250/#275, C-3 Phase II capital, SEC Form N-4 and the 2024 rule bringing RILAs onto it, IRC § 72 and the QLAC regulations as amended by SECURE 2.0, and the 2012 IAM/IAR tables with Scale G2.

Known gaps and caveats#

The significant ones, aggregated from the per-product research; each product’s documents carry the full list.

Life

  • Current non-guaranteed scales are not public. Declared crediting rates, current COI scales and IUL caps/participation rates are producer-portal-only or point-in-time snapshots; the specs carry std values calibrated to observed ranges. Guaranteed elements are far better sourced.

  • Full rate and charge tables are largely proprietary. The exceptions captured here: a complete guaranteed COI table and processing order from a UL specimen, a complete guaranteed premium schedule from a term specimen, final-expense WL premium rates per $1,000, and VUL prospectus fee tables.

  • ULSG shadow-account parameters are unobservable, so that parametrization is wholly std, calibrated so the solved no-lapse premium resembles observed market premiums.

  • Era mixing. Some retrieved specimens are 2001-CSO-era while the representative specs are stated on a 2017 CSO basis; disclosed wherever it occurs.

Annuity

  • No public payout factors or purchase rates, for SPIAs, DIAs, or the annuitization option of any deferred product. Income figures in these documents are captured illustrations, never derived rates, so no pricing test against public data is possible.

  • Market value adjustment algebra is thinly sourced. Three MVA families were retrieved with sharply differing cap treatments, but no retrieved MYGA document states its own MVA algebra — the representative formula is inferred from same-family documents and says so.

  • Commutation and interim-value formulas are unpublished for fixed SPIAs and DIAs. RILA interim values are the exception: AG 54 mandates their structure.

  • Behavioural assumptions are order-of-magnitude anchors. Surrender-charge-expiry shock lapse, its suppression when a lifetime-withdrawal rider is in force, and rider utilization are the first-order drivers of annuity liability value, yet the calibrating studies are paywalled; the shipped values are std with their evidence quality stated.