Working paper · SSRN 7489338 · · 25 pages

Can a language model be trusted to decide tax-lot questions, or should it only transcribe trades for a rules engine?

Read the paper on SSRN ↗ Cite
Language models & AI policyTax-aware investingAdvisers & investorsJournalistsCPAs & tax professionals

Key results

  • Unaided, the two small local models answered 13% and 23% of the 193 items correctly, and quoting Publication 550 lifted both only to 20%.
  • The hosted model answered 31 of 35 closed-book and 34 of 35 with the governing rules quoted.
  • Asked only to transcribe trades for the rules program, the local models reached 98% and 100%, and the hosted model answered 35 of 35.
  • An unaided small model would misstate the simulated household's yearly tax by $93,847 to $101,592; delegation brings that to $0 on the natural items.
  • Accounting checks that need no tax rule rejected 72% of the small models' closed-book errors and one of the hosted model's eleven, and repairing a rejected answer seldom made it right.

Summary

The question we asked

A tax-aware separately managed account makes the same few decisions hundreds of times a year. Is this loss sale a wash sale? If it is, which shares carry the disallowed loss forward, and what does their basis become? Is a gain short-term or long-term? Which lots should the next trim sell? None of these is a hard question. Each has one right answer under IRS Publication 550, and a short program can compute it to the cent. These are also the questions that operations staff now type into chat windows, and that assistant products are being built to answer for people who manage other people's money. We wanted to know how often a language model gets them right, and what a wrong answer costs.

How we built the test

We wrote a small rules program whose every rule is read off Publication 550 (2025), and it reproduces every worked example in the publication that it relies on. That program is the answer key for a 193-item benchmark in five families: whether a loss sale is a wash sale and how much of the loss survives, the basis of a replacement lot, whether a sale is short- or long-term, the gain under first-in first-out or specific identification, and a year-end reconciliation of one ticker across a household's accounts. Table 1 lists them.

Most of the items are not invented. A simulated household trades through 2025 on simulated prices. It holds a direct-indexing account, a second taxable account, a traditional IRA, a Roth IRA, a spouse's taxable account and an adult child's account. Of the items, 133 are random samples of decisions the direct-indexing account faced during that year. The other 60 sit on the lines the rules draw: day 30 against day 31, the anniversary against the day after it, a leap day inside the year, a purchase in an IRA, a replacement split across two accounts.

Each question goes to each model in four settings. Closed-book, the model sees only the household facts, the trades and the question. Rule-grounded, it also sees the governing passages of Publication 550. Program-aided, it writes a short Python program that we run. Delegated, it only transcribes the trades into a fixed schema and the program answers. Two open-weight models running on a laptop, Qwen2.5 7B and Gemma 3 12B, answered all 193 items in every setting. A larger local model, Qwen2.5 14B, and one hosted model, Claude Sonnet 5, answered a 35-item stratified subset. Table 2 lists them.

What came back

Figure 1 shows accuracy by setting. Unaided, the two small local models got 13% and 23% of the items right. Quoting the rules in front of them helped little: both stood at 20%. Writing a program took them to 24% and 26%. The hosted model did much better, 31 of 35 closed-book and 34 of 35 with the rules, and its misses were the kind that do not announce themselves: a wash sale nobody noticed, a purchase on day 31 counted as inside the window.

Figure 1. Accuracy by setting. Bars are the share of items answered correctly, with 95% Wilson intervals. Qwen2.5 7B and Gemma 3 12B answered all 193 items; Qwen2.5 14B and the hosted model answered the same 35-item stratified subset.
Figure 1. Accuracy by setting. Bars are the share of items answered correctly, with 95% Wilson intervals. Qwen2.5 7B and Gemma 3 12B answered all 193 items; Qwen2.5 14B and the hosted model answered the same 35-item stratified subset.

The delegated setting looked different. Asked only to transcribe the trades and leave the decision to the program, the small models reached 98% and 100%, and the hosted model answered 35 of 35. What the small models still missed came from transcription, usually a mislabelled account.

