Skip to main content

LegalCiteCheck

Checks whether a legal citation exists and whether the cited authority actually supports the proposition it's offered for. It does not check the law itself.

Automated verification only. Not legal advice. Every citation flagged or cleared here must be independently confirmed by a licensed attorney before filing. Jurisdiction: US federal and state case law only.

Status

Core pipeline built and working end-to-end: corpus ingestion, label synthesis, encoder training, decoder (explanation) training, the verification pipeline, and the CLI. See docs/LegalCiteCheck_Architecture_Spec.md for the full build plan and docs/LegalCiteCheck_Research_Report.md for the rationale.

Trained artifacts:

  • legalcite-support-base (primary) — DeBERTa-v3-base, 4-way citation support classifier. Held-out macro F1 0.9377, false-negative rate 0.0475. See model_cards/encoder-support-base.md for full eval numbers and known limitations, including a documented out-of-distribution generalization gap on synthetically-phrased propositions.
  • legalcite-explain-7b-lora (secondary) — Qwen2.5-7B-Instruct QLoRA adapter that explains (never decides) the encoder's label. See model_cards/explain-7b-lora.md.

Not yet done: publishing the trained weights to Hugging Face Hub (the CLI's model-path default is currently a placeholder), publishing to PyPI, the GitHub Action / LangChain tool / LlamaIndex pack integrations, a demo Space, and the LePhantomCite/CaseHOLD benchmark integrations.

What this is not

Not a legal chatbot, not a research tool, not a source of legal recommendations. It never suggests an alternative citation and never produces argument text. See docs/LegalCiteCheck_Architecture_Spec.md section 0 for the full non-goal list.

Setup

python -m venv .venv
source .venv/bin/activate   # or .venv\Scripts\activate on Windows
pip install -e ".[dev]"
cp .env.example .env         # fill in COURTLISTENER_API_TOKEN and CONTACT_EMAIL
pytest

Some tests (test_citegraph.py, test_pipeline.py, test_train_lora.py) require the full dependency stack (torch, transformers, eyecite, etc.) and are skipped in a lightweight dev install.

Usage

legalcite check brief.pdf --json

Exits non-zero if any citation is found to be FABRICATED (CI-gate friendly). Requires a trained encoder (--model-path, or LEGALCITE_MODEL_PATH) and, for fast/free existence lookups, a local citation index (--index-path, or LEGALCITE_INDEX_PATH) — without an index configured, every citation falls through to the CourtListener API, which is rate-limited to 125 requests/day.

Repository layout

Tracks docs/LegalCiteCheck_Architecture_Spec.md section 2: src/legal_citation_check/{ingest,gen,models,verify,train,eval}, configs/, model_cards/, integrations/, tests/.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

legal_citation_check-0.1.0.tar.gz (55.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

legal_citation_check-0.1.0-py3-none-any.whl (50.6 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page