Noema
Convert text into compact logical form: fewer tokens, no lost context, built for RAG
Noema is a Python library for token-efficient RAG. It turns documents into a deduplicated knowledge graph and sends your LLM only the facts a question needs, in a compact notation.
What is Noema?
Noema is a Python library for knowledge graph construction, LLM context compression and Retrieval-Augmented Generation (RAG). Instead of treating documents as flat strings, it parses text into a structured logical form of entities and relations, and organizes that structure into a canonical, deduplicated graph.
At query time, only the sub-graph relevant to the question is rendered as a short, line-oriented notation and placed in the prompt. The same compact representation that reduces token usage is also the retrieval layer, so token savings and retrieval quality come from one design rather than two systems bolted together.
Larry Page founded Google in 1998. Sundar Pichai is the CEO of Google.
becomes
#1 Larry Page :PERSON
#2 Google :ORG
#3 Sundar Pichai :PERSON
#1 -found-> #2
#3 -ceo_of-> #2
A typical RAG pipeline stores and re-embeds raw text chunks. Noema stores canonical facts, merges repeated mentions of the same fact into one node, and checks its compact notation by decoding it back to natural language and scoring the result (round-trip validation).
Why Noema? How it differs from other approaches
| Plain-text RAG (chunk and embed) | Text-only prompt compressors | Noema | |
|---|---|---|---|
| What is stored | Raw text chunks | Nothing (stateless) | Canonical, deduplicated facts |
| Multi-hop questions | Weak | Not applicable | Graph traversal connects facts across documents |
| Same fact in many documents | Repeated in every retrieval | Not addressed | Merged into one node |
| Context sent per query | Whole chunks | The compressed prompt | Only the relevant sub-graph |
| Meaning-loss check | None | Text similarity | Round-trip validation with a confidence score |
| Adding documents | Re-chunk and re-embed | Not applicable | Merges into the existing graph |
Features
- Text to semantic graph: entity and relation extraction, with optional coreference resolution and transformer-based relations
- Canonicalization and deduplication: one canonical node per fact, across one document or many
- Compact notation: a low-token representation for LLM context injection, decodable back to natural language
- Hybrid retrieval: vector similarity search plus multi-hop graph traversal, under a
max_tokensbudget - Round-trip validation: a confidence score for how much meaning the notation keeps
- Incremental knowledge base: new documents merge into the existing graph; save and load as a single
.noemafile - Streaming ingestion: batched ingestion with checkpoints for large document sets
- Persistent backends: optional Neo4j and RDF stores for larger knowledge bases
- Framework integrations: LangChain and LlamaIndex retrievers, plus OpenAI and Anthropic token counting
- Command-line tool:
noemafor compression, graph building, querying and inspection - Benchmark suite: reproducible comparison against plain-chunk RAG and full-context stuffing
Quick look
import noema
kb = noema.KnowledgeBase()
kb.ingest(documents)
context = kb.retrieve("Who is Google's CEO?", max_tokens=200)
prompt = f"{context.text}\n\nQuestion: Who is Google's CEO?"
Use cases
- Cutting LLM token costs in RAG pipelines and long-context applications
- Multi-hop question answering over facts spread across several documents
- Building a lightweight knowledge graph from text without hand-written schemas
- Keeping a knowledge base up to date as new documents arrive
Documentation
Installation, usage guides, CLI and integration docs are on the project Wiki.
Project status
Noema is under active development. The core pipeline, storage, retrieval, integrations, CLI and benchmark suite are implemented; the public API may still change before 1.0.
License
Noema is licensed under the Apache License 2.0.
Keywords: RAG, retrieval-augmented generation, knowledge graph, GraphRAG, LLM context compression, prompt compression, token reduction, semantic compression, entity and relation extraction, multi-hop question answering, LangChain, LlamaIndex, Neo4j, RDF, Python.
Metadata
Release files for noema-rag 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| noema_rag-0.1.0.tar.gz | 92.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| noema_rag-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 153.8 kB
Release files / noema_rag-0.1.0.tar.gz
| Download URL | noema_rag-0.1.0.tar.gz |
|---|---|
| Size | 92.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6dd0abda9e56301af1ef63f8a37751ac4e10ade47f6d0b24bbe2b5e5d9f5e83
|
|
BLAKE2b-256 checksum How to use checksums |
bd169248e73950347c71dd2c3e2f5063d35f2f910343f48e9d5f80a2bad94494
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.2
|
Release files / noema_rag-0.1.0-py3-none-any.whl
| Download URL | noema_rag-0.1.0-py3-none-any.whl |
|---|---|
| Size | 61.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7cee528ea4409f62eb40057b8ca62039a2a5c60a10d04efa75d7221fc6787c7
|
|
BLAKE2b-256 checksum How to use checksums |
81572dc55a6a2511d898d31a91b173daf6d0c8085e25ad039052e7babe6fa474
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.2
|
Security for noema-rag 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.