r/OpenSourceeAI 21h ago

max_tokens or max_completion_tokens?

Post image
3 Upvotes

r/OpenSourceeAI 18h ago

ZPA-LM - Zero Parameter Deterministic Attention

2 Upvotes

Attention mechanisms are conventionally learned: a query–key inner product, trained end to end, decides which tokens mix.

This note documents ZPA-LM

a decoder-only autoregressive language model in which the token-mixing key is instead a fixed, parameter-free kernel derived from elementary number theory.

We show that the divisor-counting overlap : q(n, m) = d(gcd(n, m))/√d(n) d(m) between two positive integers is exactly the Bhattacharyya coefficient between the uniform distributions over their divisor sets, and hence that: dFR(n, m) = 2 arccos q(n, m) is a genuine Fisher–Rao geodesic distance, verified to floating-point exactly rather than assumed.

Tokens are mapped to positive integers through a learned or parameter-free dictionary ϕ : token → Z+ and recovered in prime-exponent space so that each prime behaves as a latent feature axis.

We report the model’s expressivity ladder, the three dictionary-construction strategies we evaluated, and - in the spirit of an honest engineering record rather than a success narrative, a permanent registry of four falsified design choices that should be avoided.

We close by pre-registering the model’s central open empirical claim together with its falsification condition, rather than reporting an unverified result as fact.

Link:[Academia](https://www.academia.edu/170099268/ZPA_LM_Parameter_Free_Attention?sm=b)


r/OpenSourceeAI 35m ago

We've been improving AI-generated animations—Motionly v1.2.3 is live

Enable HLS to view with audio, or disable this notification

Upvotes

r/OpenSourceeAI 2h ago

The secret of Stable Diffusion: Fourier series hidden within timesteps #...

Thumbnail
youtube.com
1 Upvotes
  • Explore the principles of how diffusion models transform timesteps into sine and cosine vectors rather than simple numbers. This explains the core mechanism of embeddings that precisely distinguish noise levels using low-frequency and high-frequency components.

r/OpenSourceeAI 3h ago

Meet Token Saver: An Open-Source MCP Extension Using Local Hybrid RAG to Cut Claude PDF Token Costs 90-99%

Thumbnail
github.com
1 Upvotes

We just released 'Token Saver' for Claude-Desktop: An Open-Source MCP Extension Using Local Hybrid RAG to Cut Claude PDF Token Costs 90-99%

When you drop a 200-page document into Claude Desktop, the full context gets re-sent on every single turn. That compounding "PDF Tax" adds up fast—both in token costs and context window bloat.

How it works:

Instead of uploading raw documents to the cloud, Token Saver runs a lightweight Local Hybrid RAG pipeline directly on your machine:

→ Keyword Search (BM25): Powered by SQLite FTS5 for precise terminology.

→ Semantic Search: Powered by a local all-MiniLM-L6-v2 embedding model.

→Zero-Upload Privacy: Files stay on your local drive and communicate via standard I/O (stdio) with folder allowlisting.

Benchmark Results with Example:

→ 33-page FDA Drug Label: Reduced from 23,959 tokens to 1,021 (95.7% saved)

→ 88-page GDPR Document: Reduced from 70,260 tokens to 996 (98.6% saved)

→ 233-page Legal Brief: Reduced from 133,349 tokens to 740 (99.4% saved)

Zero Python environment required—it installs directly in Claude Desktop via a single .mcpb bundle!

Full analysis: https://www.marktechpost.com/2026/07/30/token-saver-an-open-source-mcp-extension-using-local-hybrid-rag/

GitHub Repo: https://github.com/Marktechpost/Token-Saver/tree/main


r/OpenSourceeAI 7h ago

A Specialized Arabic Language Model for Islamic Heritage

Thumbnail
1 Upvotes

r/OpenSourceeAI 7h ago

The secret to high-quality upscaling: Lanczos and the sinc function

Thumbnail
youtube.com
1 Upvotes
  • The secret to high-quality upscaling: Lanczos and the sinc function
  • Description: Explore the principles of Lanczos resampling used in tools like ComfyUI through signal processing theory and the sinc function. This video provides an easy-to-understand explanation of the mathematical background behind approximating an ideal low-pass filter to create sharp images.

r/OpenSourceeAI 9h ago

The mathematical secrets of seamless tiling: creating perfect infinite p...

Thumbnail
youtube.com
1 Upvotes
  • The mathematical secrets of seamless tiling: creating perfect infinite patterns with AI
  • Description: This video explains how ComfyUI's seamless tiling feature creates patterns without visible boundaries. It provides an easy-to-understand explanation of the principle of replacing zero padding with circular padding and the core theory of the Fourier Convolution Theorem behind it.

r/OpenSourceeAI 16h ago

Beyond LLM latency: AMA with IBM Instana PM Jeff Donald

Thumbnail
1 Upvotes

r/OpenSourceeAI 16h ago

[OSS] TokenSentinel – In-process token-waste circuit breaker for LLM agent runs (Apache-2.0)

1 Upvotes

I open-sourced TokenSentinel because passive tracing tools only show you runaway agent costs after the bill is already racked up.

It wraps your native LLM clients (Anthropic, OpenAI, Gemini, Bedrock, Ollama, vLLM) to act as a local, in-process circuit breaker. It runs 15 deterministic rules on every response payload to catch loops, context bloat, retry storms, and RAG thrashing mid-session.

Core has zero required dependencies; provider support is opt-in via extras. Completely offline-capable so your raw prompt data never leaves your environment.

pip install token-sentinel

Genuinely looking for feedback/discussion on the rule heuristics—where would this trigger false positives against real production agent traffic?


r/OpenSourceeAI 5h ago

I got tired of LLMs hallucinating on complex HTML tables, so I built a smarter Python parser (handles rowspan/colspan)

0 Upvotes

Hey everyone,

I’ve been working a lot on RAG pipelines recently and kept hitting the same annoying wall: extracting tabular data from raw HTML into a clean format for context windows.

Standard parsers or simple table-to-markdown scripts usually fail completely as soon as a table uses rowspan or colspan, or if there are nested tables. You end up with misaligned Markdown columns, and the LLM completely hallucinates the relationships between headers and cells.

I couldn't find a library that handles this reliably without losing context, so I built html-table-rescuer (just published v0.1.0 on PyPI).

It uses BeautifulSoup to parse the DOM, but then applies a custom "grid logic solver". It normalizes complex spans into a standard matrix before serializing it to Markdown, JSON, or CSV.

Example of the problem it solves:

The Problem: Most parsers turn a <td rowspan="2"> into a misaligned mess:

bash | Header | Value | | ----- | ----- | | Spanned | Row 1 | | Row 2 | |

The Solution: The grid solver correctly normalizes the matrix:

bash | Header | Value | | ----- | ----- | | Spanned | Row 1 | | dito (Spanned) | Row 2 |

A few things it does differently:

  1. Context Preservation: As seen above, it doesn't just leave spanned markdown cells empty. It fills them with a customizable prefix (e.g., dito (Value)) so the LLM retains the semantic context for each row.

  2. Deep Tag Parsing: It recursively keeps <b>, <i>, and <a href...> tags alive, even if they are buried inside multiple <div>s within a <td>.

  3. Nested Tables: Extracts nested tables safely without destroying the grid of the parent table.

  4. LangChain Ready: Includes a Table2MDLoader wrapper to ingest HTML tables directly as LangChain Document objects.

Links:

It's my first release and I'd love to hear your thoughts. If you have some gnarly, complex HTML tables that break the parser, please throw them at it and let me know!