We priced the wrong answers on the simulated household by weighting each family's mean error by the number of such decisions the account faced in the year. Figure 5 shows the result. An unaided small model would misstate the year's tax by $93,847 to $101,592, about three times the tax value of the year's harvest. Delegation brings that to $0 on the natural items. Table 6 gives the breakdown by family, and the year-end reconciliation carries the largest share of it.

Figure 5. Expected annual tax misstatement on the simulated household, by model and setting, with 95% bootstrap intervals over the natural items. The delegated setting's bars are zero.
Figure 5. Expected annual tax misstatement on the simulated household, by model and setting, with 95% bootstrap intervals over the natural items. The delegated setting's bars are zero.

Could constraints replace the program?

Version 2 of the paper takes up an objection to that conclusion. If the rules are hard constraints, why not let the model answer and reject anything that breaks them? Some accounting identities hold for every correct answer and need no tax rule to test. We applied them to the answers we already had. They rejected 72% of the small models' closed-book errors and one of the hosted model's eleven. Figure 6 shows the split. The rejected answers hold most of the dollars. Moving a rejected answer to the nearest admissible one seldom makes it right, though, and Table 7 gives those counts. The checks make a useful screen in front of the program, and no substitute for it.

Figure 6. Wrong answers in the three settings where the model applies the rules, split by what the checks of Section 6.3 make of them. Bars are shares of each row's wrong answers, with the counts inside. Qwen2.5 7B and Gemma 3 12B answered 193 items; Qwen2.5 14B and the hosted model answered the…
Figure 6. Wrong answers in the three settings where the model applies the rules, split by what the checks of Section 6.3 make of them. Bars are shares of each row's wrong answers, with the counts inside. Qwen2.5 7B and Gemma 3 12B answered 193 items; Qwen2.5 14B and the hosted model answered the 35-item subset.

We also attributed the wrong answers to named misconceptions where one reproduces the answer given, such as ignoring the wash-sale rule altogether or getting the term wrong. Table 5 reports the counts. Most errors matched none of the named classes.

Why the test is built around a household

The wash sales that cost money are rarely inside the one account a custodian's software watches. That software sees a single account. It cannot see a spouse's account at another broker, or an IRA that bought the same stock a week after a harvest. Cross-account facts like these are what an assistant would be asked to reason about, so we built the benchmark around a household rather than one account.

Our practical reading is narrow. A model can read documents and turn a paragraph of trades into rows. The program should make the call, and someone should look over what the model transcribed before it does.

Who this is for: CPAs and tax professionals who see language-model output on wash-sale and lot questions, and journalists covering AI in investing and tax preparation.

Figures

