spring-projects / spring-projects/spring-ai

Claude 3 on Bedrock with Spring AI - Ultra slow TTFT

Open
#1,235 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bedrock claude
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Bug description
Basically, the title.

We have context windows of around ~80-90K tokens and we've observed a TTFT in the order of 20-30s, which would sometimes cause a timeout from the Spring AI side.

As anyone experienced this before?

We are working with streaming, and the actual "output generation" in terms of tokens per second is very okay and stable, it just seems that there might be something related with the TTFT?

Environment
Spring AI 1.0.0-M1
Java 21
Springboot 3.3.0

Steps to reproduce
Send a prompt to Claude 3 Sonnet with ~85K context window size using streaming mode. Observe the time it takes to generate first token (20-30s, often with timeouts).

Expected behavior
Ideally the timeout period would be bigger from the framework side and/or the generation would be faster. I wonder if this is expected even when using streaming.

Minimal Complete Reproducible example
A prompt with a long list of names, for example, to hit 85K input tokens.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by sending a streaming prompt to Claude 3 Sonnet on Bedrock with about 85K input tokens, using Spring AI 1.0.0-M1, Java 21, and Spring Boot 3.3.0. Measure time to first token and determine whether the delay or timeout is controlled by the framework; done means the expected behavior and any necessary timeout handling are established.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java, spring, spring-boot
Domain
ai, backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.