
Imagine you have a GPU server running three applications: a support chatbot, a coding assistant and a batch summary application.
Now users begin to raise questions. How many tokens did each application use? Was the chatbot efficient? Which app is the most expense?
You go to your inference engine dashboard to check the numbers. It shows you the total number of tokens and the length of the queue, that’s it.
*How then can you get numbers per application without requiring each application team to change their code?
*
One way to do this is to look at the network.
*Why can’t the inference engine provide these numbers?
*
The inference engine only knows what happens internally to it. It knows the length of the queue, the batches and the memory on the GPU it is using.
It doesn’t know who is making the request or if the user gave up on the request halfway through. This information is on the network.
It’s also unlikely that application teams will add code to track this for you.
*What can you learn from one inference call?
*
Surprisingly a lot. Most inferences today use a similar format as the OpenAI API. Therefore, a tool to capture these calls can determine the endpoints of different engines.
Token counts come from the server itself and can differ from what you would bill a customer.
However it's important to note that the token count displayed by the inference engine is an estimate.
*How do you measure speed from network traffic?
*
You measure things like the time it took for the first word to appear, the overall time it took to receive the answer, the gaps in time between each word, and the overall speed of response. A time to first token (TTFT) metric is something network requests could also measure. However, your engine is likely not considering proxy or queue delays when calculating response times, so your metrics will more accurately reflect real world conditions. Currently, your time to first token and response time metrics are identical to those used by the LLM community to evaluate the performance of an LLM, so you are not truly innovating.
*What is the general architecture of the system?
*
The meter never really interacts with live traffic. It grabs a copy, rebuilds the conversation and writes a log file for each copy. These logs are written to Kafka which is then indexed in Elasticsearch and visualized using Kibana. This means each copy can be altered to include added tags to indicate the app which made the request.
*How does it know which application generated the request?
*
Each application has a unique IP address associated with it on the server and your orchestration tools already know which IP addresses are associated with which applications. Therefore, there is no need for additional code, tags or configuration per team to identify which application generated the request.
*What about requests made over SSL?
*
As most requests are now made over SSL, you would have to install a proxy to decrypt them. However, this would decrease the performance of the system and increase the risk of failure. The best solution would be to have a small agent running on the server to provide sessions keys to the meter which are then used to decrypt the traffic.
*What can the network see that the engine can’t?
*
Users who give up. The engine often keeps generating answers even after a user closes the connection. Because the network closes the connection, the engine thinks the user is still generating answers.
Answers that were cut short. Answers that reach the maximum character limit are flagged. Any answers that are cut short by the engine are noted by the network.
Apps that are resource hogs. Some apps request and reserve a large amount of output.
Load on the server. Each time the engine makes a request to the server it notes the load on the server at that time. This allows the engine to determine if a request was stuck in a long line or if it was just slow and resource intensive.
*What does it miss?
*
Some functions of the engine return no usage data. This is particularly evident with streaming applications. Estimated usage values are clearly identified as such. Real and estimated values are never intermixed. Some traffic can also be missed. This happens if a meter joins a connection too late or if some packets are dropped. Each record, however, is given a grade that reflects its completeness and quality.
*What can’t it decrypt?
*
Any encrypted data is inaccessible to the engine without the correct session keys. No data can be retrieved from an encrypted connection.
*Where can it run?
*
The engine can be run in two different locations and produces identical results.
On an NVIDIA BlueField-3 DPU mounted in front of the GPU server. No server CPU is used and apps can't go around it.
As a container on the GPU server itself using cores of the CPU that apps don't need. One like this is already running on a server with several apps including vLLM.
Some features of the Prompt text are disabled by default and not shared unless you turn them on. Passwords and keys are not shared in plain text.
How do you track token use per app today? A proxy? Logging inside the app? Evenly splitting the cost?
Source: How Do You Meter AI Factory Tokens per Application on the Wire? by Harrish S J and Subhiksha Devarajan.