Figure 2. Accuracy by decision family for the two models that answered all 193 items, in the four settings: H1 closed-book, H2 rule-grounded, H3 program-aided, H4 delegated.
Figure 2. Accuracy by decision family for the two models that answered all 193 items, in the four settings: H1 closed-book, H2 rule-grounded, H3 program-aided, H4 delegated.
Figure 3. Accuracy on natural items (random samples of the simulated SMA's decisions) and edge items (boundary templates), Qwen2.5 7B and Gemma 3 12B pooled, with 95% Wilson intervals.
Figure 3. Accuracy on natural items (random samples of the simulated SMA's decisions) and edge items (boundary templates), Qwen2.5 7B and Gemma 3 12B pooled, with 95% Wilson intervals.
Figure 4. Wrong answers by error class and setting, Qwen2.5 7B and Gemma 3 12B pooled over 193 items each. Named classes are the misconceptions of Section 6.1; "other" matches none of them.
Figure 4. Wrong answers by error class and setting, Qwen2.5 7B and Gemma 3 12B pooled over 193 items each. Named classes are the misconceptions of Section 6.1; "other" matches none of them.

Tables

Table 1. The five families. Natural items are random samples of the simulated SMA's 2025 decisions; edge items are templated boundary cases. The last column counts that family's decisions in the simulated year.
FamilyQuestionItems by kindNaturalEdgeDecisions in 2025
Wash-sale triggerdisallowed and deductible loss on a harvestwash trigger 40281277
Replacement basisbasis of a named replacement lot after the carry-overreplacement basis 33211221
Holding periodshort- or long-term; the gain as well when a wash sale tacksdirect 35, tacked 52812110
Lot reliefshort- and long-term gain of a sale, or the tax-minimising lotsFIFO 12, identified 16, tax-minimising 12281233
Year reconciliationnet short- and long-term gain and total disallowed loss for one namereconciliation 40281242
All13360
Table 2. Models evaluated. Local models ran on one Apple M3 Max; the hosted model ran through its vendor's command-line client.
ModelParametersWeightsWhereItemsCalls
Qwen2.5 7B Instruct (Qwen Team 2024)7.6BQ4KM, digest 845dbda0ea48local, Ollama 0.32.5193772
Gemma 3 12B (Gemma Team 2025)12.2BQ4KM, digest f4031aab637dlocal, Ollama 0.32.5193772
Qwen2.5 14B Instruct (Qwen Team 2024)14.8BQ4KM, digest 7cdf5a0187d5local, Ollama 0.32.535140
Claude Sonnet 5 (Anthropic)not publishedhosted, model id claude-sonnet-5vendor API via CLI35140 (+1 probe)
Table 3. Share of the 193 questions for which an ordinary retriever over the whole of Pub. 550 returns the governing text, with the question as the query. "Sentence" requires the governing sentence of every rule the item needs; "every page" requires a chunk from every governing page; "any page" requires a chunk from at least one.
RetrieverTop kSentenceEvery pageAny page
BM2540.190.190.46
BM2580.200.320.84
dense40.000.000.30
dense80.000.000.62
fusion40.000.000.40
fusion80.230.420.79
Table 4. Accuracy by model and setting, with 95% Wilson intervals. "Unusable" counts unparseable answers, failed programs and rejected transcriptions, all scored as wrong.
ModelSettingItemsAccuracy [95% CI]NaturalEdgeUnusable
Qwen2.5 7BClosed-book1930.13 [0.09, 0.18]0.150.080
Qwen2.5 7BRule-grounded1930.20 [0.15, 0.26]0.230.150
Qwen2.5 7BProgram-aided1930.24 [0.18, 0.30]0.230.2516
Qwen2.5 7BDelegated1930.98 [0.95, 0.99]1.000.931
Gemma 3 12BClosed-book1930.23 [0.18, 0.30]0.240.220
Gemma 3 12BRule-grounded1930.20 [0.15, 0.26]0.210.170
Gemma 3 12BProgram-aided1930.26 [0.21, 0.33]0.300.1841
Gemma 3 12BDelegated1931.00 [0.98, 1.00]1.001.000
Qwen2.5 14BClosed-book350.14 [0.06, 0.29]0.200.070
Qwen2.5 14BRule-grounded350.14 [0.06, 0.29]0.150.130
Qwen2.5 14BProgram-aided350.37 [0.23, 0.54]0.350.404
Qwen2.5 14BDelegated351.00 [0.90, 1.00]1.001.000
Claude Sonnet 5Closed-book350.89 [0.74, 0.95]0.900.870
Claude Sonnet 5Rule-grounded350.97 [0.85, 0.99]1.000.930
Claude Sonnet 5Program-aided350.83 [0.67, 0.92]0.800.870
Claude Sonnet 5Delegated351.00 [0.90, 1.00]1.001.000
Table 5. Wrong answers by error class and setting, Qwen2.5 7B and Gemma 3 12B pooled (193 items each). Classes are assigned in the order of Section 6.1.
Error classClosed-bookRule-groundedProgram-aidedDelegated
other2372391673
no wash rule3219350
wrong term2423130
format/parse failure00571
arithmetic slip131220
long on anniversary5350
fifo always2240
all or nothing1140
lifo0220
retirement basis added1200
window 310300
ignores spouse0200
child counts1000
ignores retirement0100
total3163092894
Table 6. Expected annual tax misstatement on the simulated household, dollars, by decision family: Nfc̄f with Nf from Table 1 and c̄f the mean over that family's natural items. Last column: total with a 95% bootstrap interval.
ModelSettingWash-sale triggerReplacement basisHolding periodLot reliefYear reconciliationTotal [95% CI]
Qwen2.5 7BClosed-book25,1025,2346,92312,61851,715101,592 [80,767, 123,564]
Qwen2.5 7BRule-grounded17,2385,2624,51719,63540,06986,721 [69,441, 104,937]
Qwen2.5 7BProgram-aided21,1766,8985,56814,13937,50485,285 [58,822, 122,888]
Qwen2.5 7BDelegated000000 [0, 0]
Gemma 3 12BClosed-book28,6996,0965,51415,83137,70693,847 [73,617, 115,734]
Gemma 3 12BRule-grounded21,7676,3459,91211,89221,60871,524 [61,252, 82,472]
Gemma 3 12BProgram-aided21,3435,3141,14710,64122,15160,596 [30,058, 112,199]
Gemma 3 12BDelegated000000 [0, 0]
Table 7. Wrong answers against the checks of Section 6.3. "Fails" breaks a check, "Passes" satisfies every check, "None" is a holding-period answer with nothing to check, and "Repaired" counts failing answers that become correct when moved to the nearest admissible answer. The last two columns split the annual misstatement of Table 6, in dollars, between the failing answers and the rest; the subset models are not priced. The delegated setting is left out: its four wrong answers, all from Qwen2.5 7B, are three transcription slips that pass every check and one transcription the engine rejected.
ModelSettingWrongFailsUnusablePassesNoneRepairedIn failingIn the rest
Qwen2.5 7BClosed-book168122029171286,55415,038
Qwen2.5 7BRule-grounded15410903510578,1068,615
Qwen2.5 7BProgram-aided147761642131566,31718,968
Gemma 3 12BClosed-book148107031101482,20211,644
Gemma 3 12BRule-grounded1559404912547,26324,261
Gemma 3 12BProgram-aided1425441443747,89112,705
Qwen2.5 14BClosed-book30210815
Qwen2.5 14BRule-grounded30190925
Qwen2.5 14BProgram-aided22741011
Claude Sonnet 5Closed-book400400
Claude Sonnet 5Rule-grounded100100
Claude Sonnet 5Program-aided610500

Abstract

Advisers who run tax-aware separately managed accounts are starting to put language-model assistants in front of questions such as whether a loss sale is a wash sale, what a replacement lot's basis becomes, whether a gain is short- or long-term, and which lots a trim should sell. Each has one right answer under IRS Publication 550. We build a 193-item benchmark of these decisions with exact answers from a small deterministic rules engine that reproduces every worked example in the publication it relies on. Most items are random samples of the decisions a simulated household's direct-indexing account faced in a simulated 2025, across the client's own accounts, her IRAs, her spouse's account and an adult child's account; the rest sit on the boundaries the rules draw. Local open-weight models and one hosted model answer in four settings: closed-book, with the governing rules quoted, by writing a program, and by only transcribing the trades for the engine. Unaided, the two local models that answered every item got 13% and 23% of them right, and quoting the rules helped little; the hosted model answered 31 of 35 subset items. With the decision delegated to the engine, the local models reached 98% and 100% and the hosted model 35 of 35. Version 2 asks whether the engine is more than the problem needs: a model could instead answer under the constraints themselves. Accounting identities that every correct answer satisfies, and that need no tax rule to check, reject 72% of the small models' closed-book errors and one of the hosted model's eleven, and moving a rejected answer to the nearest admissible one seldom makes it right. Wrong answers are attributed to named misconceptions where one reproduces them, and priced on the simulated household, where an unaided small model would misstate the year's tax by about three times the tax value of the year's harvest. For an adviser the practical conclusion is to use a model to read documents and the engine to make the call.

Keywords: large language models, tax-lot accounting, wash sale, holding period, specific identification, tax-loss harvesting, direct indexing, separately managed accounts, benchmark, retrieval-augmented generation, tool use, constrained generation, registered investment advisers

How to cite

Majumdar, A. (2026). Can a Language Model Keep a Tax Lot Straight? A Rules-Grounded Benchmark for Wash-Sale, Holding-Period and Lot-Relief Decisions. SSRN Working Paper No. 7489338. https://ssrn.com/abstract=7489338

Educational only. Not investment, tax, or legal advice, and not an offer of advisory services. InnovationStrat Wealth, LLC is not yet registered as an investment adviser. Questions about a paper? Use the contact form.  ·  ← All papers